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

twi_scanner only detects I2C devices in debug mode

Hello all

I copied the peripheral>twi_scanner example and adapted it to the nRF52833 chip on our custom board.

I have 4 chips (0x0b, 0x48, 0x52, 0x68) that use I2C on the custom board.
If I simply connect / erase / download the program, "no device" is found
If I debug (F5) the program and step through, the devices are found.

What am I missing?

The way I will go about it is the following:

Attempt 1) Compare debug and release configurations, adapt if needed
Attempt 2) Build the twi_scanner code step by step, see if any command is "board specific" and cannot be adapted from nRF52840/nRF52833 to our own board

Any other ideas?

Thank you, in advance, for your time and help.
Tell me if there is anything I can share (preprocessor directives, code, details about the custom board...)

Have a great Friday

Jerome

  • Are you sure that the nrf_delay_ms() works as expected when not debugging? Can it be that the compiler may optimize it away?

    A read sequence typically is:

    [START] device_address + read bit, device_register [re-START] device_address, sample_data [STOP]

    Though in your case it seems you are consistenly receiving NRF_ERROR_DRV_TWI_ERR_ANACK, which means "NACK received after sending the address in polling mode".

    So this is indeed strange.

Related