nrf_twi_mngr_transfer_t and const write data

I am trying to populate a nrf_twi_mngr_transfer_t at runtime depending on chunks of an input file that I'm pushing to i2c. 

nrf_twi_mngr_transfer_t const write_cfg_transfers[] = {
   NRF_TWI_MNGR_WRITE(bytes[0] >> 1, &data, i-1, 0),
};
Then I get a build error - 

error: initializer element is not constant

How is this done? 

I've tried using the twi instance from the twi_mngr struct, I can see it on the wire, but I get a hardfault on invoking the callback (likley undefined at this point)

ret_code_t err_code = nrf_drv_twi_tx(&(m_nrf_twi_mngr.twi), bytes[0] >> 1, data, i-1, false);
Parents
    • For TWIM (TWI Master with EasyDMA): Buffers must be located in RAM. The TWI transaction manager needs to reserve sufficient space in RAM to copy the buffer contents before initiating transfers if buffers in flash are to be used with the TWIM peripheral.
    • For TWI (legacy TWI without EasyDMA): The buffers can be const (located in flash).
    • The NRF_TWI_MNGR_BUFFERS_IN_RAM definition helps the compiler and linker determine the correct location for the buffers based on the presence of the TWIM peripheral. 

    wow. the second bullet should say 'the buffers MUST be const' 

    Does TWIM work with twi_manager ? Its using nrf_drv_twi.h

Reply
    • For TWIM (TWI Master with EasyDMA): Buffers must be located in RAM. The TWI transaction manager needs to reserve sufficient space in RAM to copy the buffer contents before initiating transfers if buffers in flash are to be used with the TWIM peripheral.
    • For TWI (legacy TWI without EasyDMA): The buffers can be const (located in flash).
    • The NRF_TWI_MNGR_BUFFERS_IN_RAM definition helps the compiler and linker determine the correct location for the buffers based on the presence of the TWIM peripheral. 

    wow. the second bullet should say 'the buffers MUST be const' 

    Does TWIM work with twi_manager ? Its using nrf_drv_twi.h

Children
No Data
Related