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

How to resolve NRF_ERROR_INTERNAL error in TWI communication?

Hi,

I'm using PCA10040 board, There i connected the fuel gauge IC via TWI communication. There pca10040 will acts as master and fuel gauge IC will acts as slave.

While Read and write we are getting "NRF_ERROR_INTERNAL" error and hangs there itself. If i give some delay (like 100ms) for each read and write its working fine.

That same fuel gauge setup i connected to some other controller (Master), There also i'm accessing via TWI communication. There without delay i can able to read and write the values.

After that i probed both the setups (PFA),

setup 1 : PCA10040 (Master) - Fuel Gauge IC (slave)

NORDIC.tar.bz2

setup 2 : Other Controller (Master) - Fuel Gauge IC (slave)

OTHER_CONTROLLER.tar.bz2

While comparing that, In Nordic setup, End of the each byte (after 9 clock cycles) SDA pulse goes high for some time. But in other controller not like that wherever data presents that time only it goes high.

Is that extra SDA pulse cause any issue ?

May i know why that SDA pulse goes high for some time in Nordic controller?

Thanks in advance,

  • Hi Naveen,

    Could you track down and find which function threw the "NRF_ERROR_INTERNAL" error ? Could you try to use the TWI directly and skip the driver, just to send or receive a few bytes.

    If you send 2-3 bytes at a time in one packet what the signal would be?

  • Hi Hung Bui,

    The "twi_tx_start_transfer" function is throwing "NRF_ERROR_INTERNAL" error.

    I enabled debug prints in "twi_tx_start_transfer" and "twi_transfer" functions.

    In success case (with delay for each read and write) "twi_transfer" function returned false condition after writing all bytes (NRF_TWI_EVENT_STOPPED is stopped).

    In Failure case (without delay) "twi_transfer" function returned true condition continuously, so its hangs.

    May i know how to resolve this issue ?

    Thanks regards, -Naveen

  • Hi Naveen,

    If the TWI slave NACK, then on the master we will receive NRF_TWI_EVENT_ERROR and in the application it will be resulted as NRF_ERROR_INTERNAL.

    It's a little bit strange in your probe trace that the SDA and SCL were held low when finished transaction, it should be high as the pins are pulled up. I assume that the slave held them low. Could you send the schematic ? Also please update the datasheet of the sensor you used.

    Have you tried to test with the twi_master_with_twis_slave example, just to verify the normal behaviour of the nRF52 and TWIS+TWIM ?

  • Hi Hung Bui,

    Thanks for your responses,

    Transaction is not yet completed that’s why its low, whatever i sent above (probed pics) that’s for single write but i'm doing multiple writes so its showing low state.

    we are using fuel gauge sensor, Please find the data-sheet and circuit diagram (Figure-1) in below link.

    www.onsemi.com/.../LC709203F-D.PDF

    we verified the twi_master_with_twis_slave example, its fine.

    Thanks Regards, -Naveen

  • I assume you used the external pullup resistors, have you removed the internal pull up when configuring TWI ? By default we use internal pullup for the TWI pins with the twi driver.

    It's not very clear for me, from your trace, there is no STOP condition but there are gaps between each byte, does that mean you used SUSPEND task? When you finish a transaction would the pins go high up ?

Related