pierreculot wrote on Thursday, July 10, 2014:
Hello,
I’m working on STM32F437 and FreeRTOS 8.0.0.
I have a problem with USART and DMA transmit:
If I pass through InitVariablesForOs(), my DMA for USART transmit complete doens’t work. The first “111” is sent but the counter of the DMA is not decremented and obviously no DMA interrupt transmit complete(needed for RS485 direction)triggers. And in consequence the program wait endless the DMA buffer is empty before sendign the second “222”.
int main void (void)
{
InitVariablesForOs();//init mutex, queue and semaphore
Initlowlevel();//init hardware and NVIC
SendOnUsart1(“111”,3);
SendOnUsart1(“222”,3);
SendOnUsart1(“333”,3);
Initsometask here…
vTaskStartScheduler();
}
If I comment the first line DMA works well (obviously assert from Feertos will block later because the variable are NULL)
I think interrupt are correct:
void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
/* Configure the NVIC Preemption Priority Bits */
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 15;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
/* Enable the Ethernet global Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = ETH_IRQn;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = SDIO_IRQn;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = DMA2_Stream3_IRQn;
NVIC_Init(&NVIC_InitStructure);
/* Enable the USARTx Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = DMA2_Stream7_IRQn;
NVIC_Init(&NVIC_InitStructure);
}
To be honnest I don’t see the link between os variable initialization and DMA. I ran step-by-step and I didn’t see why the behaviour is modified?
Because I can work without usart DMA, I disabled it.
Pierre