Overview
Design Resources
Device Drivers
Software such as C code and/or FPGA code, used to communicate with component's digital interface.
Description
The DS2485 is a 1-Wire® master that performs protocol conversion between the I2C master and any attached 1-Wire slaves. For 1-Wire line driving, internal user-adjustable timers relieve the system host processor from generating time-critical 1-Wire waveforms, supporting both standard and overdrive communication speeds. The 1-Wire master has a selectable active or passive 1-Wire pullup. Strong pullup features support 1-Wire power delivery for 1-Wire devices that require additional current such as EEPROM writes or cryptographic operations. The MAXREFDES9004 is a reference design showcasing the DS2485 and its versatility in 1-Wire systems. It includes example design files for connecting an Arm® Cortex®-M4 host microcontroller with the DS2485 to communicate with a remotely connected DS28E18 1-Wire slave. It also includes example C-code firmware for supporting Arm Cortex-M4 microcontrollers that demonstrate how to integrate the DS2485 in software.Features & Benefits
- Dedicated 1-Wire Master for Convenient 1-Wire Processing
- Up to 100m Remote Communication with Connected 1-Wire Slave Devices
- C-Code Demonstrates How to Use the DS2485 in Software Including an Example with the DS28E18
Designed–Built–Tested
A simple, cost-efficient, 1-Wire master is demonstrated using the DS2485 for a simple sensor application using the MAX32660 host microcontroller. This reference design includes the following major components: one each of MAX32660 Cortex-M4 microcontroller, DS2485 1-Wire master, DS28E18 1-Wire to I2C/SPI bridge and an I2C temperature sensor module. This document describes the hardware shown above as well as its supplementing software. It provides a detailed, systematic technical guide to set up and understand the MAXREFDES9004 reference design. The system has been built and tested, details of which follow later in this document.
Details Section
This section includes a list of recommended equipment and instructions on how to set up the Windows®-based PC for the C-Demo software.
Required Equipment
- PC with a Windows 10, Windows 8, or Windows 7 operating system (64-bit or 32-bit) and a spare USB 2.0 or higher port
- Low-power Arm Micro Toolchain (Windows)
- C-Demo software
Procedure
The reference design is fully assembled and tested. Follow the steps below to set up the demo software:
- Download the ARMCortexToolchain.exe file.
- In a file viewer (Figure 1), double-click on ARMCortexToolchain.exe to begin the installation.
- Follow the prompts on the setup wizard (Figure 2) to finish installation.
- Navigate to the toolchain's install directory, open the Eclipse folder, and run Eclipse.bat to launch the Eclipse IDE, as shown in Figure 3.
- Create a workspace in a desired location, as shown in Figure 4.
- Download MAXREFDES9004 Software and extract the DS2485_C_Demos.zip file, in any location, as shown in Figure 5.
- In Eclipse, go to File\Import... and select Existing Projects into Workspace under the General folder. Click Next > and then Browse... to open the directory browser. Navigate to the C-demo installation directory. Select the extracted folder containing the example programs and click OK. In the panel, check the checkbox next to the desired projects to import. Check the box labelled Copy projects into workspace and click Finish, as shown in Figure 6.
- Open up a serial console and connect it to the MAX32660's corresponding serial COM port, as shown in Figure 7.
- Select the example program to run under the drop-down box located next to the green 'Run' button, as shown in Figure 8. The output will be displayed onto the serial console as shown in Figure 9.
Figure 1: File Viewer
Figure 2: Toolchain Setup Wizard
Figure 3: Eclipse Launch Location
Figure 4: Eclipse Workspace Creation
Figure 5: C-Demo Extraction
Figure 6: Importing C-Demo Examples
Figure 7: Opening a Serial Console
Figure 8: Running the Read_Temperature Demo Program
Figure 9: Console Output for Read_Temperature Demo Program
A detailed block diagram of the MAXREFDES9004 hardware is shown in Figure 10. This setup is designed to support multiple DS28E18 1-Wire slaves remotely connected to a DS2485 1-Wire master at distances over 100 meters. For this reference design, an Analog® MAX32660 Cortex M4 microcontroller is used to interface with the DS2485 through its I2C peripheral. The MAX32660's I2C port pins, P0_8 and P0_9, are connected to the DS2485's SDA and SCL pins, respectively, each with a 10kΩ external pullup resistor connected to 3.3V. The DS2485 bridges 1-Wire communication with a remote DS28E18 device connected through a 100-meter long CAT5E twisted-pair cable. At the near-end of the cable resides a low-impedance P-channel MOSFET, Q1, which is controlled by the DS2485's GPIO pin and is designed to supply the 1-Wire bus with more current during heavy loads. At the far-end of the long cable resides a DS28E18 connected to a Sensirion SHTC3 I2C temperature and humidity sensor.
See App Note 7478: DS28E18 Setup Guide for Remote I2C and SPI Sensors Featuring the DS2485 for more information on setting up the DS28E18 for long-line communication.
Figure 10: MAXREFDES9004 Detailed Block Diagram
The MAXREFDES9004 software consists of C-code demonstration programs mainly showcasing the DS2485. See Table 1 for a detailed list of available C-programs. The software is supported on the MAXREFDES9004 hardware and includes the firmware and source files for programming an Arm Cortex-M4 processor-based microcontroller like the MAX32660. This C-Demo software utilizes a DS2485 1-Wire and a DS28E18 API for convenient interfacing within the system. The software is compatible with the Maxim toolchain, that can be found in the design resources tab of the MAX32660 and can be directly imported into an Eclipse IDE workspace. See the Quick Start section for details on how to set up the C-Demo software.
Demo Program | Description |
Read_Temperature | Demo program showcasing majority of the DS2485's 1-Wire master features and the reference design hardware from Figure 11. Uses the DS2485-based 1-Wire API and the DS28E18 API to interface with a remote temperature sensor connected to a DS28E18. |
One_Wire_Scripting | Demo program showcasing the DS2485's 1-Wire scripting feature specifically. Uses the DS2485-based 1-Wire API to interface the DS2485 with a DS28E18 device. |
DS2485 API
Table 2 presents a brief overview of the DS2485 API. This API allows the MAX32660 to interface with the DS2485 through I2C and provides access to each of the DS2485's device function commands.
Function | Description |
DS2485_WriteMemory | DS2485 performs a 'Write Memory' command. |
DS2485_ReadMemory | DS2485 performs a 'Read Memory' command. |
DS2485_ReadStatus | DS2485 performs a 'Read Status' command. |
DS2485_SetI2CAddress | DS2485 performs a 'Set I2C Address' command. |
DS2485_SetPageProtection | DS2485 performs a 'Set Page Protection' command. |
DS2485_ReadOneWirePortConfig | DS2485 performs a 'Read 1-Wire Port Config' command. |
DS2485_WriteOneWirePortConfig | DS2485 performs a 'Master Reset' command. |
DS2485_MasterReset | DS2485 performs a 'Read Memory' command. |
DS2485_OneWireScript | DS2485 performs a '1-Wire Script' command. |
DS2485_OneWireBlock | DS2485 performs a '1-Wire Write Block' command. |
DS2485_OneWireWriteBlock | DS2485 performs a 'Read Memory' command. |
DS2485_OneWireReadBlock | DS2485 performs a '1-Wire Read Block' command. |
DS2485_OneWireSearch | DS2485 performs a '1-Wire Search' command. |
DS2485_FullCommandSequence | DS2485 performs a 'Full Command Sequence' command. |
DS2485_ComputeCrc16 | DS2485 performs a 'Compute CRC16' command. |
1-Wire API
The 1-Wire API provides full control of the 1-Wire interface. It includes a range of 1-Wire master functionality that is derived from the DS2485 API and is designed to interface with 1-Wire slave devices more easily. An overview of the 1-Wire API is shown in Table 3. See the demo program, "One_Wire_Scripting" for an example of how to use the 1-Wire API to read the DS28E18's device status.
Function | Description |
OneWire_Init | Configures the DS2485 to default settings. |
OneWire_ResetPulse | Sends a 1-Wire reset pulse down the 1-Wire bus using the DS2485. |
OneWire_WriteByte | Sends a byte down the 1-Wire bus command using the DS2485. |
OneWire_WriteBlock | Sends a block of data down the 1-Wire bus using the DS2485. |
OneWire_ReadByte | Reads a byte from the 1-Wire bus using the DS2485. |
OneWire_ReadBlock | Reads a block of data from the 1-Wire bus using the DS2485. |
OneWire_WriteBytePower | Sends a byte down the 1-Wire bus and enables a strong pullup (SPU) immediately thereafter using the DS2485. |
OneWire_ReadBytePower | Read a byte from the 1-Wire bus and enables a strong pullup (SPU) immediately thereafter using the DS2485. |
OneWire_Search | Searches for slave devices on the 1-Wire bus using the DS2485. |
OneWire_Set_OneWireMasterSpeed | Configures the DS2485's 1-Wire Master speed between Standard and Overdrive. |
OneWire_Set_tX | Configures a DS2485's 1-Wire Master timing, 'X' (i.e., tRSTL, tMSP, etc.). |
OneWire_Enable_APU | Configures the DS2485's 'APU' setting. |
OneWire_Enable_SPU | Configures the DS2485's 'SPU' setting. |
OneWire_Enable_OneWirePowerDown | Configures the DS2485's 'Power Down' setting. |
OneWire_Script_Add_X | Adds a 1-Wire primitive command, 'X' (i.e., OW_RESET, DELAY, etc.) to a global buffer in software. |
OneWire_Script_Execute | Performs a '1-Wire Script' command using primitive commands from global buffer in software using the DS2485. |
DS28E18 API
The C-Demo software also provides a DS28E18 API. A brief overview of the DS28E18 API is shown in Table 4. This API makes it easy to exercise all the features of the DS28E18 and can be used to integrate multiple I2C and SPI devices into a system. See the demo program, "Read_Temperature," for an example of how to use the DS28E18 API to read a temperature and humidity value from a remote Sensirion SHTC3 I2C sensor.
Function | Description |
DS28E18_Init | Initializes all DS28E18 devices found on the 1-Wire bus. |
DS28E18_SetSpeed | Sets the DS28E18 speed between Standard and Overdrive. |
DS28E18_WriteSequencer | Writes specified data into the DS28E18 sequencer. |
DS28E18_ReadSequencer | Reads specified data from the DS28E18 sequencer. |
DS28E18_RunSequencer | Commands DS28E18 to execute specific I2C/SPI sequences from its sequencer. |
DS28E18_WriteConfiguration | Configures the DS28E18's general configuration settings. |
DS28E18_ReadConfiguration | Reads the DS28E18's general configuration settings. |
DS28E18_WriteGpioConfiguration | Configures the DS28E18's GPIO configuration settings. |
DS28E18_ReadGpioConfiguration | Reads the DS28E18's GPIO configuration settings. |
DS28E18_DeviceStatus | Reads the DS28E18's device status. |
DS28E18_BuildPacket_X | Builds 1-Wire packet for Sequencer Command, 'X' (i.e., I2C Start, SENS_VDD On, etc.) and stores it in a global buffer in software. Buffer can be used as a 'DS28E18_Write_sequencer' input. |
Documentation & Resources
-
MAXREFDES9004 Design Files9/13/2021ZIP1 M
Support & Training
Search our knowledge base for answers to your technical questions. Our dedicated team of Applications Engineers are also available to answer your technical questions.