Commit Graph

2648 Commits

Author SHA1 Message Date
Stephane Smith
988827b85a esp32/modesp32: Properly define RTC_VALID_EXT_PINS on S2/S3 variants.
On ESP32 S2/S3 variants, GPIO0 through GPIO21 are valid RTC pins.  This
commit defines the valid RTC_VALID_EXT_PINS for the S2/S3 variants,
otherwise, it keeps functionality the same.
2022-04-14 16:17:52 +10:00
Stephane Smith
7005354099 esp32/machine_pin: Don't expose pins 33-37 when octal SPIRAM is enabled.
For ESP32-S3 configurations, CONFIG_SPIRAM_MODE_OCT requires pins 33-37 for
PSRAM.  So exclude them from the machine_pin_type and machine_pin_irq_type
object tables.
2022-04-14 16:14:13 +10:00
Stephane Smith
ae3d5289a5 esp32/boards: Compile GENERIC_SPIRAM and UM_TINYPICO with -Os.
These boards do not build with IDF v4.4 because the section .iram0.text
does not fit in region iram0_0_seg.  Enabling SPIRAM increases the code
size so use -Os instead of -O2 to build these boards.

Fixes issue #8260.
2022-04-14 16:06:41 +10:00
Damien George
fe9eaf12f3 esp32: Add MICROPY_HW_ENABLE_UART_REPL and enable on generic S2/S3.
Some S2/S3 modules don't use the native USB interface but instead have an
external USB-UART.  To make the GENERIC_S3/S3 firmware work on these boards
the UART REPL is enabled in addition to the native USB CDC REPL.

Fixes issues #8418 and #8524.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-14 14:39:20 +10:00
Damien George
be25e333df esp32/boards: Add test manifest to test freezing during build.
Includes tests for freezing @micropython.native and @micropython.viper
code.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-14 14:06:38 +10:00
Damien George
8045ac07f5 stm32/mpbthciport: Switch scheduling callback to use node scheduler.
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14 12:33:31 +10:00
Peter Hinch
d242a9b7f7 rp2/machine_uart: Use read/write mutex to prevent char duplication.
Duplication of characters is caused by re-entrant calls from separate cores
of uart_fill_tx_fifo().  This patch uses a mutex to ensure that a
re-entrant execution of the function returns without affecting the UART
FIFO.

Fixes issues #8344 and #8360.
2022-04-12 11:39:00 +10:00
Dave Hylands
9d7c168bf5 stm32/boards/PYBD_SFx: Allow FROZEN_MANIFEST to be overridden.
Because mpconfigboard.mk used = rather then ?= it doesn't allow
FROZEN_MANIFEST to be overridden using a GNUmakefile or the manifest.
2022-04-11 16:19:45 +10:00
iabdalkader
a82fad7d8e stm32/system_stm32: Improve H7 PLL and OSC configuration.
- Allow boards to configure CSI, HSI48 and PLL2.
- Allow peripheral clock source configuration.
- Set H7 SYSCLKSource.
2022-04-11 16:12:53 +10:00
iabdalkader
36cac5e154 stm32/system_stm32: Allow boards to configure PLL VCI, VCO and FRACN.
This removes hard-coded PLL1/3 VCI, VCO and FRACN.
2022-04-11 16:12:53 +10:00
iabdalkader
a3e5a68c46 stm32/system_stm32: Set voltage scaling level 0 for H7 Rev-V devices.
This enables voltage scaling level 0 for H7 Rev-V devices, which allows the
CPU to run at the maximum supported operating frequency (480MHz).
2022-04-11 16:12:53 +10:00
iabdalkader
bdbc9b395f stm32/system_stm32: Add H7 switched-mode-power-supply support.
- Add board-level configuration option to set the SMPS supply mode.
- Wait for valid voltage levels after configuring the SMPS mode.
- Wait for external supply ready flag if SMPS supplies external circuitry.
2022-04-11 16:12:53 +10:00
iabdalkader
7b3adb5ce5 stm32/Makefile: Add H747 to Makefile's MCU flags. 2022-04-11 16:12:50 +10:00
iabdalkader
2a19c3cfe1 stm32/sdram: Add function to enable SDRAM power-down mode.
Add power-down mode for maximum power saving while in standby mode, to be
used by a board if needed.  Also fix a typo in a comment.
2022-04-11 16:00:40 +10:00
Damien George
cb0372b5bf stm32/mboot: Add macros for use in led_state_all().
Signed-off-by: Damien George <damien@micropython.org>
2022-04-11 15:52:41 +10:00
Damien George
b2deea6762 stm32/mboot: Consolidate all UI and add general state change hooks.
All user interface (LED, button) code has been moved to ui.c, and the
interface to this code with the rest of the system now goes through calls
to mboot_state_change().  This state-change function can be overridden by a
board to fully customise the user interface behaviour.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-11 15:52:41 +10:00
Damien George
aab005c75b extmod/modusocket: Provide config macro for socket.listen backlog deflt.
To make it possible to change this value for any given port or board.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-11 15:28:56 +10:00
Jon Bjarni Bjarnason
919f696ad2 extmod/modusocket: Implement optional socket.listen backlog argument.
This follows the CPython change: https://bugs.python.org/issue21455

Socket listen backlog defaults to 2 if not given, based on most bare metal
targets not having many resources for a large backlog.  On UNIX it defaults
to SOMAXCONN or 128, whichever is less.
2022-04-11 15:26:47 +10:00
Damien George
b59989f40e rp2/Makefile: Add mbedtls to GIT_SUBMODULES list and use it in CI func.
Signed-off-by: Damien George <damien@micropython.org>
2022-04-11 13:05:25 +10:00
robert-hh
ca41eda281 mimxrt/mphalport: Fix USB CDC RX handling to not block when unprocessed.
Changes in this commit:
- Fix USB CDC RX handling to not block when unprocessed.  The fix follows
  5873390226.
- Fix dupterm rx.
- Remove some obsolete lines.
2022-04-11 12:30:59 +10:00
robert-hh
752fe75910 mimxrt/machine_spi: Improve handling of busy SPI peripheral.
This commit changes the method of waiting for SPI being not busy.  Instead
of the FIFO size, the TransferBusyFlag is probed.

Also, raise an error if the transfer failed.
2022-04-11 12:27:49 +10:00
robert-hh
b70b8ce3e4 mimxrt/machine_rtc: Start RTC at boot and set datetime if not set.
Changes in this commit:
- Start the RTC Timer at system boot.  Otherwise time.time() will advance
  only if an RTC() object was created.
- Set the time to a more recent date than Jan 1, 1970, if not set.  That is
  2013/10/14, 19:53:11, MicroPython's first commit.
- Compensate an underflow in in timeutils_seconds_since_2000(), called by
  time.time(), if the time is set to a pre-2000 date.
2022-04-11 12:25:23 +10:00
robert-hh
e3030f7436 mimxrt/modules: Append /flash/lib to the default sys.path. 2022-04-11 12:25:15 +10:00
robert-hh
798a29f629 mimxrt/boards: Add board.json file for OLIMEX RT1010Py. 2022-04-11 12:24:43 +10:00
Damien George
66b5c4c770 stm32/machine_bitstream: Include all clobbered regs in Cortex-M0 impl.
These additional registers are used by the assembly code.

Thanks to Jim Mussared for the fix.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-07 21:17:51 +10:00
Damien George
43d50f006d stm32/mpconfigport.h: Let MICROPY_PY_IO_FILEIO take its default value.
This is enabled at MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES, which is the
default for stm32.  Not setting the value in mpconfigboard.h allows boards
to optionally configure it.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-07 13:25:48 +10:00
Martin Fischer
5873390226 rp2/mphalport: Fix USB CDC RX handling to not block when unprocessed.
Prior to this commit, the USB CDC OUT endpoint got NACK'd if a character
was received but not consumed by the application, e.g. via
sys.stdin.read().  This meant that USB CDC was blocked and no additional
characters could be sent from the host.  In particular a ctrl-C could not
interrupt the application if another character was pending.

To fix the issue, the approach in this commit uses a callback tud_cdc_rx_cb
which is called by the TinyUSB stack on reception of new CDC data.  By
consuming the data immediately, the endpoint does not stall anymore.  The
previous handler tud_cdc_rx_wanted_cb was made obsolete and removed.

In addition some cleanup was done along the way: by adding interrupt_char.c
and removing the existing code mp_hal_set_interrupt_char().  Also, there is
now only one (stdin) ringbuffer.

Fixes issue #7996.
2022-04-05 10:47:19 +10:00
iabdalkader
5682595d75 esp32: Allow overriding cmake frozen manifest from the command line.
If MICROPY_FROZEN_MANIFEST is set from the cmake command line, then it will
override the default and any manifest set by the board.
2022-04-04 23:49:10 +10:00
Damien George
86e6744ff5 rp2: Enable ucryptolib, using mbedtls for backend functions.
Signed-off-by: Damien George <damien@micropython.org>
2022-04-04 23:15:01 +10:00
Andrew Leech
8db93dc016 stm32/Makefile: Allow overriding COPT in Makefile.
It can now be set in mpconfigboard.mk (as well as the make command line).
2022-04-04 23:12:15 +10:00
iabdalkader
5562ed3f43 stm32/pyb_can: Replace CAN.initfilterbanks with CAN.init keyword arg.
The CAN.initfilterbanks() class method is removed, and its functionality is
replaced with the "num_filter_banks" keyword argument to the CAN
constructor and CAN.init().  This configures the filter bank split.

This new approach provides more flexibility configuring the resources used
by a given CAN instance, allowing other MCUs like H7 to fit the API.  It
also brings CAN closer to how other machine peripherals are configured,
where everything is done in the constructor/init method.

This is a breaking change to the CAN API.
2022-04-02 22:42:00 +11:00
iabdalkader
a79706fb39 stm32/pyb_can: Define the maximum bit timing parameters.
Define the maximum parameters for CAN/FDCAN nominal bit timing, and for
FDCAN data bit timing, for bit timing calculations.
2022-04-02 22:41:37 +11:00
iabdalkader
95104c9f6e stm32/pyb_can: Return the filter ID and type of received messages.
CAN.recv() now returns a 5-tuple, with the new element in the second
position being a boolean, True if the ID is extended.

This is a breaking change of the API for CAN.recv().
2022-04-02 22:40:09 +11:00
iabdalkader
e7264e9532 stm32/pyb_can: Add support for bus with mixed Classic/FD nodes.
A CAN bus can have mixed classic/FD nodes.  Prior to this patch the CAN API
could be configured for either standard or extended ID, but not both/mixed
operation.

This patch allows extended IDs to be filtered and enabled on a per-message
basis, in send(), setfilter() and clearfilter().

This is a breaking change to the API: init() no longer accepts the extframe
keyword argument.
2022-04-02 22:37:52 +11:00
iabdalkader
3320ec44ed stm32/pyb_can: Add support for CAN FD extended frame ID. 2022-04-02 22:37:45 +11:00
iabdalkader
ff287d085f stm32/pyb_can: Enable CAN FD frame support and BRS.
- Enable CAN FD frame support and BRS.
- Optimize the message RAM usage per FDCAN instance.
- Document the usage and different sections of the Message RAM.
2022-04-02 22:37:27 +11:00
Andrew Leech
a41bc5a7ca stm32/modmachine: Add deepsleep support to reset_cause() for WB55. 2022-03-30 15:56:26 +11:00
Meriç SARIIŞIK
6b23f7d301 stm32/sdio: Use runtime calculation for clock divider of sdio on H7.
STM32H7 family has a different calculation compared to the current one for
the SDMMC clock divider configuration.
2022-03-30 15:40:59 +11:00
Andrew Leech
303e222f70 nrf/modules: Include uasyncio in default board manifest. 2022-03-30 15:37:49 +11:00
Andrew Leech
f92da1adc4 nrf/drivers/usb: Fix MP_STREAM_POLL_RD support on USB CDC.
This gets ipoll working on USB CDC stdin.
2022-03-30 15:34:25 +11:00
Andrew Leech
dc8b43adc7 nrf/drivers/usb: Fix background events/scheduling while at USB REPL. 2022-03-30 15:33:29 +11:00
MikeTeachman
1f6cb8f047 mixmrt/machine_i2s: Add I2S protocol support.
This commit adds support for machine.I2S on the mimxrt port.  The I2S API
is consistent with the existing stm32, esp32, and rp2 implementations.

I2S features:
- controller transmit and controller receive
- 16-bit and 32-bit sample sizes
- mono and stereo formats
- sampling frequencies from 8kHz to 48kHz
- 3 modes of operation:
  - blocking
  - non-blocking with callback
  - uasyncio
- configurable internal buffer
- optional MCK

Tested with the following development boards:
- MIMXRT1010_EVK, MIMXRT1015_EVK, MIMXRT1020_EVK, MIMXRT1050_EVK
- Teensy 4.0, Teensy 4.1
- Olimex RT1010
- Seeed ARCH MIX

Tested with the following I2S hardware peripherals:
- UDA1334
- GY-SPH0645LM4H
- WM8960 codec on board the MIMXRT boards and separate breakout board
- INMP441
- PCM5102
- SGTL5000 on the Teensy audio shield

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2022-03-30 14:12:40 +11:00
Damien George
6804a8a891 stm32/machine_i2s: Fix 16-bit stereo i2s_frame_map.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-29 11:44:08 +11:00
Damien George
2a91c8a888 stm32/machine_i2s: Allow I2S.deinit to be called multiple times.
In particular, it is called by the constructor if the instance already
exists.  So if the previous instance was deinit'd then it will be deinit'd
a second time.

Signed-off-by: Damien George <damien@micropython.org>
2022-03-29 11:44:08 +11:00
Damien George
c90dfba04c stm32/machine_i2s: Set FullDuplexMode to disabled on F4.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-29 11:44:08 +11:00
iabdalkader
df86cef59a rp2: Allow Overriding cmake frozen manifest from the command line.
If MICROPY_FROZEN_MANIFEST is set from the cmake command line, then it will
override the default and any manifest set by the board.
2022-03-24 22:10:01 +11:00
iabdalkader
fe8b47e29f ports: Allow boards to define additional network interfaces. 2022-03-24 17:23:28 +11:00
Damien George
66fe3d5cb5 stm32: Support building for STM32F745.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 16:01:09 +11:00
Andrew Leech
bb0ca00b77 stm32/mboot: Verify CRC32 of fsload DFU files before writing. 2022-03-22 15:04:41 +11:00
Andrew Leech
bc856a1e29 stm32/mboot: Verify signature of fsload packed DFU files before writing.
When verifying the DFU contents, the signature of signed/encrypted files is
also now checked in this initial, dry-run stage.
2022-03-22 15:04:37 +11:00