2022-04-18 02:57 AM
Hi,
I am using stm32f1 and HUT21D sensor (Temperature and humidity sensor). The sensor use i2c for communication.
I am using IAR and cubeMX.
For cube: I used default setting for i2c.
For IAR: I shared the main.c below.
Can anyone help on why only get 0.
#I2C #[STM32 MCUs]
Solved! Go to Solution.
2022-04-20 02:11 AM
I have a question. Sometimes I get HAL_OK and Sometimes I get HAL_Error. Is the problem with wires or not? I can't find why?
2022-04-20 02:32 AM
It could be the wires but 10cm is still a human distance. Did you measure with an oscilloscope SDA and SCL? Are the waveforms clean?
2022-04-20 03:42 AM
It seems that one the capacitors was not correctly soldered and it change the ground. it works for now.
Thnx everyone.