SPI DMA is stopped by the EXTI
Hi everybody,
I'm currently experimenting with an STM32F446. I want to create an HMI.
For this, I have a screen (320x240) and a radio module on a board
The screen is controlled via SPI DMA to download images quickly.
The radio module uses two EXTIs to detect the reception of a radio message.
When the program starts, and even afterward, I draw images on the screen. But when a message arrives, the EXTI is triggered. If the DMA was transferring data, it crashes.
In debug mode, I notice that the program enters an infinite loop without exiting.
Do you know why the DMA doesn't finish its task when an EXTI arrives, and especially how I can fix this?
I considered turning off the EXTIs during a DMA transfer, but I can't do it.
Here is the code that handles the DMA when I draw an image:
//**********************************************************************************************
static void ili9341_Write_Data_DMA(const void *data, uint16_t length)
{
txComplete = false;
HAL_SPI_Transmit_DMA(&hspi1, (uint8_t *)data, length);
}
//**********************************************************************************************
static void ili9341_WaitForDMAWriteComplete(void)
{
while (txComplete == false)
{
}
}
//**********************************************************************************************
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)
{
txComplete = true;
}My program gets stuck in the "while (txComplete == false)" loop.
And here me callback EXTI :
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if(GPIO_Pin == DIO1_Pin)
{
uint16_t IRQ_active=0;
llcc68_get_irq_status(context, &IRQ_active);
if ( ( (IRQ_active & LLCC68_IRQ_RX_DONE) != 0) && ((IRQ_active & LLCC68_IRQ_HEADER_VALID) != 0) ) // test de l'IRQ
{
check_msg();
}
else { printf(" Error IRQ Rx\r\n"); }
/***********************************/
llcc68_mode_rx();
/**********************************/
}
else if(GPIO_Pin == DIO3_Pin)
{
F_IRQ_DIO3 = 1; // TX_DONE
}
}
Thank you very much
