SPI Master using HAL_SPI_TransmitReceive_DMA
Hi everyone,
I am a new user of ST microcontroller. I am not familiar with DMA.
Currently I am working on to pull the data from the AFE as slave using DMA method using CUBE generate code:
HAL_StatusTypeDef HAL_SPI_TransmitReceive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData,uint16_t Size).
I am able to get the correct value.
My problem is when I tried to read the data continuously, I will get the error code. Is there anything that I need to care first before pulling another data?
example:
state = SingleRegCommVerify(AFE_ConfigStart, &afe_read_buf[0], AFE_READ);//this will call HAL_SPI routine
if(state == COMM_DONE) //comm error
{
stat1 = afe_read_buf[0];
}//it will skip this
state = SingleRegCommVerify(AFE_CalStart, &afe_read_buf[0], AFE_READ);
if(state == COMM_DONE)
{
stat2 = afe_read_buf[0]; //correct value
}
Thanks for the help.
-illa-
