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

Crashing on STM32 at list.c

Posted by Samuel Schweighart on October 12, 2011
I know this appears to be a common problem, but we've tripple checked and don't seem to be doing anything that is listed in the FAQ's regarding this problem.

We get our code up and running, and then anywhere from a few seconds to a few minutes, the program hangs on

for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )


We've monitored our stacks and they have plenty of room. The high watermark doesn't vary over time and we don't get close to the end, so we are pretty sure that is not it.

We've set our priorities appropriately

// configKERNEL_INTERRUPT_PRIORITY sets the interrupt priority used by the kernel itself.
#define configKERNEL_INTERRUPT_PRIORITY 255 /* equivalent to 0xff, or priority 15. */

// configMAX_SYSCALL_INTERRUPT_PRIORITY sets the highest interrupt priority
//from which interrupt safe FreeRTOS API functions can be called.
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 /* equivalent to 0xb0, or priority 11. */


All of our ISRs have a priority level of

#define INT_PRI_SPI1         (12 << 4)
#define INT_PRI_SPI2 (12 << 4)
#define INT_PRI_SPI3 (12 << 4)
#define INT_PRI_EXT_SPI1 (15 << 4)
#define INT_PRI_UART1 (13 << 4)
#define INT_PRI_UART2 (12 << 4)
#define INT_PRI_UART3 (13 << 4)
#define INT_PRI_UART4 (13 << 4)
#define INT_PRI_UART5 (13 << 4)
#define INT_PRI_UART6 (13 << 4)
#define INT_PRI_TIMER_1 (14 << 4)
#define INT_PRI_TIMER_2 (14 << 4)
#define INT_PRI_TIMER_3 (14 << 4)
#define INT_PRI_TIMER_4 (14 << 4)
#define INT_PRI_TIMER_5 (14 << 4)
#define INT_PRI_TIMER_6 (14 << 4)
#define INT_PRI_TIMER_7 (14 << 4)
#define INT_PRI_TIMER_8 (14 << 4)
#define INT_PRI_TIMER_9 (14 << 4)
#define INT_PRI_TIMER_10 (14 << 4)
#define INT_PRI_TIMER_11 (14 << 4)
#define INT_PRI_TIMER_12 (14 << 4)
#define INT_PRI_TIMER_13 (14 << 4)
#define INT_PRI_TIMER_14 (14 << 4)
#define INT_PRI_I2C1 (15 << 4)
#define INT_PRI_I2C2 (15 << 4)
#define INT_PRI_I2C3 (15 << 4)
#define INT_PRI_ADC (15 << 4)



I've checked through all my code and I do not have any API calls that run during a "critical" period. I never suspend the scheduler.

The code hangs on this code..

 xQueueReceive(spi1_que_handle, (void*)&msg_ptr, WAIT_FOREVER);


This code has successfully executed thousands of times before it hangs. I've check to see that spi1_que_handle is not corrupted and does not change.

I don't know where to start....


RE: Crashing on STM32 at list.c

Posted by Samuel Schweighart on October 12, 2011
I also checked my SCB_AIRCR Register, and my Priority group is 011 = 4 bits of priority, no bits of sub.

RE: Crashing on STM32 at list.c

Posted by Richard on October 13, 2011
“I don't know where to start....”


Well it sounds like you have done a lot already, so it is more a question of what to do next, than starting.

I was going to mention the priority groups, but it looks like you have that covered too.

Which function are you using to set the interrupt priorities? You have priorities set using definitions like:

“#define INT_PRI_SPI1 (12 << 4)”


Some Cortex-M3 libraries want interrupt priorities to be passed to them like this. Some want it to be passed in un-shifted (so 12 in this case). This could be a problem.

The Cortex-M3 has one of the most complex interrupt schemes known to the embedded universe!

Regards.

RE: Crashing on STM32 at list.c

Posted by Samuel Schweighart on October 13, 2011
Looks like you were correct! Checked and all the interrupts were zero. Everything was double shifted. Thanks for helping me zero in on the problem.

I'm checking the other interrupts and I wanted to verify that
PendSV should be 15 (Lowest)
SysTick should be 15 (Lowest)
and
SVCall should be 0 (highest)

Thanks!
Sam


[ 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