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

i2c message max buffer size

Hello,

I am using the nrf9160DK and I am implementing on zephyr.

For my application I need to write to an external flash memory through I2C. I need to write one page at a time + CRC bytes. In total I need to write 8210 bytes.

However using a logic analyzer I noticed that when I tried to send 8210 bytes, the 9160 actually wrote 18 bytes. When I tried to write 8192 bytes the 9160 wrote 0 bytes and when I tried to write 8191 bytes the 9160 wrote 8191 bytes. So it looks like uart message length "overflows" at 8k bytes.

My question is:

Is there a built in max length for i2c transactions? is that 8k bytes? Is there a way around that? 

Parents Reply
  • Yes. I have to write the page+ checksum bytes at one transaction, so 8210 bytes at one go.

    What functions am I supposed to use to utilize twim.  those at zephyr\ext\hal\nordic\nrfx\drivers\include nrfx_twim.h? those at zephyr\drivers\i2c  i2c_nrfx_twim.c (can't find .h header for those)?

    Looking into nrf9160.h and  NRF_TWIM_Type and its  member TWIM_TXD_Type 

    typedef struct {
      __IOM uint32_t  PTR;                          /*!< (@ 0x00000000) Data pointer                                               */
      __IOM uint32_t  MAXCNT;                       /*!< (@ 0x00000004) Maximum number of bytes in transmit buffer                 */
      __IM  uint32_t  AMOUNT;                       /*!< (@ 0x00000008) Number of bytes transferred in the last transaction        */
      __IOM uint32_t  LIST;                         /*!< (@ 0x0000000C) EasyDMA list type                                          */
    } TWIM_TXD_Type;                         

    it looks like  MAXCNT refers to TXD.MAXCNT?

    So even with TWIM is it possible to send more that 8191 bytes? yes or no?

Children
Related