Commit Graph

12898 Commits

Author SHA1 Message Date
robert-hh
bbe25f4704 mimxrt: Support selection of PHY type and address.
Useful for boards without a PHY interface, where that has to be
attached. Like the Seed ARCH MIX board or Vision SOM. Phy drivers
supported so far are:

- KSZ8081
- DP83825
- LAN8720

More to come. Usage e.g.:
lan = LAN(phy_type=LAN.PHY_LAN8720, phy_addr=1)

The default values are those set in mpconfigboard.h.
2021-12-14 08:07:52 +01:00
robert-hh
bc1b0fd2c1 mimxrt: Define UART 0 on MIMXRT boards.
UART 0 is attached to the Debug USB port. The settings are
115200 Baud, 8N1.
For MIMXRT1010_EVK this is identical to UART1. For the other boards,
this is an additional UART.
2021-12-14 08:07:52 +01:00
iabdalkader
1b7eee24eb extmod/network_ninaw10: Fix config of AP mode.
* Fix missing call to connect to configure module in AP mode.
* Use enum for config/connect args indices.
2021-12-14 15:14:58 +11:00
iabdalkader
f21c565583 rp2/machine_uart: Handle and clear UART RX timeout IRQ.
The pico-sdk 1.3.0 update in 97a7cc243b
introduced a change that broke RP2 Bluetooth UART, and possibly UART in
general, which stops working right after UART is initialized.  The commit
raspberrypi/pico-sdk@2622e9b enables the UART receive timeout (RTIM) IRQ,
which is asserted when the receive FIFO is not empty, and no more
characters are received for a period of time.

This commit makes sure the RTIM IRQ is handled and cleared in
uart_service_interrupt.
2021-12-14 14:59:39 +11:00
Damien George
5adb1fa40e esp32,esp8266: Extract qstr from object when comparing keys in config().
Following on from a previous fix for the same problem made in
3a431fba50.

Fixes issue #8052.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 14:27:13 +11:00
Damien George
6995cf03dd stm32/sdcard: Add config option to force MM card capacity.
The current ST HAL does not support reading the extended CSD so cannot
correctly detect the capacity of high-capacity cards.  As a workaround, the
capacity can be forced via the MICROPY_HW_MMCARD_LOG_BLOCK_NBR config
option.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 10:48:01 +11:00
Damien George
b26704aac5 stm32/sdcard: Support 8-bit wide SDIO bus.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 10:48:01 +11:00
Damien George
9a1ab2286d stm32/main: Call sdcard_init when only MICROPY_HW_ENABLE_MMCARD enabled.
Otherwise, if MMCARD is enabled and not SDCARD, then the GPIO will not be
configured for SDIO.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 10:48:01 +11:00
Damien George
88ac5a3116 stm32: Update L4 code to build with latest stm32lib and L4 HAL 1.17.0.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 10:48:01 +11:00
Damien George
a0f5b3148a lib/stm32lib: Update library for L4 v1.17.0, new G4, WL, and MMC fixes.
Changes in this new library version are:
- Update L4 HAL to v1.17.0.
- Add G4 HAL at v1.3.0.
- Add WL HAL at v1.1.0.
- Fix F4 UART and DMA data loss with RX hardware flow control.
- Optimise USB to pass config struct by reference.
- Fix bug in F4 MMC HAL_MMC_Erase function.
- Fix bug setting MMC relative address in F4 and F7 HAL.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 10:48:01 +11:00
Damien George
0892ebe091 stm32/boards: Enable MICROPY_HW_ENABLE_SERVO on various boards.
Fixes issue #8059.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-10 23:19:20 +11:00
Damien George
5fc55999b2 stm32/boards: Remove unused MICROPY_HW_ENABLE_TIMER config.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-10 23:19:00 +11:00
Damien George
10c6f03cbe stm32/boards: Remove stray '+' characters at start of lines in ld files.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-10 23:15:25 +11:00
Damien George
3f589e2f39 tools/autobuild: Automatically build all esp32 boards.
Any board with a board.json file will be built.  ESP32-based boards will be
built using the IDF at $IDF_PATH_V42, all other MCU variants (S2, S3, C3)
will be built using the IDF at $IDF_PATH_V44.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-10 21:29:27 +11:00
Damien George
c613f5bb49 stm32/boards/LEGO_HUB_NO6: Set filesystem label as HUB_NO6.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-09 16:51:35 +11:00
Jim Mussared
92f54fe8d9 stm32/boards/NUCLEO_WB55: Fix LED ordering.
These were commented correctly by their colour, but in the wrong order with
respect to the PCB silkscreen.

Fixes issue #8054.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-12-09 14:03:35 +11:00
Damien George
67f66795c0 tools/mpremote: Implement seek and flush in ioctl method.
Fixes issue #8058.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-09 13:35:59 +11:00
Damien George
9ffb1ad2f8 unix/Makefile: Use -Og instead of -O0 for debug builds.
For the coverage build this reduces the binary size to about 1/4 of its
size, and seems to help gcov/lcov coverage analysis so that it doesn't miss
lines.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-09 12:53:09 +11:00
Damien George
efde4b2c75 extmod/modure: Redirect regex debug printing to mp_printf.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-09 12:53:04 +11:00
Damien George
71168ec55c unix/coverage: Change remaining printf to mp_printf.
For consistency with all other prints in this file, so that the ordering
of output is correct.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-09 12:38:50 +11:00
Jim Mussared
3770fab334 all: Update Python formatting to latest Black version 21.12b0.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-12-09 12:09:40 +11:00
IhorNehrutsa
b491967bbd esp32/machine_pwm: Implement duty_u16() and duty_ns() PWM methods.
The methods duty_u16() and duty_ns() are implemented to match the existing
docs.  The duty will remain the same when the frequency is changed.
Standard ESP32 as well as S2, S3 and C3 are supported.

Thanks to @kdschlosser for the fix for rounding in resolution calculation.

Documentation is updated and examples expanded for esp32, including the
quickref and tutorial.  Additional notes are added to the machine.PWM docs
regarding limitations of hardware PWM.
2021-12-03 23:58:52 +11:00
Jim Mussared
a7fa18c203 py/builtinimport: Refactor module importing.
Simplify and document/comment the handling of builtin import for:
- already-loaded modules
- built-in modules
- built-in umodules (formerly weak links)
- filesystem modules

Retains existing functionality with smaller code size but should also
facilitate potential new features (built-in packages, controlling the
frozen path).

Also makes the (unix-only) -m behavior a bit more obvious and configurable.

Code size change with this commit:

   bare-arm:    +0 +0.000%
minimal x86:   -64 -0.039%
   unix x64:   -32 -0.006%
unix nanbox:    -4 -0.001%
      stm32:  -184 -0.047% PYBV10
     cc3200:  -120 -0.065%
    esp8266:  -228 -0.033% GENERIC
      esp32:  -268 -0.018% GENERIC[incl +16(data)]
        nrf:  -152 -0.087% pca10040
        rp2:  -256 -0.052% PICO
       samd:   -80 -0.057% ADAFRUIT_ITSYBITSY_M4_EXPRESS
2021-12-01 13:23:34 +11:00
Jonathan Hogg
851ecb2da1 extmod/modbluetooth: Support gap_connect(None) to cancel a connection.
Allow cancellation of in-progress peripheral connections.
2021-12-01 11:56:37 +11:00
Scott Armitage
de7e3cd792 docs/library/machine.Pin.rst: Add Pin.ANALOG mode constant. 2021-11-30 22:33:18 +11:00
Michael Buesch
68d1245f42 docs/library/machine.Timer.rst: Document period and callback args.
Signed-off-by: Michael Buesch <m@bues.ch>
2021-11-30 22:29:03 +11:00
Michael Buesch
1e7c8f2b0b docs/library/machine.SPI.rst: Add example SPI usage.
Signed-off-by: Michael Buesch <m@bues.ch>
2021-11-30 22:28:19 +11:00
Michael Buesch
e7900351bf docs/library/machine.Timer.rst: Document 'id' as positional-only arg.
Signed-off-by: Michael Buesch <m@bues.ch>
2021-11-30 22:27:58 +11:00
Peter Hinch
d94ac4333f docs/library/uasyncio.rst: Detail exception behaviour in cancel/timeout. 2021-11-30 21:43:06 +11:00
Damien George
23a150789d stm32/boards/make-pins.py: Use cpu pins to define static alt-fun macros.
Instead of board pins, so that pins which have only the CPU specified in
pins.csv can still be used with mp_hal_pin_config_alt_static().

Signed-off-by: Damien George <damien@micropython.org>
2021-11-30 10:25:41 +11:00
Damien George
0c9f5b388e stm32: Include HAL MMC code in F4 builds.
So that the MMC driver can be used on F4 MCUs.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-30 10:21:18 +11:00
Damien George
7e61a12eb1 stm32: Add support for F479 MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2021-11-30 10:21:18 +11:00
Damien George
35e70c1698 stm32/boards: Convert F413,F439,H743,L4xx,WB55 to new flash FS config.
Signed-off-by: Damien George <damien@micropython.org>
2021-11-29 13:20:35 +11:00
Damien George
84969194a1 stm32/flashbdev: Support generic flash storage config via link symbols.
A board can now define the following linker symbols to configure its flash
storage layout:

    _micropy_hw_internal_flash_storage_start
    _micropy_hw_internal_flash_storage_end
    _micropy_hw_internal_flash_storage_ram_cache_start
    _micropy_hw_internal_flash_storage_ram_cache_end

And optionally have a second flash segment by configuring
MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE_SEGMENT2 to 1 and defining:

    _micropy_hw_internal_flash_storage2_start
    _micropy_hw_internal_flash_storage2_end

Signed-off-by: Damien George <damien@micropython.org>
2021-11-29 13:01:51 +11:00
iabdalkader
97a7cc243b lib: Update pico-sdk to 1.3.0 and tinyusb to 0.12.0.
Fixes #8025
2021-11-26 12:05:38 +11:00
Jim Mussared
678f4b959f esp32/boards/GENERIC_S3: Enable BLE on ESP32 S3.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-26 11:58:12 +11:00
gibbonsc
de8dc4bad2 docs/esp8266/tutorial: Fix comments of FrameBuffer examples.
The third and fourth parameters in display.rect() and display.fill_rect()
are not x,y coordinates, but are instead width,height values.  Update the
comment after the example to show the correct x,y coordinates of the bottom
right corner of each rectangle, respectively.
2021-11-25 23:34:19 +11:00
David Michieli
6259aa50eb stm32/boards/NUCLEO_WB55: Update rfcore_firmwre for new WS.
Adds a fix to behavior occuring since WS 1.11 where the FUS returns
misleading statuses during WS upgrade.
2021-11-25 23:28:58 +11:00
Damien George
a0890983ea py/objfun.h: Remove obsolete comments about entries in extra_args.
These two entries were removed in 049a7a8153

Signed-off-by: Damien George <damien@micropython.org>
2021-11-25 23:24:40 +11:00
Jim Mussared
e99f7b6d25 tests/cpydiff: Clarify f-string diffs regarding concatenation.
Concatenation of any literals (including f-strings) should be avoided.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-25 22:09:59 +11:00
Damien George
11ed94797d py/lexer: Support nested [] and {} characters within f-string params.
Signed-off-by: Damien George <damien@micropython.org>
2021-11-25 21:50:58 +11:00
Damien George
196d26848a stm32/usb: Use a table of allowed values to simplify usb_mode get/set.
This reduces code size and code duplication, and fixes `pyb.usb_mode()` so
that it now returns the correct string when in multi-VCP mode (before, it
would return None when in one of these modes).

Signed-off-by: Damien George <damien@micropython.org>
2021-11-25 21:18:17 +11:00
Frédéric Pierson
d49df423e0 stm32/boards/NADHAT_PYBF405: Rename board to GARATRONIC_NADHAT_F405.
To add the manufacturer as a prefix to the board name, for consistency with
other Garatronic boards.
2021-11-25 21:10:43 +11:00
Frédéric Pierson
fdb925c4c1 stm32/boards: Add PYBSTICK26 F411 board definition. 2021-11-25 21:09:57 +11:00
Frédéric Pierson
c422ca3da1 rp2/boards: Add PYBSTICK26 RP2040 board definition. 2021-11-25 21:05:21 +11:00
robert-hh
81f706aee4 mimxrt: Support PWM using the FLEXPWM and QTMR modules.
Frequency range 15Hz/18Hz to > 1 MHz, with decreasing resolution of the
duty cycle.  The basic API is supported as documentated, except that
keyword parameters are accepted for both the instatiaton and the
PWM.init() call.

Extensions: support PWM for channel pairs.  Channel pairs are declared by
supplying 2-element tuples for the pins.  The two channels of a pair must
be the A/B channel of a FLEXPWM module.  These form than a complementary
pair.

Additional supported keyword arguments:

- center=value Defines the center position of a pulse within the pulse
  cycle.  The align keyword is actually shortcut for center.

- sync=True|False: If set to True, the channels will be synchronized to a
  submodule 0 channel, which has already to be enabled.

- align=PWM.MIDDLE | PMW.BEGIN | PWM.END. It defines, whether synchronized
  channels are Center-Aligned or Edge-aligned.  The channels must be either
  complementary a channel pair or a group of synchronized channels.  It may
  as well be applied to a single channel, but withiout any benefit.

- invert= 0..3. Controls ouput inversion of the pins.  Bit 0 controls the
  first pin, bit 1 the second.

- deadtime=time_ns time of complementary channels for delaying the rising
  slope.

- xor=0|1|2 xor causes the output of channel A and B to be xored.  If
  applied to a X channel, it shows the value oif A ^ B.  If applied to an A
  or B channel, both channel show the xored signal for xor=1.  For xor=2,
  the xored signal is split between channels A and B.  See also the
  Reference Manual, chapter about double pulses.  The behavior of xor=2 can
  also be achieved using the center method for locating a pulse within a
  clock period.

The output is enabled for board pins only.

CPU pins may still be used for FLEXPWM, e.g. as sync source, but the signal
will not be routed to the output.  That applies only to FLEXPWM pins.  The
use of QTMR pins which are not board pins will be rejected.

As part of this commit, the _WFE() statement is removed from
ticks_delay_us64() to prevent PWM glitching during calls to sleep().
2021-11-24 13:48:27 +11:00
Damien George
bb7aae557b tools/autobuild: Automatically build all stm32 boards.
Any board with a board.json file will be built.  Additional variants for
certain pyboards will also be built by the explicit build-stm32-extra.sh
script.  Both .dfu and .hex files will be made available.

Also build boards in a sorted order, and don't stop building if a single
board fails.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-22 17:12:16 +11:00
Damien George
90554d03c0 stm32/boards: Build NUCLEO_WB55 and STM32F769DISC without mboot enabled.
This is to make the builds for all nucleo/discovery boards uniform, so they
can be treated the same by the auto build scripts.

The CI script is updated to explicitly enable mboot and packing, to test
these features.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-22 17:12:16 +11:00
Laurens Valk
e2ca8ab8fc py/runtime: Allow types to use both .attr and .locals_dict.
Make it possible to proceed to a regular lookup in locals_dict if the
custom type->attr fails.  This allows type->attr to extend rather than
completely replace the lookup in locals_dict.

This is useful for custom builtin classes that have mostly regular methods
but just a few special attributes/properties.  This way, type->attr needs
to deal with the special cases only and the default lookup will be used for
generic methods.

Signed-off-by: Laurens Valk <laurens@pybricks.com>
2021-11-22 12:10:35 +11:00
Damien George
01ceb9aca3 stm32/dma: Make DMA2_Stream3 exclusive to SDIO when CYW43 enabled.
This prevents SPI4/5 from being used if SDIO and CYW43 are enabled, because
the DMA for the SDIO is used on an IRQ and must be exclusivly available for
use by the SDIO peripheral.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-22 11:57:37 +11:00