Tests on ST evkits F091RC and L432KC

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
fpie
Posts: 6
Joined: Tue Jan 22, 2019 7:48 am
Contact:

Tests on ST evkits F091RC and L432KC

Post by fpie » Sat Jan 26, 2019 10:29 am

Hi,

A bit newbee with micropython. I was seeking for a small ST micropython compatible MCU to write a piece of software in a simple way (i was a fan of the excellent Chibios but ...). I download a fresh repo and libraries, and compile and test today with genuine STM 32 evboards timer callback and RTC, with exactly the same behaviour (i paste the second set of test).

>>> from pyb import LED
>>> led=LED(1)
>>> led.toggle()
>>> from pyb import Timer
>>> tim = Timer(1, freq=1000)
>>> tim.freq(0.5)
>>> tim.callback( lambda t: pyb.LED(1).toggle())
>>> uncaught exception in Timer(1) interrupt handler
NameError:

>>>
PYB: soft reboot
MicroPython v1.10 on 2019-01-26; NUCLEO-L432KC with STM32L432KC
Type "help()" for more information.
>>> from pyb import RTC
>>> rtc = RTC()
>>> rtc.datetime((2019, 1, 26, 6, 11, 5, 0, 0))
>>> rtc.datetime()
(2000, 1, 1, 1, 0, 0, 0, 0)
>>>

Same test on PYBV11 405RG compilation is of course fine and successfully did theses tests.
What's the trick ?

fpie
Posts: 6
Joined: Tue Jan 22, 2019 7:48 am
Contact:

Re: Tests on ST evkits F091RC and L432KC

Post by fpie » Sat Jan 26, 2019 2:58 pm

After searching a bit, i found that i've got an old compiler :
arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:4.9.3+svn231177-1) 4.9.3 20150529 (prerelease)

So i upgrade it to :
arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]

But unlikely the issue persist :
>>> from pyb import RTC
>>> rtc=RTC()
>>> rtc.datetime((2019, 1, 26, 6, 15, 44, 0, 0))
>>> rtc.datetime()
(2000, 1, 1, 1, 0, 0, 0, 0)
>>>
PYB: soft reboot
MicroPython v1.10 on 2019-01-26; NUCLEO-L432KC with STM32L432KC
Type "help()" for more information.
>>> from pyb import LED
>>> led=LED(1)
>>> led.toggle()
>>> from pyb import Timer
>>> tim = Timer(1, freq=1000)
>>> tim.freq(0.5)
>>> tim.callback( lambda t: pub.LED(1).toggle())
>>> uncaught exception in Timer(1) interrupt handler
NameError:

Is anybody have being is the same situation ?

shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Re: Tests on ST evkits F091RC and L432KC

Post by shaoziyang » Sun Jan 27, 2019 6:28 am

You have not import pyb, you may try as below:

Code: Select all

import pyb
from pyb import Timer
tim = Timer(1, freq=1000)
tim.freq(0.5)
tim.callback( lambda t: pyb.LED(1).toggle())

fpie
Posts: 6
Joined: Tue Jan 22, 2019 7:48 am
Contact:

Re: Tests on ST evkits F091RC and L432KC

Post by fpie » Sun Jan 27, 2019 7:39 am

Your're right. I feel a bit silly. Timer callback issue closed. Thanks.
For the RTC, is my syntax OK ? Does anybody can reproduce or not.
Thanks in advance.

fpie
Posts: 6
Joined: Tue Jan 22, 2019 7:48 am
Contact:

Re: Tests on ST evkits F091RC and L432KC

Post by fpie » Sun Jan 27, 2019 10:25 am

Solved. I missed an rtc.init(), useless on PYBV11 but mandatory for these platforms.
Thanks again shaoziyang.

Post Reply