Commit Graph

13050 Commits

Author SHA1 Message Date
Damien George
4a4f269a1a stm32/powerctrlboot: Set HAL uwTickPrio variable when needed.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-31 18:26:55 +11:00
Damien George
14becd80c9 stm32/usbd_conf: Set lpm_enable and battery_charging_enable on all MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-31 16:38:32 +11:00
Herwin Grobben
517e82eb6b stm32/fdcan: Fix naming with regards to G4 series. 2022-01-27 23:06:13 +11:00
Herwin Grobben
160e4d9a6d stm32/fdcan: Fix FIFO1 usage and handling of error interrupts.
The original code used a independent state with regards to the interrupt.
During heavy bus error conditions the internal state could become
out-of-sync with the interrupts.

Further explanation: during the development of an application using CAN
communication, a interrupt-run-away was found in some situations.  It was
found that the error interrupt triggered (Warning, Passive or Bus-Off, all
triggered it) the run-away.  The only recovery was a reset.

Two problems were found:
- the error interrupt is enabled but not cleared in the interrupt routine;
- an internal variable 'State' that was used to track the message received
  state (empty, new, full, overflow) that was not directly related to
  interrupt that indicated the state.

In this commit these issues are fixed by adding more values for the
interrupt reason (warning, passive, bus off) and clearing the error
interrupts, and making the internal state directly dependent on the
interrupt state for received messages.

Furthermore, introducing the FIFO1 in the CAN receive stage, another issue
existed.  Even if the messages are received into the FIFO1 (by selecting
message filtering for FIFO0 and FIFO1), the interrupt firing was indicating
FIFO0 Rx.  The configuration of the interrupts for this is now also fixed.
The CAN peripheral has 2 interrupt lines going into the NVIC controller.
The assignment of the interrupt reasons to these 2 interrupt lines was
missing.  Now the reception of FIFO1 messages triggers the second interrupt
line.  Other interrupts (Rx FIFO0 and bus error) are assigned to the first
interrupt line.

Tested on a Nucleo-G474, and also checked the HAL function to work with the
H7 family.
2022-01-27 23:01:08 +11:00
iabdalkader
a00e1e5735 stm32/dac: Deinit all DACs on soft reset.
DAC timed functions continue to run after a soft reset cycle, using
collected memory in the case of write_timed.
2022-01-27 17:10:39 +11:00
robert-hh
c1841c2d45 mimxrt: Simplify Makefile in selection of flash type.
Simplify it a little bit by combining two sections regarding the
flash type. Thanks to @alphaFred for suggesting it.
2022-01-27 17:05:45 +11:00
robert-hh
da9c3607a5 mimxrt: Add support for the Olimex RT1010 board.
The board.json file is intentionally excluded, until the board will be
sold. But including it into the mimxrt series make it easier to keep
the build up-to-date.
2022-01-27 17:05:45 +11:00
robert-hh
b73073d246 mimxrt: Add USB ID elements.
- Manufacturer, set by MICROPY_HW_USB_STR_MANUF; default "MicroPython"
- Board name, as set by MICROPY_HW_BOARD_NAME
- Unique-ID, same as returned by machine.unique_id()
- USB Vendor ID, as set by MICROPY_HW_USB_VID; default 0xf055
- USB Product ID, as set by MICROPY_HW_USB_PID; default 0x9802
2022-01-27 17:05:34 +11:00
robert-hh
30380962cf mimxrt: Allow to select cs0 or cs1 for SPI.
Using the keyword argument cs=nnn in the constructor. The cs1
pin has to be defined in mpconfigboard.h.
Note: Only a few boards have the CS1 pin exposed to the connectors.
2022-01-27 16:53:30 +11:00
robert-hh
1dc366f901 mimxrt: Replace Pin-config constants by a function call.
The Pin config setting by IOMUXC_SetPinConfig() is supplied by a
bit pattern. That pattern is specific for a MCU family. In preparation
for supporting the MIMXRT117x family, the constant bit pattern is
replaced by a function call, such that the bit pattern is created
at a single place. The code for this functions was taken from
machine_pin.c.

Note: A working port for the MIMXRT1176 exists already.
2022-01-27 16:53:30 +11:00
robert-hh
5bda84aed5 mimxrt: Remove two files from the Seeed Arch Mix directory.
These were leftovers from a previous refactoring in the Seeed Arch Mix
directory.
2022-01-27 16:53:30 +11:00
robert-hh
b8a0358c34 mimxrt: Compensate for a bug in the fsl_lpspi.c file.
This library file has a bug, in that TransferBlocking returns before the
transfer has finished. That is a problem if a write follows immediately
a read.
2022-01-27 16:53:30 +11:00
robert-hh
84b76e4fbf mimxrt: Allow for board-specific flash driver files.
If in a board's mkconfigboard.mk the following symbol is set:

MICROPY_HW_BOARD_FLASH_FILES = 1

then the files:

($BOARD)_flexspi_flash_config.h  and
qspi_nor_flash_config.c  and/or
qspi_hyper_flash_config.c

are expected in the board directory. Otherwise the common files from
the hal directory are used.
2022-01-27 16:53:30 +11:00
robert-hh
2dd3d88409 mimxrt: Support gaps in the SPI an I2C device numbers.
That allows also to use e.g. SPI1 and SPI2 instead SPI0 and SPI1.
2022-01-27 16:53:30 +11:00
Damien George
e1a84a0c6f esp32/partitions: Increase size of app-part from 0x180000 to 0x1F0000.
To fill out all of the available flash up to the start of the filesystem
partition.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-27 16:44:13 +11:00
Damien George
79a3158de6 stm32/pin: Change remaining uses of "af" to "alt".
The keyword "af" has been deprecated for some time and "alt" should be used
instead (but "af" still works).

Signed-off-by: Damien George <damien@micropython.org>
2022-01-27 16:44:13 +11:00
Andrew Leech
30b6ce86be windows: Add micropython.schedule support. 2022-01-23 10:55:08 +11:00
Damien George
c153bfd311 docs/differences: Update python_36 now that b2a_base64 accepts newline.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-23 10:23:30 +11:00
Christian Decker
2e3a2785cd extmod/modubinascii: Add newline keyword to b2a_base64 function.
This allows encoding things (eg a Basic-Auth header for a request) without
slicing the \n from the string, which allocates additional memory.

Co-authored-by: David Lechner <david@lechnology.com>
2022-01-23 10:18:01 +11:00
Damien George
aafd8859e9 docs/differences: Update differences now that math.tau/inf/nan exist.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-23 09:33:19 +11:00
stijn
f3229590a9 tools/ci: Test math constants with MICROPY_OBJ_REPR_D. 2022-01-23 09:28:33 +11:00
stijn
dd6967202a py/modmath: Add math.tau, math.nan and math.inf constants.
Configurable by the new MICROPY_PY_MATH_CONSTANTS option.
2022-01-23 09:28:33 +11:00
stijn
e0b8d69827 github/workflows: Show context for qemu-arm test failures.
Make it easier to see what went wrong in CI builds.
2022-01-23 09:25:19 +11:00
stijn
a9448c0a86 all: Fix MICROPY_OBJ_REPR_D compilation with msvc. 2022-01-23 09:25:01 +11:00
Jos Verlinde
5f8eef4521 windows/README.md: Fix broken mingw link. 2022-01-23 09:19:47 +11:00
ubi de feo
ea5744fd8d esp32/boards: Provide custom deploy_c3.md for ESP32-C3 boards.
This fixes the flash address for installation on ESP32-C3.
2022-01-22 11:18:50 +11:00
Damien George
bb9d688454 esp32/main: Use heap_caps_get_info on IDF <4.1 to compute total heap.
heap_caps_get_total_size() is only available in IDF 4.1 and above.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-22 10:46:31 +11:00
marcidy
ac39960aa1 esp32/modnetwork: Fix test for WIFI_AUTH_MAX for IDF v4.3.0.
Signed-off-by: marcidy <marcidy@gmail.com>
2022-01-22 00:55:07 +11:00
Sean Coates
6a10d3ed99 esp32/README.md: Fix URL for esp-idf installation.
The current URL points to a pinned version of the document (v4.0.2) and is
currently not found (404).
2022-01-22 00:53:26 +11:00
Damien George
23b1a4e0b6 esp32/main: Allocate at most 1/2 of available IDF heap for MP heap.
So that there is some memory left for the OS, eg for ssl buffers.

See issue #7214.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-22 00:46:12 +11:00
Damien George
648656dbbd esp32/esp32_rmt: Call rmt_driver_install directly if running on core 1.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-22 00:11:14 +11:00
jason
357078504d esp32: Pin MicroPython to core 1 again.
This follows up on #5489, where we changed the esp32 core pinning to core 0
in order to work around an issue with IDF < 4.2.0.  Now that IDF > 4.2.0 is
available, we allow pinning back to core 1, which eliminates some
problematic callback latency with WiFi enabled.

NimBLE is also pinned to core 1 - the same core as MicroPython - when using
IDF >=4.2.
2022-01-22 00:10:16 +11:00
Jonathan Hogg
63438a31bb esp32/machine_adcblock: Add new machine.ADCBlock class and update ADC.
Rework the ADC implementation to follow the improved ADC/ADCBlock API.
This adds support for calibrated voltage readings and the ADC2 block.  The
ADC API is backwards compatible with what it was before this change.

Resolves #6219.
2022-01-21 22:55:24 +11:00
Jonathan Hogg
3300d6d337 docs/esp32: Document expanded ADC API in quickref.
Document read_u16(), read_uv() and ADCBlock(). Mark old read(), atten() 
and width() methods as legacy.
2022-01-21 22:40:37 +11:00
Damien George
4d2f487ee1 docs/library: Specify additional ADC methods and new ADCBlock class.
The new ADC methods are: init(), read_uv() and block().

The new ADCBlock class has methods: init() and connect().

See related discussions in #3943, #4213.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-21 22:35:23 +11:00
Damien George
7d71ae25ed extmod/machine_i2c: Increase default SoftI2C timeout to 50ms.
Some devices, eg BNO055, can stretch SCL for a long time, so make the
default large to accommodate them.  50ms matches the current default for
stm32 hardware I2C .

Signed-off-by: Damien George <damien@micropython.org>
2022-01-21 15:10:30 +11:00
Damien George
a707fe50b0 rp2/machine_i2c: Use soft I2C only for len=0, and increase timeout.
The RP2040 I2C hardware can do writes of length 1 and 2, just not of length
0.  So only use software I2C for writes of length 0, to improve
performance.

Also increase the software I2C timeout for zero-length writes to
accommodate the behaviour of a wider range of I2C devices.

Fixes issue #8167.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-21 15:10:29 +11:00
iabdalkader
bef26d4e3f rp2/machine_uart: Add machine.UART init/deinit methods.
Without these methods a lot of existing "portable" scripts are broken.
This change improves portability by making rp2 machine.UART more compliant
with the documented machine UART interface.
2022-01-21 15:08:47 +11:00
Damien George
9438fb7321 extmod/modusocket: Support additional args to getaddrinfo.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-21 13:40:06 +11:00
iabdalkader
1aac151d68 drivers/ninaw10: Return standard error numbers. 2022-01-21 13:35:05 +11:00
iabdalkader
a63875d5ad extmod/modusocket: Create new sockets in blocking mode.
To conform with CPython and other MicroPython ports.
2022-01-21 13:34:56 +11:00
iabdalkader
6e8f4eaa52 tests/multi_net/udp_data.py: Allow reusing port before bind. 2022-01-21 13:34:33 +11:00
iabdalkader
e6ddda29ca tests/multi_net: Close accepted sockets when tests are done.
gc_sweep_all() cleans up sockets via the finaliser, but tests should
cleanly free resources they use.
2022-01-21 13:34:20 +11:00
iabdalkader
155eb1361e extmod/modusocket: Add makefile() method and common socket options. 2022-01-21 13:34:06 +11:00
iabdalkader
b23178a9c0 extmod/modusocket: Make setsockopt return if NIC is not connected. 2022-01-21 13:32:09 +11:00
iabdalkader
e401ff8935 drivers/ninaw10: Fix timeout handling to match modusocket. 2022-01-21 13:31:41 +11:00
iabdalkader
9a61bc3aa7 extmod/network_ninaw10: Implement MP_STREAM_POLL in ioctl.
There is currently no function to query if the socket is writable.
2022-01-21 13:30:48 +11:00
iabdalkader
981664fd07 drivers/ninaw10: Add function to check socket state/data availability. 2022-01-21 13:30:13 +11:00
iabdalkader
5db278f1dd rp2/mphalport: Add optional dupterm support. 2022-01-20 16:57:03 +11:00
iabdalkader
f44fb76055 rp2/mpconfigport.h: Use internal error numbers. 2022-01-20 16:46:14 +11:00