This commit allows other ports to reuse the CYW43 HCI driver, by replacing
all Bluetooth UART and control named pins with defines in config files and
using `mpbthci` abstract functions (i.e. `mp_bluetooth_hci_*`) instead of
the STM32 specific UART functions.
Note: the function `cywbt_wait_cts_low` does not need to switch the CTS
pin from alternate function to GPIO to read it. At least on stm32, mimxrt
it's possible to just read the pin input. For example, see the STM32F7
RM0410 section 6.3.11, and the `SION` for IMXRT. So this function can
also be available for other ports if the pin mode switching is removed.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
The rp2 port was enabling SSL and had finalizers enabled via the "extra
features" level, but missed explicitly enabling `MICROPY_PY_SSL_FINALISER`
(like esp32, stm32, and mimxrt did).
This commit makes `MICROPY_PY_SSL_FINALISER` default to enabled if
finalizers are enabled, and removes the explicit setting of this for
esp32, stm32, mimxrt (because they all use the "extra features" level).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This allows switching between variants without clobbering the build
output.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This was used to override the firmware filename generated by the build
server (to match the historical name before board definitions existed).
Now we're making everything use the board definition name (i.e. the
directory name).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This is to support a future change to add the variant name to the build
directory and therefore should be the same style as the board name.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
MICROPY_PY_STM_CONST defaults to 1 if MICROPY_PY_STM is set. Overriding to
0 disables the named register peripheral constants being including in the
stm32 module.
This saves about 7.5KB of code size for the STM32WL55, which is significant
as this SoC doesn't have a lot of flash.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This is the minimum C interface to allow a modem driver to be built in
Python. Interface is simple, with the intention that the micropython-lib
driver is the main (only) consumer of it.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
No IRQHandlers were compiled in for this board.
Includes small consolidation of the same DMAMUX_ENABLE line for STM32G4,
STM32WB, STM32WL.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Switches default on the NUCLEO_WL55 board to use the HSE oscillator powered
from PB0_VDDTCXO pin.
Build-time configuration can select from MSI internal oscillator (previous
default), HSE via crystal, or HSE bypass with TCXO powered from PB0_VDDTCXO
pin (new default)
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This is a "normal" SPI peripheral with no external pins, to avoid having to
grow spi_obj[] for just this one board map it as SPI ID 3 (board has SPI
IDs 1,2 already).
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This is difficult to implement on cmake-based ports, and having the list
of variants in mpconfigboard.{cmake,mk} duplicates information that's
already in board.json.
This removes the existing query-variants make target from stm32 & rp2
and the definition of BOARD_VARIANTS from the various board files.
Also renames the cmake variable to MICROPY_BOARD_VARIANT to match other
variables such as MICROPY_BOARD. The make variable stays as
BOARD_VARIANT.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit:
- Finds a common set of board feature tags and maps existing features to
that reduced set.
- Removes some less-useful board feature tags.
- Ensures all MCUs are specified correctly.
- Ensures all boards have a vendor (and fixes some vendor names).
This is to make the downloads page show a less intimidating set of filters.
Work done in conjunction with Matt Trentini <matt.trentini@gmail.com>.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Previously this was explicitly enabled on esp32/stm32/renesas/mimxrt/samd,
but didn't get a default feature level because it wasn't in py/mpconfig.h.
With this commit it's now enabled at the "extra features" level, which adds
rp2, unix-standard, windows, esp8266, webassembly, and some nrf boards.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This provides similar functionality to the former zlib.DecompIO and
especially CPython's gzip.GzipFile for both compression and decompression.
This class can be used directly, and also can be used from Python to
implement (via io.BytesIO) zlib.decompress and zlib.compress, as well as
gzip.GzipFile.
Enable/disable this on all ports/boards that zlib was previously configured
for.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This library used a mix of "tinf" and "uzlib" to refer to itself. Remove
all use of "tinf" in the public API.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
There are enough places that implement __exit__ by forwarding directly to
mp_stream_close that this saves code size.
For the cases where __exit__ is a no-op, additionally make their
MP_STREAM_CLOSE ioctl handled as a no-op.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This will be replaced with a new deflate module providing the same
functionality, with an optional frozen Python wrapper providing a
replacement zlib module.
binascii.crc32 is temporarily disabled.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Re-enable some features required for the board to still build and the lora
driver to run.
This board only has 192KB of flash total, so default stm32 build is very
close to the limit.
Before:
LINK build-B_L072Z_LRWAN1/firmware.elf
text data bss dec hex filename
184352 68 14112 198532 30784 build-B_L072Z_LRWAN1/firmware.elf
(12256 bytes free)
After:
LINK build-B_L072Z_LRWAN1/firmware.elf
text data bss dec hex filename
155028 68 14052 169148 294bc build-B_L072Z_LRWAN1/firmware.elf
(41580 bytes free)
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
The existing qspi for stm32 implementation can only send a spi command with
exactly 0 or 2 data bytes. Certain spiflash chips (e.g. AT25SF321B) have
commands that only take a single data byte, and will ignore the command if
more than that is sent. This commit allows sending a command with a single
data byte.
Signed-off-by: Victor Rajewski <victor@allumeenergy.com.au>
For STM32G4, there is a errata on ADC that may get wrong ADC result.
According to the errata sheet, this can be avoid by performing two
consecutive ADC conversions and keep second result.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
For STM32G4 series, the internal sensors are connected to:
- ADC1_IN16: Temperature sensor
- ADC1_IN17: Battery voltage monitoring
- ADC1_IN18: Internal voltage reference
but ADC_CHANNEL_TEMPSENSOR_ADC1, ADC_CHANNEL_VBAT,
ADC_CHANNEL_VREFINT are not defined as 16, 17, 18.
This commit converts channel 16, 17, 18 to ADC_CHANNEL_x in
adc_get_internal_channel().
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
For STM32G4,
* TS_CAL1 raw data acquired at a temperature of 30°C
* TS_CAL2 raw data acquired at a temperature of 130°C
Also, these values are at VDDA=3.0V.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
For STM32G4, ADC clock frequency should be equal or less than 60MHz.
To satisfy this specification, ADC clock prescaler should be equal or
greater than 4 (For example, NUCLEO_G474RE runs 170MHz).
In addition, to obtain accurate internal channel value,
the ADC clock prescaler is set to 16 because vbat needs at least 12us
(16/170*247.5=23.3us).
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
For STMG4 MCUs, the peripheral registers for DAC have to be accessed by
words (32bits) because DAC is connected to AHB directly.
(This requirement is also there for other MCU series. However, if DAC is
connected to APB like F4/L1/L4 MCUs, AHB byte or half-word transfer is
changed into a 32-bit APB transfer. This means that PSIZE does not have to
be DMA_PDATAALIGN_WORD on these MCUs, and in fact must be BYTE/HALFWORD to
function correctly.)
Fixes issue #9563.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
To match the other functions in the machine module, in particular so that
MICROPY_PY_MACHINE can be disabled without getting a compiler warning about
unused code.
Signed-off-by: Damien George <damien@micropython.org>
Mostly updates comments, but also renames the UASYNCIO enum value to
ASYNCIO.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The asyncio module now has much better CPython compatibility and
deserves to be just called "asyncio".
This will avoid people having to write `from uasyncio import asyncio`.
Renames all files, and updates port manifests to use the new path. Also
renames the built-in _uasyncio to _asyncio.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit adds initial support for STM32H5xx MCUs. The following
features have been confirmed to be working on an STM32H573:
- UART over REPL and USB CDC
- USB CDC and MSC
- internal flash filesystem
- machine.Pin
- machine.SPI transfers with DMA
- machine.ADC
- machine.RTC
- pyb.LED
- pyb.Switch
- pyb.rng
- mboot
Signed-off-by: Damien George <damien@micropython.org>
The G0 USB peripheral behaves more like MICROPY_HW_USB_IS_MULTI_OTG=0 than
that config =1. This fixes the configuration of the PMA FIFO buffers.
Signed-off-by: Damien George <damien@micropython.org>
For debugging purposes, to see output from other peripherals.
Also reset the pyb_stdio_uart state at the end of soft reset, in case it
points to a heap-allocated object.
Signed-off-by: Damien George <damien@micropython.org>
Following how mkrules.cmake works. This makes it easy for a port to enable
frozen code, by defining FROZEN_MANIFEST in its Makefile.
Signed-off-by: Damien George <damien@micropython.org>