Configures the I2S PLL to produce a frequency that the I2S clock generator
can use to create an optimal SCK frequency. The I2S PLL configuration
table is automatically generated at build time.
Fixes issue #10280.
Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
All ports using this common configuration already enable time/date
validation, so this commit is a no-op change.
Signed-off-by: Damien George <damien@micropython.org>
Also move MICROPY_PY_PENDSV_ENTER/REENTER/EXIT to mphalport.h, for ports
where these are not already there.
This helps separate the hardware implementation of these macros from the
MicroPython configuration (eg for renesas-ra and stm32, the IRQ static
inline helper functions can now be moved to irq.h).
Signed-off-by: Damien George <damien@micropython.org>
Minor changes for consistency are:
- nrf gains: unique_id(), freq() [they do nothing]
- samd: deepsleep() now resets after calling lightsleep()
- esp32: lightsleep()/deepsleep() no longer take kw arg "sleep", instead
it's positional to match others. also, passing 0 here will now do a 0ms
sleep instead of acting like nothing was passed.
reset_cause() no longer takes any args (before it would just ignore them)
- mimxrt: freq() with an argument and lightsleep() both raise
NotImplementedError
Signed-off-by: Damien George <damien@micropython.org>
And use it in all ports. The ports are unchanged, except esp8266 which now
just returns None from this function instead of the time elapsed (to match
other ports), and qemu-arm which gains this function.
Signed-off-by: Damien George <damien@micropython.org>
This is a code factoring to have the dict for the machine module in one
location, and all the ports use that same dict. The machine.soft_reset()
function implementation is also factored because it's the same for all
ports that did already implement it. Eventually more functions/bindings
can be factored.
All ports remain functionally the same, except:
- cc3200 port: gains soft_reset, mem8, mem16, mem32, Signal; loses POWER_ON
(which was a legacy constant, replaced long ago by PWRON_RESET)
- nrf port: gains Signal
- qemu-arm port: gains soft_reset
- unix port: gains soft_reset
- zephyr port: gains soft_reset, mem8, mem16, mem32
Signed-off-by: Damien George <damien@micropython.org>
Prior to this change, if a board did not define any hardware I2C pins, via
MICROPY_HW_I2Cx_SCL, then machine.I2C would alias to machine.SoftI2C.
That doesn't really make sense, and SoftI2C should always be used if there
is no hardware implementation. So this commit makes it so that machine.I2C
is only available if at least one set of I2C hardware pins are defined via
the MICROPY_HW_I2Cx_SCL/SDA macros.
For all boards that define at least one set of I2C hardware pins (which is
most of them) this commit is a no-op. The only boards that change are:
LEGO_HUB_NO6, LEGO_HUB_NO7, STM32H7B3I_DK.
Signed-off-by: Damien George <damien@micropython.org>
This commit changes the Arduino board identifiers to correspond to their
official names. This helps to identify boards at runtime. At the moment
the Arduino Portenta H7 is reported as PORTENTA which is unfortunate as now
there is another Portenta board (Portenta C33) supported in MicroPython.
Also made the other identifiers for flash and network name consistent,
removed the incorrectly used MICROPY_PY_SYS_PLATFORM identifiers, and added
missing MICROPY_PY_NETWORK_HOSTNAME_DEFAULT identifiers.
Boards affected:
- stm32: ARDUINO_PORTENTA_H7, ARDUINO_GIGA, ARDUINO_NICLA_VISION
- renesas-ra: ARDUINO_PORTENTA_C33
- esp32: ARDUINO_NANO_ESP32
- rp2: ARDUINO_NANO_RP2040_CONNECT
Signed-off-by: Sebastian Romero <s.romero@arduino.cc>
Configuration:
- Clock is HSE, CPU runs at 250MHz.
- REPL on USB and UART connected to the ST-Link interface.
- Storage is configured for internal flash memory.
- Three LEDs and one user button.
- Ethernet is enabled.
Signed-off-by: Rene Straub <rene@see5.ch>
This adds the sync version of the LoRa driver (and the base WL55 driver).
Adds +13.6kiB (212.6 -> 226.2). Limit for this board is 232kiB.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Fixes are:
- Only emit ADC table entries for pins that aren't cpu-hidden
(i.e. ignore `X,-Y` rows).
- Only use the P channels on H7.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Update rtc, machine and powerctrl drivers to support STM32H5 sleep
modes. This makes RTC alarm wakeup working from lightsleep() and
deepsleep().
Changes:
- Determine start reason for machine.reset_cause() in modmachine.c.
- Add proper interrupt clear code in rtc.c.
- Add wakeup functionality in powerctrl_enter_stop_mode(). Remember
and restore voltage scaling level. Restart HSI48 if it was on before
entering sleep mode.
- Clear DBGMCU_CR in SystemClock_Config() as for other variants.
Otherwise debug flags prevent entering sleep mode.
Implementation Notes:
- rtc.c: EXTI_RTSTR1 bits are not present for H5. Code sequence from
G0/G4/L4/WB/WL would be invalid. RTSTR is only defined for external
(GPIO) interrupts. Maybe this is also true for other STM32 variants.
- powerctrl_enter_stop_mode() uses complicated, nested conditionals
to select STM32 variants. To make code slightly better readable,
comment have been added. A non-nested, #if/#elif sequence would
make the code more readable. I leave this to the original authors.
Signed-off-by: Rene Straub <rene@see5.ch>
This fixes the H7 af.csv files to include the dual-pad information, by
listing the ADCs supported on the _C pad with a C_ADC prefix.
Minimal change to make-pins.py to ignore these entries. This will be
implemented later to emit constants (similar to ADC.CORE_TEMP) to access
these channels.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Requires additions to tools/boardgen.py for stm32 pin generation.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This is now consistent with other ports.
Also renamed `pin_{board/cpu}_pins_locals_dict` to
`machine_pin_{board/cpu}_pins_locals_dict`.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Changes are:
- Pad all cells to make them easier to read.
- Ensure all files have exactly 19 columns (Port,Pin,AF0-15,ADC)
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Fixes are:
- Comment out lines in pins.csv that do not have valid CPU pins.
It's useful to keep these in the file as "documentation" but in order to
make make-pins.py stricter they need to be commented out.
- Fix some typos (missing P prefix) in pins.csv.
This resulted in some missing board pins.
- Fix some typos in af.csv files.
Some typos of "ADC" and some other that were previously ignored.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
All ports now use `--board-csv`, `--prefix`, `--output-souce`,
`--output-header` and no longer write to stdout. This matches the esp32
implementation.
Ports that have an AF input use `--af-csv` (to match `--board-csv`).
Any additional output files are now prefixed with `output-` (e.g.
`--output-af-const`).
Default arguments are removed (all makefiles should always specify all
arguments, using default values is likely an error).
Replaced the `af-defs-cmp-strings` and `hdr-obj-decls` args for stm32 with
just `mboot-mode`. Previously they were set on the regular build, now the
logic is reversed so mboot sets it.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
It's not supported on all ports, adds complexity to the build to generate
pins_af.py, and can mostly be replicated just by printing the pin objects.
Remove support for generating pins_af.py from all ports (nrf, stm32,
renesas-ra, mimxrt, rp2).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Qstrs are picked up from the generated pin source files in the usual qstr
processing stage.
Similarly for the stm constant qstrs.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This prevents each port Makefile from having to add an explicit rule for
`build-BOARD/pins_BOARD.c`.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This updates a small number of files that change with ruff-format's (vs
black's) rules.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The contents of machine_mem.h, machine_i2c.h and machine_spi.h have been
moved into extmod/modmachine.h.
Signed-off-by: Damien George <damien@micropython.org>
The contents of machine_bitstream.h, machine_pinbase.h, machine_pulse.h and
machine_signal.h have been moved into extmod/modmachine.h.
Signed-off-by: Damien George <damien@micropython.org>
The machine_i2c_type, machine_spi_type and machine_timer_type symbols are
already declared in extmod/modmachine.h and should not be declared anywhere
else.
Also move declarations of machine_pin_type and machine_rtc_type to the
common header in extmod.
Signed-off-by: Damien George <damien@micropython.org>
This is a code factoring to have the Python bindings in one location, and
all the ports use those same bindings. For all ports except the two listed
below there is no functional change.
The nrf port has UART.sendbreak() removed, but this method previously did
nothing.
The zephyr port has the following methods added:
- UART.init(): supports setting timeout and timeout_char.
- UART.deinit(): does nothing, just returns None.
- UART.flush(): raises OSError(EINVAL) because it's not implemented.
- UART.any() and UART.txdone(): raise NotImplementedError.
Signed-off-by: Damien George <damien@micropython.org>
No functional change, just code factoring to have the Python bindings in
one location, and all the ports use those same bindings.
Signed-off-by: Damien George <damien@micropython.org>
This factors the basic top-level I2S class code from the ports into
extmod/machine_i2s.c:
- I2S class definition and method table.
- The init and deinit method wrappers.
- The make_new code.
Further factoring will follow.
Signed-off-by: Damien George <damien@micropython.org>
There are currently 7 ports that implement machine.WDT and a lot of code is
duplicated across these implementations. This commit factors the common
parts of all these implementations to a single location in
extmod/machine_wdt.c. This common code provides the top-level Python
bindings (class and method wrappers), and then each port implements the
back end specific to that port.
With this refactor the ports remain functionally the same except for:
- The esp8266 WDT constructor now takes keyword arguments, and accepts the
"timeout" argument but raises an exception if it's not the default value
(this port doesn't support changing the timeout).
- The mimxrt and samd ports now interpret the argument to WDT.timeout_ms()
as signed and if it's negative truncate it to the minimum timeout (rather
than it being unsigned and a negative value truncating to the maximum
timeout).
Signed-off-by: Damien George <damien@micropython.org>