This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Unable to write 8210 bytes on I2C_0 bus in Zephyr RTOS

Hello,

I am using NCS v1.6.0 for nRF52840.

I need to write 8210 bytes to flash via I2C. I configured the I2C0 with NRFX_TWIM and NRFX_TWIM0 enabled in the prj.conf file.

I am using i2c_transfer API from Zephyr to perform I2C operations.

All other I2C transactions for reading writing registers are working. When I try to send 8210 bytes of data. I get following error

[00:00:13.442,718] <err> i2c_nrfx_twim: Error on I2C line occurred for message 1
I2C write retry = -5
 
[00:00:13.443,420] <err> i2c_nrfx_twim: Error 0x0BAE0002 occurred for message 1
 I2C write retry = -5
 
[00:00:13.443,725] <err> i2c_nrfx_twim: Error 0x0BAE0002 occurred for message 0
 I2C write retry = -5

[00:00:13.444,061] <err> i2c_nrfx_twim: Error 0x0BAE0002 occurred for message 0
I2C write retry = -5
 
 [00:00:13.444,366] <err> i2c_nrfx_twim: Error 0x0BAE0002 occurred for message 0

Parents
  • Hi

    As I don't know what your application looks like it's hard to say what you need to do. Can we start off by looking at your TWI init function, as the write retry error you're seeing is -5 points toward an I/O error, please make sure that the device you're reading data from might not be initialized properly and is ready for a transaction?

    Best regards,

    Simon

  • Hi Simon,

    My application is to write 8208 bytes of data to a flash using I2C for 33 times. I have copied the hex values of the file in a header file of uint8_t bytes array. I read the 8k of data from the header file and copy it to a dynamically allocated buffer and transmit it over I2C. But when I transfer more than 16 bytes I get i2c error. I have copied the error below. Can you let me know how to increase the transmit buffer in zephyr rtos.

    Note: I am using NCS 1.6.0

    [00:00:07.646,026] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0
    00>
    00> [00:00:08.146,179] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0
    00>
    00> [00:00:08.646,301] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0
    00>
    00> [00:00:09.146,423] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0
    00>
    00> [00:00:09.646,575] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0
    00> [00:00:10.152,893] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0

    When write more than 16 bytes of data on I2C, getting the following error. If we transmit less than 16 bytes transaction is completing without any errors.

    Thank you

Reply
  • Hi Simon,

    My application is to write 8208 bytes of data to a flash using I2C for 33 times. I have copied the hex values of the file in a header file of uint8_t bytes array. I read the 8k of data from the header file and copy it to a dynamically allocated buffer and transmit it over I2C. But when I transfer more than 16 bytes I get i2c error. I have copied the error below. Can you let me know how to increase the transmit buffer in zephyr rtos.

    Note: I am using NCS 1.6.0

    [00:00:07.646,026] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0
    00>
    00> [00:00:08.146,179] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0
    00>
    00> [00:00:08.646,301] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0
    00>
    00> [00:00:09.146,423] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0
    00>
    00> [00:00:09.646,575] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0
    00> [00:00:10.152,893] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0

    When write more than 16 bytes of data on I2C, getting the following error. If we transmit less than 16 bytes transaction is completing without any errors.

    Thank you

Children
No Data
Related