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

nrf_drv_twi_tx twi softdevice s110 problem

hi~ i am working with nrf 51822 with custom board and softdevice s110. i am using is7020-a20 temperature / humidity sensor via twi (i2c)

i tried 2 versions of twi example in sdk ver.10 using nrf_drv_twi and app_twi. twi_init() looks working fine on both.

address of pin scl is 15 and sda is 16 and address of sensor is (0x80 >> 1). i checked it several times.

when i execute nrf_drv_twi_tx() or nrf_drv_twi_rx(), device stops and doesn't work neither app_twi_perform().

i know that app_twi_xxx functions uses nrf_drv_twi_xxx functions.

i read some questions about twi communication with softdevice s110. so i tried to assign ppi channel to twi and it didn't work too.

please check my code and tell me what is wrong with my code

i commented out what i've tried before, so check the commented code too. thanx. main.c

  • Hi.

    • Have you tried to communicate with your device without the SoftDevice running?
    • Are you sure the address is correct and that you are supposed to right shift it?
    • Have you checked for errors returned from the TWI drivers? You can check p_event->type for NRF_DRV_TWI_ERROR as well as NRF_DRV_TWI_RX_DONE and NRF_DRV_TWI_TX_DONE. If you don't use a TWI handler then the TWI drivers will operate in blocking mode meaning that your code will get stuck if you try to transmit something on the TWI bus and something goes wrong.
    • Here is a simple example for debugging a TWI application.
  • hi, thanks for answer. yes, i tried to running twi example without softdevice and got right return values. it still doesn't work with softdevice. it seems reset when execute nrf_drv_twi_tx() with softdevice. i have two leds, so i tested that led1 blinks when tx_done and led2 blinks when rx_done in twi_handler without softdevice. i checked with ocillator, scl and sda are fine without softdevice but it doesn't with softdevice. it doesn't show any waves. is there any common trouble issue for twi with softdevice?

  • Hi Martin, Justin. We are facing the exact same problem here (using nRF5_SDK_12.3.0). When I have no softdevice, I can call nrf_drv_twi_tx() and talk to my sensor, but with softdevice enabled, the call to nrf_drv_twi_tx() will hang forever. Was there any resolution to this thread?

  • Shooting from the hip here, but it could be similar to this case (or the cases linked to within it). If that is not the case I think you should open a new thread, and maybe post some of you code.

Related