STM32F030F4 minimal example is not working Topic is solved

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

ceremcem
Posts: 67
Joined: Mon Aug 10, 2015 6:57 am
Has thanked: 7 times
Been thanked: 6 times

STM32F030F4 minimal example is not working

Postby ceremcem » Tue Feb 26, 2019 6:58 pm

Hi,

I'm trying to use my STM32F030F4 board with ChibiOS 18 Stable. The simple app can be compiled, but is not running when flashed to the board.

Here is the code: https://github.com/ceremcem/chibios-stm ... /b8a72f7cf

Board is simplest possible breakout board (built by me and known to work) without an external XTAL. I can load the code to the board and instead of hitting the breakpoint in "main()", GDB displays the following message:

Code: Select all

Temporary breakpoint 1 at 0x8000990: file /home/ceremcem/ChibiOS/os/hal/ports/STM32/STM32F0xx/hal_lld.c, line 233.
Note: automatically using hardware breakpoints for read-only addresses.


Hitting Ctrl+C gives the following output:

Code: Select all

^C
Program received signal SIGTRAP, Trace/breakpoint trap.                       
0xfffffffe in ?? ()
(gdb) l
219     /* Driver exported functions.                                         
     */
220     /*===========================================================================*/
221
222     /**
223      * @brief   Low level HAL driver initialization.                       
224      *
225      * @notapi
226      */
227     void hal_lld_init(void) {
228
(gdb) l
229       /* Reset of all peripherals.
230          Note, GPIOs are not reset because initialized before this point in
231          board files.*/
232       rccResetAHB(~STM32_GPIO_EN_MASK);                                   
233       rccResetAPB1(0xFFFFFFFF);
234       rccResetAPB2(~RCC_APB2RSTR_DBGMCURST);                               
235
236       /* PWR clock enabled.*/
237       rccEnablePWRInterface(true);
238


Dependencies as listed here:

Code: Select all

ChibiOS/stable_18.2.x 903263a2c7467204f84df164efe0a1ca0028bbde
GCC 8.2.0


What could be the problem?

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32F030F4 minimal example is not working

Postby Giovanni » Tue Feb 26, 2019 7:30 pm

Hi,

You should check clock and GPIO settings, are those in the demo compatible with your own board? it is possible you need to create your own board files.

Check board.h and clock settings in mcuconf.h.

Giovanni

ceremcem
Posts: 67
Joined: Mon Aug 10, 2015 6:57 am
Has thanked: 7 times
Been thanked: 6 times

Re: STM32F030F4 minimal example is not working

Postby ceremcem » Tue Feb 26, 2019 8:58 pm

I've set all pins to their default (reset) states: https://github.com/ceremcem/chibios-stm ... h#L82-L144

External clocks are already disabled and internal clocks are already enabled. (I'm not sure what else to check for clock settings).

One interesting thing is that I've used #define STM32F030x6 because following lines are written in os/common/ext/ST/STM32F0xx/stm32f0xx.h:

Code: Select all

/* #define STM32F030x6 */  /*!< STM32F030x4, STM32F030x6 Devices (STM32F030xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes)              */


...and there is no STM32F030x4 related inclusion here. However, STM32F030x4 is taken into consideration here.

If I use STM32F030x4 in board.h, following compile error is thrown:

Code: Select all

/home/ceremcem/ChibiOS/os/common/ext/ST/STM32F0xx/stm32f0xx.h:165:3: error: #er$
or "Please select first the target STM32F0xx device used in your application (i$
 stm32f0xx.h file)"                                                             
  #error "Please select first the target STM32F0xx device used in your applicat$
on (in stm32f0xx.h file)"                                                       
   ^~~~~                         


I'm confused what to use in board.h.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: STM32F030F4 minimal example is not working

Postby Giovanni » Tue Feb 26, 2019 9:05 pm

Apparently there Is a mismatch try defining both x4 and x6.

Giovanni

ceremcem
Posts: 67
Joined: Mon Aug 10, 2015 6:57 am
Has thanked: 7 times
Been thanked: 6 times

Re: STM32F030F4 minimal example is not working

Postby ceremcem » Tue Feb 26, 2019 9:19 pm

Giovanni wrote:Apparently there Is a mismatch try defining both x4 and x6.


I've set both. However, GDB hits the same point:

Code: Select all

Temporary breakpoint 8 at 0x8000900: file /home/ceremcem/ChibiOS/os/hal/ports/STM32/STM32F0xx/hal_lld.c, line 233.

ceremcem
Posts: 67
Joined: Mon Aug 10, 2015 6:57 am
Has thanked: 7 times
Been thanked: 6 times

Re: STM32F030F4 minimal example is not working  Topic is solved

Postby ceremcem » Fri Mar 01, 2019 1:35 pm

Solved by this commit. The "MCU=cortex-m3" setting was mistakenly forgotten while switching to F0 mcu.


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 11 guests