Send more than 8192 bytes on nrf9160 using nrfx_twim

This has been asked before i2c message max buffer size but I need a little more info on the the proposed solution "break it up into chunks" from Oyvind.

Using nrfConnect SDK 1.6.1

The MAX32664 requires 8210 bytes in a flash write message between START and STOP conditions. Using the "drivers/i2c" this results in 18 bytes being sent due to TX.MAXCNT overflow.

Using the "drivers/i2c" driver provided you can send two chunks (4000 say, then 4210 bytes)- 1st without STOP and second with a STOP but this results in a repeated start being generated between the two transactions and the MAX32664 doesn't seem to like it.

is there a way to use the nrfx_twim.c driver to send the second chunk without the "repeated START". If anyone has done this with MAX32664 and nrf9160 and I'm sure someone has - any pointers or code fragments would be appreciated.

Mark

Parents Reply Children
  • Hi Kazi

    I tried your suggestion:

        // send more than 8192 bytes
        #if 1
       void I2C_longwrite_TWIM1( uint8_t address,  uint8_t *buffer, uint32_t length )
        {
            struct i2c_msg msg[2];

            nrf_gpio_pin_set(DBG_IO_1);
            msg[0].buf = (uint8_t *)&buffer[0];
            msg[0].len = length/2;
            msg[0].flags = I2C_MSG_WRITE ;

            msg[1].buf = (uint8_t *)&buffer[length/2];
            msg[1].len = length/2;
            msg[1].flags = I2C_MSG_WRITE | I2C_MSG_STOP;

            i2c_transfer( i2c_dev1, &msg[0], 2, 0x55 );
            nrf_gpio_pin_clear(DBG_IO_1);
        }
        #endif
    But this sends [START][ADDR] [1st half of buffer] .... [START][ADDR][2nd half of buffer][STOP]
    Status read from the MAX32664 after this reports Error code.
    I need to send [START][ADDR][8192 bytes of data] [18 bytes of data] [STOP] to be successful. Any ideas on how you would get the TWIM to do that?
    Thanks
    Mark
Related