STM32L0 - Cortex M0+ Support

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

Moderator: RoccoMarco

User avatar
cruz_91
Posts: 16
Joined: Tue Dec 25, 2012 10:00 pm

Re: STM32L0 - Cortex M0+ Support

Post by cruz_91 »

Few days ago I purchased nucleo with STM32L053. This mcu is other than well knowns mcus like L1 or F0 (eg. GPIO bus compared to L152). I also saw that chibios not support this mcu and I need to run chibios on this board (yap, I want to test my MSc project on cortex M0+). Today I spend few hours to start it. For now mcu with gpio subsystem is initialized. System functions like chTdhSleep doesn't work.

Next plan?
-> Prepare fully works chibios
-> Prepare fully works uart (for communication ofc)

Source code is available in my repository:
https://github.com/cruz91/ChibiOS/tree/ ... 53-support

//Edit
Few minor changes in timers isrs provide to work chibios functions. Now code from testhal (UART) can blink led.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32L0 - Cortex M0+ Support

Post by Giovanni »

Hi,

Good to know you are going ahead, official support for L0 (and L4, f7) will happen after the final 3.0 release.

Giovanni
User avatar
cruz_91
Posts: 16
Joined: Tue Dec 25, 2012 10:00 pm

Re: STM32L0 - Cortex M0+ Support

Post by cruz_91 »

Hi,

The most important thing to do now is to run UART to communicate with µC. DMA with UART seems to work good, but doesn't send characters.
The second problem is how to implement and manage low power peripherials. Currently I only see it on schemes and I must to read more in reference manual. It looks like other domain of PLL and can (but musn't) be hard to implement. We will see.
I'll prepare some code to work with nucleo L053, maybe it can be used in chibios 3.0 :)
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32L0 - Cortex M0+ Support

Post by Giovanni »

DMA is different on L0, this will require an updated driver because there is a peripheral selector register added. This is the reason for moving it after 3.0.

Giovanni
User avatar
cruz_91
Posts: 16
Joined: Tue Dec 25, 2012 10:00 pm

Re: STM32L0 - Cortex M0+ Support

Post by cruz_91 »

Hi,
Do you think about DMA_CSELR register?
F09x also has this register.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32L0 - Cortex M0+ Support

Post by Giovanni »

Yes, that one. F09x is not yet supported too.

Giovanni
User avatar
cruz_91
Posts: 16
Joined: Tue Dec 25, 2012 10:00 pm

Re: STM32L0 - Cortex M0+ Support

Post by cruz_91 »

Ok, but it is possible to run example apps without big changes in DMA support. Only for tests and initially support new platform
User avatar
cruz_91
Posts: 16
Joined: Tue Dec 25, 2012 10:00 pm

Re: STM32L0 - Cortex M0+ Support

Post by cruz_91 »

Hi,
Giovanni, thanks for tip about CSELR register. I modified dma driver for L0 and add simple workaroud. I choose some the most important peripherials (in my opinion) and connect them to free channels. Currently Chibios UART testhal works perfectly with nucleo board :) Just connect, program and open nucleo serial port.

STM32L0 is very castrated device... only two priority bits (0,1,2,3), strange DMA...
But I've got idea for now to move connection between channel and peripherial in CSELR register to mcuconf. I can prepare some defines to check settings. But it is idea for now...

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

Re: STM32L0 - Cortex M0+ Support

Post by Giovanni »

Update, I have most of the code done but I am unable to use OpenOCD, it connects but then it reads the flash as all zeroes. Flashing does not work too.

Using the ST-Link utility works but I can't debug so I am stuck.

I will try using keil/iar...

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

Re: STM32L0 - Cortex M0+ Support

Post by Giovanni »

Apparently is the latest OOCD 0.9.0 that has problems, I returned to the old 0.9.0dev version and it works (the one included in ChibiStudio).

The STM32L0xx now works, I just tested ST, PAL and Serial drivers, other drivers will require more work because it has a new DMA infrastructure (way more flexible).

Giovanni
Post Reply