STM32F050F4 Problem

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

Moderator: RoccoMarco

mcgr3g0r
Posts: 3
Joined: Mon Dec 16, 2013 5:20 pm

STM32F050F4 Problem

Post by mcgr3g0r »

Hello,

I am new chibios user. Recently I have started development on STM32F050F4R6 controller, however I was unable to run demos for STM32F051 DISCOVERY provided in the demos folder.

My platform is simply STM32F050F4R6 cpu, usart1 (GPIOA - PIN9,PIN10, LED on GPIOB - PIN1) and SPI1 connected to RFM73 module running on 8MHz HSE.

What I have done was a simple port from STM32F0XX to the STM32F050F4R6 cpu by modyfing LD scripts (changing RAM to 4KB ,ROM to 16KB, limiting the stacks to 0x100),
then I have defined simple board with no special initialisation (just the USART1, SPI1 and PA14 as LED)

I have tried to run demo with USART1 communication and simple LED blink as provided in the demos and haltest folders and it seems not working - like the code newer reaches the main() function. Unfortunately I have no hardware way to debug this situation.

Any ideas how to solve the problem ?
Is there something more I need to do to get the STM32F050F4 cpu working beside changing the STM32F0XX based linking LD script ?

Best regards,
McGr3g0r
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32F050F4 Problem

Post by Giovanni »

Hi,

It should work, hard to tell the problem with so little info. You should really try to get a debugger.

Also, what toolchain are you using? a lot of problems are originated by tools.

Giovanni
mcgr3g0r
Posts: 3
Joined: Mon Dec 16, 2013 5:20 pm

Re: STM32F050F4 Problem

Post by mcgr3g0r »

Hi Giovanni,
many thanks for your response.

The LED diode was my debug :) - I've managed to find the exact point in code where the problem was.

I'm working on HEAD from the git. The _pal_lld_init routine in os/hal/platforms/GPIOSv2/pal_lld.c initializes all GPIOx peripherals no mather if the given CPU actually has it, so it probably causes major exception.

I suppose there shall be #ifdef STM32_HAS_GPIOX wrap for each initgpio(GPIOX,&config-<PXData); and there shall be definiton in board.h or maybe the cpu header if given GPIOx exists in the cpu. There is aslo an assumption in the os/hal/platforms/STM32F0xx/stm32_registry.h for STM32_HAS_GPIOA to STM32_HAS_GPIOE, perhaps it should be fixed too.

Best regards,
McGr3g0r
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32F050F4 Problem

Post by Giovanni »

Hi,

Are you sure that is the cause? this never caused problems with other STM32s. If you confirm it I will do a change there. Please find the port causing the exception using the LED :) (and find an STLink, even a discovery boards would give you one for free).

Giovanni
mcgr3g0r
Posts: 3
Joined: Mon Dec 16, 2013 5:20 pm

Re: STM32F050F4 Problem

Post by mcgr3g0r »

Hi Giovanni,

as for the LED I meant i using the blink for debuging purpose (to see which line of code I reached) - it's an hardcore way of debuging but it worked for me.

I can confirm that calling initgpio(GPIOC, &config-<PCData); in _pal_lld_init routine (file: os/hal/platforms/GPIOSv2/pal_lld.c) causes the Hard Fault on my platform as there is no phisical port C .

I had another problems with UART dma and isr callbacks but eventualy it turned out that the reason was the optimisation set for small code: -Os and setting it back to level 2 resolved the issues - that should be pretty obvious but I guess I was all focused on getting the chibios running on my platform.

Thanks for your support.

BTW. Having the stm32f0x50F4 based platform could be useful for chibios features testing on this tiny device so If anyone needs me to test something just let me know.

Best regards,
McGr3g0r
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32F050F4 Problem

Post by Giovanni »

Hi,

Thanks, I will look into the required changes.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32F050F4 Problem

Post by Giovanni »

Hi,

I added support for STM32F030/050/060 devices, untested because lack of hardware. Updated to the newest ST headers too.

Giovanni
goeck
Posts: 92
Joined: Mon Feb 11, 2013 12:00 pm

Re: STM32F050F4 Problem

Post by goeck »

Hey everyone,

just switched from STM32F0-Discovery to the own build PCB which holds a STM32F031 (Actually ST labeled it STM32F050 but ST-Link Utility tells me STM32F031 is the name). I was able to compile and flash the code that was written for the Discovery board, but nothing works.
Am I having the same issue and how can I switch the MCUs? I dived into the GPIO code, but was confused with the existing configurations. I have just updated the code from SVN repo, so this should be latest.

Thanks for any help.

Cheers
Stefan
Last edited by goeck on Thu Jan 23, 2014 10:08 am, edited 1 time in total.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32F050F4 Problem

Post by Giovanni »

Hi,

You need to create new board files and specify the correct MCU type, there are 3 possible choices for F0 devices:
- STM32F030 for Value Line devices.
- STM32F0XX_LD for Low Density devices.
- STM32F0XX_MD for Medium Density devices.

Giovanni
goeck
Posts: 92
Joined: Mon Feb 11, 2013 12:00 pm

Re: STM32F050F4 Problem

Post by goeck »

Thanks, Giovanni. Done that.
Actually nothing happens. I have a LED connected against GND on PA6 and want the blinker thread to let it ... blink. I only have 1.7V continously at this pin. I am some kind of angry-blind ...Would somebody be so kind and have a look at my code and schematics? That'll be awesome. I can't see any more hints here...
Also, I have created and use a linker script based on the STM32F051 script and reduced stacks to 100, RAM to 2k and FLASH to 32k.

Thanks for any advice.

Cheers
Stefan
Attachments
STM32F031_code.zip
(9.21 KiB) Downloaded 426 times
stm32f031_schematic.png
stm32f031_schematic.png (20.38 KiB) Viewed 5409 times
Post Reply