Unable to read the data from the DHT11 temperature sensor
- 3 replies
- 2610 views
I have written the following bare-metal code to get readings from the DHT11 sensor on my stm32 G071RB board:
I have attached my main.c file below.
When I try to debug my code, the execution halts at - while ((DHT11_PORT->IDR & GPIO_PIN_12) != 0); in the sensor response function, suggesting that the sensor has not pulled the bus low to respond to the start signal sent by MCU.....(IDR12 in the IDR register remains high)
This can mean that the sensor is not detected by the MCU after sending the start signal or the sensor is not able to send the data.
I have checked the RCC configuration and Timer 6 delay configuration code. It does seem to work accurately and can be confirmed using a simple LED blink code for numerous seconds...
could someone provide any suggestions to solve this problem?
I have tried using different dht11 sensors, which suggests that the problem has got to be with the code.....
