Use FreeRTOS on STM32f4

Hi, i try to use FreeRtos on my program which run on Stm32f4 mcu. and i meet a problem when i try to read data from sdio the whole system stuck at function”SDWaitReadOperation” of
while(((SDIO->STA & SDIO
FLAG_RXACT)) && (timeout > 0)) { timeout–;
} this line. i thought is transfer bit is not clear and try trace my program found the DMA interrupt is not running that i cant fix it cause the program is working totally fine when i didnt use rtos… there is how i init interrupts void NVICConfigurationsd(void) { NVICInitTypeDef NVIC_InitStructure; /* Configure the NVIC Preemption Priority Bits */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); NVIC_InitStructure.NVIC_IRQChannel = SDIO_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); NVIC_InitStructure.NVIC_IRQChannel = DMA2_Stream3_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure);
} and there is two interrupts void SDIOIRQHandler(void) { vTaskEnterCritical(); HALNVICClearPendingIRQ(SDIOIRQISR); SDProcessIRQSrc(); vTaskExitCritical(); } void SDSDIODMAIRQHANDLER(void) { vTaskEnterCritical(); HALNVICClearPendingIRQ(SIDODMAIRQnISR); SD_ProcessDMAIRQ(); vTaskExitCritical(); } i found SDIO_IRQ is working but DMA is not how the rtos effect this interrupt anyone got any idea?

Use FreeRTOS on STM32f4

Hi, I don’t know if this will help you but here my init of the sd card with a stm32f4 MCU with freeRTOS DSTATUSsdiodiskinitialize (void) { NVICInitTypeDef NVICInitStructure; SDError res = SDOK;
if(sdio_Init == STA_NOINIT)
{


    /* Configure the NVIC Preemption Priority Bits */
      NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

      NVIC_InitStructure.NVIC_IRQChannel = SDIO_IRQn;
      NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_KERNEL_INTERRUPT_PRIORITY;
      NVIC_InitStructure.NVIC_IRQChannelSubPriority =0;
      NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
      NVIC_Init(&NVIC_InitStructure);

      NVIC_InitStructure.NVIC_IRQChannel = SD_SDIO_DMA_IRQn;
      NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_KERNEL_INTERRUPT_PRIORITY;
      NVIC_Init(&NVIC_InitStructure);

      SD_DeInit();

      res =  SD_Init();
      sdio_Init =0;

    if(res == SD_OK)
      {
        res = (SD_Error)0x0;
      }
}
return ((DSTATUS)res); } Jonathan Le 2014-04-01 06:07, Jimmy SHEN a écrit : >
Hi, i try to use FreeRtos on my program which run on Stm32f4 mcu. and i meet a problem when i try to read data from sdio the whole system stuck at function”SDWaitReadOperation” of while(((SDIO->STA & SDIOFLAG_RXACT)) && (timeout > 0)) { timeout–; } this line. i thought is transfer bit is not clear and try trace my program found the DMA interrupt is not running that i cant fix it cause the program is working totally fine when i didnt use rtos… there is how i init interrupts void NVICConfigurationsd(void) { NVICInitTypeDef NVIC_InitStructure; //Configure the NVIC Preemption Priority Bits // NVICPriorityGroupConfig(NVICPriorityGroup4); NVICInitStructure.NVICIRQChannel = SDIOIRQn; NVICInitStructure.NVICIRQChannelPreemptionPriority = 0; NVICInitStructure.NVICIRQChannelSubPriority = 0; NVICInitStructure.NVICIRQChannelCmd = ENABLE; NVICInit(&NVICInitStructure); NVICPriorityGroupConfig(NVICPriorityGroup4); NVICInitStructure.NVICIRQChannel = DMA2Stream3IRQn; NVICInitStructure.NVICIRQChannelPreemptionPriority = 1; NVICInitStructure.NVICIRQChannelCmd = ENABLE; NVICInit(&NVIC_InitStructure); } and there is two interrupts void SDIOIRQHandler(void) { vTaskEnterCritical(); HALNVICClearPendingIRQ(SDIOIRQISR); SDProcessIRQSrc(); vTaskExitCritical(); } void SDSDIODMAIRQHANDLER(void) { vTaskEnterCritical(); HALNVICClearPendingIRQ(SIDODMAIRQnISR); SD_ProcessDMAIRQ(); vTaskExitCritical(); } i found SDIO_IRQ is working but DMA is not how the rtos effect this interrupt anyone got any idea?
Use FreeRTOS on STM32f4 https://sourceforge.net/p/freertos/discussion/382005/thread/725438de/?limit=25#1831
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/freertos/discussion/382005/ To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/ — This message has been scanned for viruses and dangerous content by MailScanner http://www.mailscanner.info/, and is believed to be clean.

Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com

Use FreeRTOS on STM32f4

thanks a lot but its not working for me. im still stuck at this point and get really no idea about how to solve it, anyone can help?

Use FreeRTOS on STM32f4

Not sure of the issue here, but I don’t believe you are supposed to call any FreeRTOS API from within an ISR unless it ends with FromISR. Also, it just so happens that the processor you are using tends to have enough issues to require special notes about it. http://www.freertos.org/RTOS-Cortex-M3-M4.html Hopefully, your answer is somewhere in there.

Use FreeRTOS on STM32f4

NVICInitStructure.NVICIRQChannelPreemptionPriority = 0;
This is definitely wrong. The preemption priority cannot be above the maximum system call interrupt priority, and the maximum system call priority cannot be 0 (0 being the highest). Likewise for the priority being set for the other interrupt. Todd has already posted the link that describes how to set the interrupt priorities. I would also recommend using an up to date version of FreeRTOS with configASSERT() defined as the latest versions will automatically trigger an assert if you get these setting wrong. See http://www.freertos.org/FAQHelp.html for a link to the assert documentation, as well as a lot of other documentation … like:
vTaskEnterCritical();
You cannot call that function from an interrupt. In fact, the function is not part of the documented API and should not even be called directly from a task, and definitely never called directly on a Cortex-M part. If you want a critical section inside an interrupt you need to use portSETINTERRUPTMASKFROMISR()/portCLEARINTERRUPTMASKFROMISR(). Search for those functions inside FreeRTOS/Source/queue.c to see how they are used. Regards.

Use FreeRTOS on STM32f4

Hi! I am using the processor mentioned in this thread and although having read the pages mentioned here – and several others – and thereby finding the bug I had, I still have some unanswered questions:
  1. One may define the priority of an interrupt at maximum at configMAXSYSCALLINTERRUPT_PRIORITY. Does this also apply to standard tasks? Or may common tasks get any priority? And if they get a priority (logically) higher than an ISR, are they served with a higher priority, or do ISRs always come first and only have an own priority scheme in between several ISRs?
  2. It is said int the FAQ, that one needs to assign an ISR priority less than configMAXSYSCALLINTERRUPTPRIORITY in order to get a stable system (“Therefore, any interrupt service routine that uses an RTOS API function must have its priority manually set to a value that is numerically equal to or greater than the configMAXSYSCALLINTERRUPTPRIORITY setting.”). If I use an ISR, that does not inherit an API function, which priority setting may I use? As said by Real Time Engineers Ltd. in the last post, NVICInitStructure.NVICIRQChannelPreemptionPriority = 0; would be wrong. But in the example given by the thread-starter, I don’t see no FreeRTOS-API call. So my question: May I – as stated – only use configMAXSYSCALLINTERRUPT_PRIORITY for ISRs with API calls, or is this a general guide of bevaiour for ISRs, no matter, if I use FreeRTOS API calls in the ISR or not?
Thanks for any hint in advance, Dennis

Use FreeRTOS on STM32f4

1) TASKS do not have an interrupt priority. The task priority is a completely different thing than an interrupt priority. Interrupts will always interrupt a task (unless the task is in a critical section or disables interrupts), so in one sense, all interrupts are normally of a higher “priority” than tasks. 2) If an interrupt makes no reference to any FreeRTOS API, then it can be of any interrupt priority supported by the hardware. I find there are generally very few of this type of interrupt, as it becomes tricky for the tasks to interact with these. You might have a periodic task checking global variables or the high priority interrupt might trigger a lower priority interrupt that can call the FreeRTOS API.