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.
Table 1: Demos Overview
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.
Table 2. DS2485 API Overview
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.
Table 3. 1-Wire API Overview
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.
Table 4. DS28E18 API Overview
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.
|