FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [March 2010 Threads] STM32 Primer freeze on xQueueSendToFrontFromIPosted 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 xQueueSendToFrontFromIPosted by https://www.google.com/accounts on March 31, 2010 Actually memcpy produces HardFault!!
RE: STM32 Primer freeze on xQueueSendToFrontFromIPosted 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 xQueueSendToFrontFromIPosted 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 xQueueSendToFrontFromIPosted 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 xQueueSendToFrontFromIPosted by Thomas Kindler on March 31, 2010 .. and if I understand correctly, priority 15 should be fine too?
RE: STM32 Primer freeze on xQueueSendToFrontFromIPosted by Dave on March 31, 2010 Yes.
RE: STM32 Primer freeze on xQueueSendToFrontFromIPosted 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 xQueueSendToFrontFromIPosted 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?
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|