2021-01-14 04:58 AM
Hello,
When I use DMA with SPI it is not working.
When I get a falling edge on DRDY this function gets called :
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if(GPIO_Pin == DRDY_ADC_Pin)
{
HAL_SPI_Receive_DMA(&hspi1, SPI1_RxBuffer, READBACK_LENGTH);
}
}
SPI1 RX Buffer is located in a DMA accessible memory, RAM D2 (it works I checked the .map) :
uint8_t __attribute__(( section(".ramd2section"))) SPI1_RxBuffer[READBACK_LENGTH]; // SPI Tx
My question is do I need to use a setup function outside of what HAL_SPI_MspInit() already does. For example HAL_MDMA_Start_IT() ?
I've red few posts with the same problem but the solution is never explicated or done not using only HAL function.
What I use :
SPI1 Master full-duplex
DMA1 Stream 2 SPI1_Rx to SPI1_RxBuffer
MDMA Stream 0 SPI1_RxBuffer to ads_buf located in DTCMRAM
2021-01-18 01:35 AM
Yes when I use it without DMA, It sends "dummy" data in order to receive. The Tx buffer ptr is the same as the Rx one so it echoes the message
2021-01-19 12:57 AM
I will write my own driver and switch to half duplex