Issues with MATCH ROM Command in DS18B20 Sensor Communication on STM32 Using UART
I am working on reading temperatures from multiple DS18B20 sensors connected to a shared 1-Wire bus on an STM32 NUCLEO-F103RB board. The sensors operate in parasitic power mode, with a 4.7k pull-up resistor on the data line, and I’m using UART in half-duplex mode to emulate 1-Wire communication.
I can read data from a single sensor using the SKIP ROM command and retrieve sensor IDs with the READ ROM command. However, when I try to communicate with a specific sensor using the MATCH ROM command, I don’t receive any response.
My code :
I’ve verified the ROM codes using the READ ROM command, and they are correct. I switch the UART baud rate from 9600 (for the reset pulse) to 115200 (for data), but suspect this may cause timing or initialization issues.
Problems:
1. MATCH ROM Command Failure: The sensor doesn't respond after the MATCH ROM command.
2. Baud Rate Switching: Switching between 9600 and 115200 baud might cause communication issues.
3. Error Handling: My code lacks handling for failed transmissions or invalid responses.
What could be causing the MATCH ROM failure, and how can I ensure correct UART baud rate switching and timing for multiple sensors?
2 Replies
Hi @Sterling your code doesn't check if the sensor responds as expected after each command, which is important for debugging
I will look into it, thanks @Marvee Amasi