Question
How to use I2C with DMA - Touch Sensor
Hi,
I have had partial success implementing DMA with I2C as below but the only way I can receive the data "val" is by adding a HAL_Delay of 1uS and the "val" is shown as an incorrect value. Is there anyway to both do the DMA send and receive without the HAL_Delay to give the correct value?
uint8_t CS816T_GetRegByte(uint8_t regAddr) {
uint8_t val;
if(HAL_I2C_GetState(CS816T_ui2c) == HAL_I2C_STATE_READY)
HAL_I2C_Master_Transmit_DMA(CS816T_ui2c,CS816T_I2C_ADDR << 1, ®Addr, 1);
HAL_Delay(1);
HAL_I2C_Master_Receive_DMA(CS816T_ui2c,CS816T_I2C_ADDR << 1, &val, 1);
return val;
}
without the HAL_Delay(1) I just get a blank value returned?
