Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

need advice interrupt

Posted by pierreculot on 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): NVICPriorityGroupConfig( NVICPriorityGroup_4 );

NVICInitStructure.NVICIRQChannelPreemptionPriority = 15; NVICInitStructure.NVICIRQChannelSubPriority = 0; NVICInitStructure.NVICIRQChannelCmd = ENABLE;

// Enable the Ethernet global Interrupt * *NVICInitStructure.NVICIRQChannel = ETH_IRQn; NVICInit(&NVICInitStructure);

NVICInitStructure.NVICIRQChannel = EXTI1510IRQn; NVICInit(&NVICInitStructure);

NVICInitStructure.NVICIRQChannel = SDIO_IRQn; NVICInit(&NVICInitStructure);

NVICInitStructure.NVICIRQChannel = SDSDIODMA_IRQn; NVICInitStructure.NVICIRQChannelPreemptionPriority = 1; NVICInit(&NVICInitStructure);

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


need advice interrupt

Posted by richardbarry on October 21, 2013

The code is designed to nest, so that should not be a problem, provided your configuration is correct.

It appears your NVIC interrupt priority is set to be the lowest value, so that should be fine. Assuming the interrupts that are enabled before the scheduler starts are not trying to use the scheduler it might be that your problem lies elsewhere.

Regards.


need advice interrupt

Posted by pierreculot on October 22, 2013

Thanks Richard. I'm hard to see why if I put 15 for SDSDIODMAIRQn Priority I no longer interrupt SDIO / SDIODMA.

I put 15: -If I made ​​no calls to the configuration of queues etc and I don't create task the interrupt occurs (in fact only vTaskStartScheduler is called but it has nothing to do).

-If I do as above, but I enabled FATFS with FSREENTRANT, it will create a mutex to access disk and I will not have to interrupt either.

I hope this is clear. I must say that I do not see the connection between FreeRTOS and which interrupts are disabled.

But important remark: In the last point One call to mutex by xSemaphoreTake is done before the scheduler runs (and it returns pdTRUE). I don't know if it is a problem?

Pierre


need advice interrupt

Posted by pierreculot on October 22, 2013

I changed the startup code: int main(void) { xTaskCreate(Maintask, (const signed portCHAR *)"MAIN", configMINIMALSTACK_SIZE*4, NULL, 1, NULL); vTaskStartScheduler(); }

Maintask is my previous main without vTaskStartScheduler();, and Maintask deletes itself the task. Now all access to os stuff are done with the scheduler running.

It seems working with the SD priority to 15. I'll let it run...

KR, Pierre


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists