pierreculot wrote on Sunday, October 20, 2013:
Hello,
I work with STM32F4 lwip1.4.0 and FreeRTOS 7.5.2.
I currently have a crash or assert the LwIP after some time because the MEMP is corrupt.
I found a way to avoid this is xHigherPriorityTaskWoken to NULL in the Ethernet interrupt:
void ETH_IRQHandler(void)
{
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
/* Frame received */
if ( ETH_GetDMAFlagStatus(ETH_DMA_FLAG_R) == SET)
{
/* Give the semaphore to wakeup LwIP task */
xSemaphoreGiveFromISR( s_xSemaphore, NULL );
}
/* Clear the interrupt flags. */
/* Clear the Eth DMA Rx IT pending bits */
ETH_DMAClearITPendingBit(ETH_DMA_IT_R);
ETH_DMAClearITPendingBit(ETH_DMA_IT_NIS);
/* Switch tasks if necessary. */
if( xHigherPriorityTaskWoken != pdFALSE )
{
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
}
}
Well I guess I have a problem when config interrupt. Here is my config (assert is enabled):
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 = SD_SDIO_DMA_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_Init(&NVIC_InitStructure);
I set priorities for SD_DMA except it does not work if I put 15. I will check the reason.
Did I make a mistake?
Note: At this time SD is only used at startup before scheduler runs. When scheduler is started only tick and Ethernet interrupt are running. It means there is a nested interrupt between tick and Ethernet?
Pierre