Hi,
I have this generic register read function to handle communicating with my sensor, and during initialisation, it works fine. However, when I try and request a transfer from within a FreeRTOS task (triggered by a semaphore linked interrupt) it causes a hard fault error. I've seen this post https://devzone.nordicsemi.com/f/nordic-q-a/17031/avoiding-hardfault-and-optimizing-code-size-with-twi-transaction-manager saying that my transfer should be static but setting this causes an initialiser not constant errors and surely it's wasteful to have a different function to do every possible function.
Do you know how to stop the manager from causing a hard fault error?
void ppgReadReg(uint8_t *p_buffer,
uint8_t *p_reg,
uint8_t length) {
nrf_twi_mngr_transfer_t const transfers[] =
{
NRF_TWI_MNGR_WRITE(MAX_ADDR, p_reg, 1, NRF_TWI_MNGR_NO_STOP),
NRF_TWI_MNGR_READ(MAX_ADDR, p_buffer, length, 0)};
APP_ERROR_CHECK(nrf_twi_mngr_perform(&I2C_mngr, NULL, transfers, 2, NULL));
};
Thanks in advance