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
  • Hello Mark,

    You are using old version of NCS. Can you please share some part of your code? 

    Thanks.

    Best Regards,

    Kazi Afroza Sultana

  •     #include <drivers/i2c.h>

        #define MAX_PAGE_SIZE 8192
        #define CHECKBYTES_SIZE 16
        extern const struct device * i2c;
        uint8_t send[8210];
        int write_flash_page()
        {
            uint8_t sh_addr = 0x55;
            int err = i2c_write( i2c, send, MAX_PAGE_SIZE + CHECKBYTES_SIZE + 2, sh_addr );
            return err;
        }
    This code will send 18 bytes and STOP

    Using 1.6.1 because the revision of the nrf9160 is B0.

    Not sure it's case of old code - because the TWIM peripheral can only send 8192 bytes in one transaction. More like how do I get the nrfx_twim.c module to send more than the maximum(8192) before sending STOP

    Just a gap in my knowledge - was hoping a twim expert would reply and say "all you have to do is...."

    Or someone who has already done this would reply with some knowledge.

    Thanks

    Mark

Reply
  •     #include <drivers/i2c.h>

        #define MAX_PAGE_SIZE 8192
        #define CHECKBYTES_SIZE 16
        extern const struct device * i2c;
        uint8_t send[8210];
        int write_flash_page()
        {
            uint8_t sh_addr = 0x55;
            int err = i2c_write( i2c, send, MAX_PAGE_SIZE + CHECKBYTES_SIZE + 2, sh_addr );
            return err;
        }
    This code will send 18 bytes and STOP

    Using 1.6.1 because the revision of the nrf9160 is B0.

    Not sure it's case of old code - because the TWIM peripheral can only send 8192 bytes in one transaction. More like how do I get the nrfx_twim.c module to send more than the maximum(8192) before sending STOP

    Just a gap in my knowledge - was hoping a twim expert would reply and say "all you have to do is...."

    Or someone who has already done this would reply with some knowledge.

    Thanks

    Mark

Children
Related