QUERY · ISSUE
machine.RTC.init throws exception on Pyboard 1.0
docsport-stm32
The code example in the docs fails with a surprising traceback.
rtc = machine.RTC()
rtc.init((2014, 5, 1, 4, 13, 0, 0, 0))
Outcome:
MicroPython v1.12-61-g0f16eeab2 on 2020-01-16; PYBv1.0 with STM32F405RG
Type "help()" for more information.
>>>
>>> from machine import RTC
>>> rtc = RTC()
>>> rtc.init((2014, 5, 1, 4, 13, 0, 0, 0))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: function takes 1 positional arguments but 2 were given
CANDIDATE · PULL REQUEST
stm32: Fix issues for STM32G0.
port-stm32
Summary
This PR is patch set for STM32G0.
-
Refactor clock settings for STM32G0.
Clock definition should be in mpconfigboard.h and use them at clock initialization. -
Fix pyb.ADC issue when reading internal sensors.
import pyb a=pyb.ADCAll(12,0x70033) a.read_core_temp()-> Got invalid value:
-93.78223 -
Fix machine.ADC issue when machine.ADC is called.
import machine a=machine.ADC(1)->
machine.ADCdoes not return and board needs hardware reset. -
Fix
Timer(4)returns error.import pyb t=pyb.Timer(4)-> Got following exception even STM32G0 has TIM4.
Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Timer(4) doesn't exist -
Fix pyb.RTC and machine.RTC does not work.
-
RTC did not initialized.
import pyb rtc=pyb.RTC() rtc.datetime()-> Got invalid datetime (2000, 0, 0, 0, 0, 0, 0, 0).
-
The board need hardware reset when RTC.wakeup is woke up.
import pyb rtc=pyb.RTC() rtc.wakeup(0)
-
Testing
Tested:
- NUCLEO_G0B1RE
Trade-offs and Alternatives
This PR contains #18111.