This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

TWI incorrectly sends data

Hi

I am currently trying to connect the sht31 temperature / humidity sensor. First, I made an implementation based on the twi_sensor example. I did it all, the temperature and humidity read correctly.

When I decided to use the resulting code in my main program, where bluetooth transmission was implemented, I started having problems. When transmitting commands to the sensor (address, msb, lsb), the lsb command is not transmitted correctly, instead of the pledged command 0x06, it transmits a completely different value.
This situation occurs in the following cases:
1) if you call the nrf_drv_twi_tx function in a while (1) loop in the main function and the idle_state_handle function is also called there. If you comment out the idle_state_handle, then the commands normally transmit and read the values ​​of humidity and temperature.
2) if you call the function nrf_drv_twi_tx in a timer interrupt.

I assume there is a conflict causing one interruption in another? or some other reason?

correct transmission of commands (Address = 0x44 (offset right), MSB = 0x2C, LSB = 0x06)

LSB incorrect send

Chip: SKB501 (analog nRF52840);

SDK: nRF5_SDK_15.2.0;

Softdevice: s132_nrf52_6.1.0_softdevice;

Thanks in advance for your help.

Parents Reply Children
Related