Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

STM32 Primer freeze on xQueueSendToFrontFromI

Posted by https://www.google.com/accounts on March 31, 2010
Is there anything special has to be done to call xQueueSendToFrontFromISR from interrupt handler on STM32?

I have ISR on USB_LP_CAN1_RX0_IRQHandler(USB Low Priority) that calls USB_Istr in the std framework and then to my EP1_OUT_Callback gets called.

When I call xQueueSendToFrontFromISR from there it freezes on prvCopyDataToQueue->memcpy.
The same call from the vApplicationTickHook works well.

Thanks

RE: STM32 Primer freeze on xQueueSendToFrontFromI

Posted by https://www.google.com/accounts on March 31, 2010
Actually memcpy produces HardFault!!

RE: STM32 Primer freeze on xQueueSendToFrontFromI

Posted by Dave on March 31, 2010
The normal reason for crashes in Cortex M3 interrupts is an invalid interrupt priority. The priority must be equal to or below configMAX_SYSCALL_INTERRUPT_PRIORITY, which on the Cortex M3 means the priority value must be lower than configMAX_SYSCALL_INTERRUPT_PRIORITY (a priority of 255 being lower than a priority of 0). You must set the interrupt priority otherwise it will default to zero and most probably crash. Also, make sure you set it correctly as different functions use different methods, some need the priority shifted up to the most significant bits and other don't.

If it is memcpy that is crashing, can you stop on the debugger and see the addresses it is copying to and from?

RE: STM32 Primer freeze on xQueueSendToFrontFromI

Posted by https://www.google.com/accounts on March 31, 2010

interrupts priority is above 0:

NVIC_InitStructure.NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);

NVIC_InitStructure.NVIC_IRQChannel = USB_HP_CAN1_TX_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);

message I'm trying to send is static:
static const xLCDMessage endpointMsg=
{
mainWRITE_STRING_MESSAGE, "USB"
};

task initialized as tskIDLE_PRIORITY+3:

pxQueue structure seems fine

Any suggestions?

thanks.


RE: STM32 Primer freeze on xQueueSendToFrontFromI

Posted by Dave on March 31, 2010
As suggested, I think this is where your bug lies. The interrupt priority is below 0, because it is numerically higher.

What is configMAX_SYSCALL_INTERRUPT_PRIORITY set to in FreeRTOSConfig.h. By default it will be 11, so your interrupt priorities need to be 11, 12, 13, or 14. Anything else will cause intermittent problems.

RE: STM32 Primer freeze on xQueueSendToFrontFromI

Posted by Thomas Kindler on March 31, 2010
.. and if I understand correctly, priority 15 should be fine too?

RE: STM32 Primer freeze on xQueueSendToFrontFromI

Posted by Dave on March 31, 2010
Yes.

RE: STM32 Primer freeze on xQueueSendToFrontFromI

Posted by https://www.google.com/accounts on March 31, 2010
so far I did the following

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 15;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

No Help
Still get HardFault during prvCopyDataToQueue (memcpy but if I comment out memcpy it will happen on next instruction)

RE: STM32 Primer freeze on xQueueSendToFrontFromI

Posted by https://www.google.com/accounts on April 1, 2010
No matter what I do I have HardFault when I try to call xQueueSendToFrontFromISR from ISR.

Can somebody point me to working example where it actually works?


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


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner