AnsweredAssumed Answered

stm32f334 and probably a stack overflow.. ?

Question asked by Manu Abraham on Apr 8, 2017
Latest reply on Apr 12, 2017 by Manu Abraham

Hi,

 

Have been doing quite a bit of drawing onto a LCD display with SPI and DMA. In the process of updating the display, i found the results were unexpected, but the code doesnt seem to be the culprit, since when I test individual parts of the code things do appear working as expected. Eventually, printing it out, my favourite debug model, putstr(), putting a string to the UART Tx register also appear to have frozen (attached screenshot), in all probability.

 

The program still fits into the flash .. :-) The controller is a STM32F334R8T6 (LQFP64)

 

*** Using Compiler 'V5.06 update 4 (build 422)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Rebuild target 'Target 1'
assembling startup_stm32f334x8.s...
compiling stm32f30x_gpio.c...
compiling stm32f30x_adc.c...
compiling stm32f30x_rcc.c...
compiling stm32f30x_i2c.c...
compiling stm32f30x_usart.c...
compiling stm32f30x_misc.c...
compiling stm32f30x_spi.c...
compiling stm32f30x_dma.c...
compiling stm32f30x_hrtim.c...
compiling stm32f30x_tim.c...
compiling stm32f30x_syscfg.c...
compiling stm32f30x_rtc.c...
compiling pwm.c...
compiling uart.c...
compiling adc.c...
compiling misc.c...
compiling dma.c...
compiling lcd_ili9341.c...
compiling spi.c...
compiling rbuf.c...
compiling plot.c...
compiling mav.c...
compiling font.c...
compiling clock_ana.c...
compiling main.c...
compiling clock_dig.c...
compiling rtc.c...
compiling graphics.c...
compiling thermo.c...
compiling rc5.c...
compiling timer.c...
compiling menu.c...
compiling seg7.c...
linking...
Program Size: Code=23722 RO-data=11158 RW-data=372 ZI-data=5508  
FromELF: creating hex file...
".\Objects\Test 2.axf" - 0 Error(s), 0 Warning(s).
Build Time Elapsed:  00:00:24

 

Originally, I've had the

Stack_Size      EQU     0x00000400

 

thinking that the stack size (1024 bytes) could be a problem,  increased it to (4096 bytes)

(attached startup code), but the change did not make any difference.

 

One question that I have, the RO-data, is it in RAM or Flash ? If it is RAM, the 12kb of SRAM is almost done .. :-(

But I guess the RO-data is in ROM.

 

(The STM32F334 seems like a one of a kind microcontroller. Even the STM32H7 microcontroller which is previewing, seems to have a scaled down variant of the HRTIM peripheral. Sad that there aren't any other controllers from ST, having HR-PWM and larger memory/clock speeds. :-( Maybe someone @ ST takes note of this issue and closes the gap hopefully. If you are asking for my wish, more PWM pins and ADC pins, DMA channels, definitely are nice goodies. The Infineon XMC chips seems nice with regards to memory and peripherals especially the HRPWM and the PID controller on it, but that would mean switching everything. The TI UCD3138xx seems to have everything, but that one doesnt seem to be pleasant to work with any way)

 

Getting back from my little rant, I am wondering how to dissect this problem. Can someone give me some insight how to navigate this issue ?

 

Thanks

Attachments

Outcomes