Supported Platforms: MOD5441x, NANO54415
1-Wire DS2401 Silicon Serial Number Reader
Overview
This NetBurner application demonstrates how to interface with a DS2401 Silicon Serial Number chip using the 1-Wire protocol on MCF5441X-based platforms. The application continuously detects and reads the unique 64-bit registration number from connected DS2401 devices.
Supported Platforms
- MOD5441X - Uses pin J2[37] for 1-Wire data line
- NANO54415 - Uses pin 12 for 1-Wire data line
Hardware Requirements
- NetBurner MOD5441X or NANO54415 module
- DS2401 Silicon Serial Number chip
- Pull-up resistor (4.7k ohm recommended) between data line and VCC
- Power supply connections (VCC and GND)
Hardware Connections
MOD5441X Platform
- 1-Wire Data: J2[37] (configured as OW_DAT function)
- Power: Connect DS2401 VCC to 3.3V or 5V
- Ground: Connect DS2401 GND to system ground
- Pull-up: 4.7k ohm resistor between data line and VCC
NANO54415 Platform
- 1-Wire Data: Pin 12 (configured as OW_DAT function)
- Power: Connect DS2401 VCC to 3.3V or 5V
- Ground: Connect DS2401 GND to system ground
- Pull-up: 4.7k ohm resistor between data line and VCC
Application Functionality
Main Features
- 1-Wire Protocol Implementation: Custom 1-Wire peripheral driver
- Device Detection: Automatic detection of DS2401 devices on the bus
- Serial Number Reading: Reads complete 64-bit registration number
- Continuous Monitoring: Polls for devices every 5 seconds
- Formatted Output: Displays family code, serial number, and CRC
Program Flow
- Initialization
- Initialize network stack with
init()
- Enable system diagnostics
- Wait for network activity (up to 5 seconds)
- Initialize 1-Wire module with
OWInit()
- Configure platform-specific pin functions
- Main Loop (repeats every 5 seconds)
- Detect devices on 1-Wire bus using
OWDetectDevices()
- If device found:
- Send Read ROM command (0x33) to DS2401
- Read 8 bytes of registration data
- Parse and display formatted output
- If no device found:
- Display "Device not detected" message
Output Format
When a DS2401 is detected, the application displays:
- - - - - - Device detected - - - - - -
Family Code: 0x01
Hex Serial Number: 12 34 56 78 9A BC
CRC Code: 0xDE
DS2401 Registration Number Structure
The 64-bit registration number consists of:
- Byte 0: Family Code (0x01 for DS2401)
- Bytes 1-6: 48-bit unique serial number
- Byte 7: 8-bit CRC checksum
Key Components
Core Functions
- **
OWInit()**: Initializes the 1-Wire peripheral module
- **
OWDetectDevices()**: Scans bus for connected 1-Wire devices
- **
OWWrite()**: Sends data to 1-Wire device
- **
OWRead()**: Receives data from 1-Wire device
- **
OWDone()**: Checks if 1-Wire operation is complete
Semaphore Usage
The application uses an OS semaphore (OS_SEM busSem) to synchronize 1-Wire read operations, ensuring data integrity and proper timing.
Building and Deployment
Prerequisites
- NetBurner Development Kit installed
- Target platform environment variables set
Troubleshooting
Common Issues
- **"Device not detected" message**
- Check physical connections
- Verify pull-up resistor is installed (4.7k ohm)
- Ensure DS2401 is powered correctly
- Confirm correct pin assignment for platform
- Build errors
- Verify PLATFORM is set correctly (MOD5441X or NANO54415)
- Check that NNDK_ROOT environment variable is set
- Ensure all source files are present
- Invalid serial number readings
- Check data line signal integrity
- Verify timing requirements are met
- Ensure only one DS2401 device on bus for this example
Debug Output
The application includes diagnostic output showing:
- Application startup confirmation
- Device detection status
- Complete registration number breakdown
- Timing of detection attempts
Technical Notes
1-Wire Protocol Details
- Single data line for bidirectional communication
- Master-slave architecture (NetBurner as master)
- Time-slot based communication protocol
- Requires external pull-up resistor
DS2401 Specifications
- 64-bit lasered ROM with unique serial number
- Operating voltage: 2.8V to 6.0V
- Operating temperature: -40C to +85C
- Single-contact 1-Wire interface
Application Use Cases
This example demonstrates fundamental concepts applicable to:
- Asset tracking and identification
- Serial number logging systems
- Device authentication
- Inventory management
- Temperature sensor networks (with protocol modifications)
Related Examples
For additional 1-Wire functionality, consider exploring:
- Multi-device 1-Wire networks
- Temperature sensors (DS18B20)
- 1-Wire memory devices
- Advanced search algorithms for device enumeration