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

Error when turn on sensor with TWI

I need to save energy for my ble application. So I turned off the sensor when there was no ble connection. A ble connection is a condition for me to turn on the sensor, but I cannot connect to the peripheral, when placing a connection command on nRF Connect, the debugger reports "Memory read failure".
Whether declared or not declared i2c, the phenomenon still occurs.

I am using a port to turn on and off the si7021 sensor as shown below:

When the central connection comes in, during the BLE_GAP_EVT_CONNECTED event I will turn on the sensor by setting the output of port 15 to 1. I have a problem connecting, the debugger does not report an error. Chip rebooted.

I am using twi with library twi_sw_master.c. So how do I turn this sensor on and off? Please help me, thanks a lot

P/s: nRF52832 s132 ver 6.1.1 SDK 15.3

Parents
  • Hi,

    Any particular reason you are using a deprecated software (bit-bang) TWI driver? There are new (HW) drivers located in nRF5_SDK_15.3.0_59ac345\modules\nrfx\drivers\src - nrfx_twi.c and nrfx_twim.c, and these can also be used with the legacy API found in nRF5_SDK_15.3.0_59ac345\integration\nrfx\legacy\nrf_drv_twi.h.

    If the chip rebooted, you most likely ended up in the error handler. Please check out this post about debugging errors.

    Best regards,
    Jørgen

Reply
  • Hi,

    Any particular reason you are using a deprecated software (bit-bang) TWI driver? There are new (HW) drivers located in nRF5_SDK_15.3.0_59ac345\modules\nrfx\drivers\src - nrfx_twi.c and nrfx_twim.c, and these can also be used with the legacy API found in nRF5_SDK_15.3.0_59ac345\integration\nrfx\legacy\nrf_drv_twi.h.

    If the chip rebooted, you most likely ended up in the error handler. Please check out this post about debugging errors.

    Best regards,
    Jørgen

Children
Related