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

Sending 8192 bytes through twi using nRF52832

I am using MDBT42Q nRF52832 custom board , SDK v15.3 in SEGGER Embedded studio in Ubuntu (20.04 LTS) system. I want to configure BMI270 IMU (Accelerometer)sensor .

 I am using TWI(I2C)interface for communication.

First I am getting Chip id correctly using twi communication. After that for IMU initialization , I need to send (transmit) 8192 bytes BMI270 config file without any stop bit(burst write only). For TWI transmit I am using "nrf_drv_twi_tx"  function which has only 255 bytes data length limit as shown below.

So question is how to transmit more than 255 bytes buffer at time ? Can I change data length in the function and send data using same nrf_drv drivers? If yes then what changes I have to do in library ?

Thanks ,

Drashti Mistry

Parents
  • Hi,

    The nRF52832 has a limitation of 255-byte length (8-bits) in the MAXCNT registers for serial peripherals like TWIM, SPIM, UARTE, SPIS, etc. This limitation was brought into the nrf_drv_twi driver as a uint8_t length argument to transfer functions, when this driver was first introduced, as this supports both TWIM and (legacy) TWI peripherals.

    The TWI peripheral can support longer transfers, but this requires you to update the data pointer for each byte that will be transferred. This will give you lots of interrupts and higher current consumption.

    The simples solution for using the TWI peripheral for longer transfers would be to migrate to the nrfx_twi driver, which supports size_t length parameters (32-bits).

    Best regards,
    Jørgen

Reply
  • Hi,

    The nRF52832 has a limitation of 255-byte length (8-bits) in the MAXCNT registers for serial peripherals like TWIM, SPIM, UARTE, SPIS, etc. This limitation was brought into the nrf_drv_twi driver as a uint8_t length argument to transfer functions, when this driver was first introduced, as this supports both TWIM and (legacy) TWI peripherals.

    The TWI peripheral can support longer transfers, but this requires you to update the data pointer for each byte that will be transferred. This will give you lots of interrupts and higher current consumption.

    The simples solution for using the TWI peripheral for longer transfers would be to migrate to the nrfx_twi driver, which supports size_t length parameters (32-bits).

    Best regards,
    Jørgen

Children
Related