Convert the mimxrt port from the old `MICROPY_EVENT_POLL_HOOK` macro to use
the new `mp_event_wait_xxx()` functions in conjunction with
`MICROPY_INTERNAL_WFE`.
This change should be functionally equivalent to the existing behaivour
because `mp_event_wait_ms()` and `mp_event_wait_indefinite()` are equal to
`mp_handle_pending(MP_HANDLE_PENDING_CALLBACKS_AND_EXCEPTIONS); __WFE()`,
which is what `MICROPY_EVENT_POLL_HOOK` was.
Signed-off-by: Damien George <damien@micropython.org>
These classes are based on the Quadrature Encoder blocks of the i.MXRT
MCUs. The i.MXRT 102x has two encoders, the other ones four. The i.MXRT
101x does not support this function. It is implemented as two classes,
Encoder and Counter.
The number of pins that can be uses as inputs is limited by the MCU
architecture and the board schematics. The Encoder class supports:
- Defining the module.
- Defining the input pins.
- Defining a pin for an index signal.
- Defining a pin for a reset signal.
- Defining an output pin showing the compare match signal.
- Setting the number of cycles per revolution (min/max).
- Setting the initial value for the position.
- Setting the counting direction.
- Setting a glitch filter.
- Defining callbacks for getting to a specific position, overrun and
underrun (starting the next revolution). These callbacks can be hard
interrupts to ensure short latency.
The encoder counts all phases of a cycle. The span for the position is
2**32, for the revolution is 2**16. The highest input frequency is
CPU-Clock/24. Note that the "phases" argument is emulated at the API
level (the hardware will always count all phases).
The Counter mode counts single pulses on input A of the Encoder. The
configuration supports:
- Defining the module.
- Defining the input pin.
- Defining the counting direction, either fixed or controlled by the level
of an input pin.
- Defining a pin for an index signal.
- Defining an output pin showing the compare match signal.
- Setting the counter value.
- Setting the glitch filter.
- Defining a callback which is called at a certain value.
- Settings for MIMXRT1015. The MIMXRT1015 MCU has only one encoder/counter
unit.
The counting range is 0 - 2**32-1 and a 16 bit overrun counter. The
highest input frequency is CPU-Clock/12.
The implementation of the `.irq()` method uses the common code from
`shared/runtime/mpirq.c`, including the `irq().flags()` and
`irq().trigger()` methods.
Signed-off-by: robert-hh <robert@hammelrath.com>
In c57aebf790 `mp_handle_pending()` became a
static-inline function. So these declarations in `mpconfigport.h` are
incorrect and removed by this commit.
Signed-off-by: Damien George <damien@micropython.org>
With this change, can simply add `LD_FILES` to a board's `mpconfigboard.mk`
to change the linker scripts, such as to change the section sizes, or
change the contents for each region. Example usage:
LD_FILES = $(BOARD_DIR)/my_board.ld boards/common.ld
Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
This commit adds PSRAM support for Teensy 4.1 and other mimxrt boards.
It's enabled by default for Teensy 4.1.
This implementation is based on the Teensy Arduino core PSRAM code, and
Paul Stoffregen has agreed for it to be published here under the MIT
license, see https://github.com/micropython/micropython/pull/18288#issuecomment-3806784632
This addresses issue #18281.
Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
This adds support for the ALT11 alternate function mode on MIMXRT1176
MCUs, enabling FLEXPWM channels on GPIO_AD pins that were previously
unavailable for PWM use.
Changes:
- Add PIN_AF_MODE_ALT11 enum to pin.h
- Add ALT11 column to MIMXRT1176_af.csv with FLEXPWM mappings
- Enables FLEXPWM1-4 on GPIO_AD_06 through GPIO_AD_21
This change only affects MIMXRT1176-based boards (MIMXRT1170_EVK and
PHYBOARD_RT1170). Other MIMXRT family chips use alternate function
modes ALT0-ALT9 and are not affected.
Tested on MIMXRT1176 hardware with PWM output on GPIO_AD_14
(FLEXPWM3_PWM0_X).
Signed-off-by: Algy Tynan <algy@tynan.io>
The rt117x uses the LPADC peripheral which supports both A-side and B-side
channel inputs, e.g. ADC1_CH1A and ADC1_CH1B.
Previously, only `kLPADC_SampleChannelSingleEndSideA` was being used during
capture, while the pin may be in side B. The fix in this commit detects
the side based on the pin configuration and sets `sampleChannelMode`
appropriately.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
The default size for the ROM partition is 256k, and it is placed in flash
between the text and writable vfs sections. Its size can be changed in
`mpconfigboard.mk` by defining `MICROPY_HW_ROMFS_BYTES` to a different
value, but it must not be smaller than a single sector.
The MIMXRT1170_EVK and SEEED ARCH MIX ROMFS boards use a larger size of
512kB. ROMFS support is disabled for MIMXRT1050_EVKB due to issues with
Hyperflash.
The extents of the ROM partition are defined by the linker-level symbols
`_micropy_hw_romfs_part0_start` and `_micropy_hw_romfs_part0_size`,
following existing ports.
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: robert-hh <robert@hammelrath.com>
These were regenerated by the NXP Config tool for v2.11.
The board_init update was needed to ensure CLOCK_SetMode() is run
at the appropriate time during startup.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
The official mcux-sdk follows a slightly different structure to the
current nxp_sdk submodule, with many drivers moved to a common location.
To ease updating the newer versions of the SDK and/or add new families
the nxp_sdk submodule has been updated to follow the structure of
mcux-sdk, just trimmed down to families used here to considerably
reduce the size.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
The functionality is similar to the RP2 implementation. The supported
address size is 7 bit. In order to achieve a sufficient response, the
target I2C IRQ handler has to run from RAM, causing much more code moved to
RAM than required.
Tested with Teensy 4.1, MIMXRT1021EVK, MIMXRT1011EVK and MIMXRT1170, using
both a On-Board SoftI2C as controller and a RP2 Pico as external
controller.
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: robert-hh <robert@hammelrath.com>
The vendor and product fields in the `board.json` files were somewhat
inconsistent. Remove any duplication of the vendor name in the product
field so that `f"{vendor} {product}"` reads well.
In addition to that, update most of the URL's for `board.json` files that
are modified here, and match case and spacing used by the manufacturers for
the vendor and product names.
Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
This is a board based on the i.MX RT1011 in breadboard-friendly shape. A
good basic board with 16M flash and regular pinout, providing access to
many GPIO_nn and GPIO_AD_nn Pins.
Signed-off-by: robert-hh <robert@hammelrath.com>
This commit upgrades from codespell==2.2.6 to the current codespell==2.4.1,
adding emac to the ignore-words-list.
Signed-off-by: Christian Clauss <cclauss@me.com>
It was set to 133Mhz, but that is not stable. Reduce to 100MHz.
The UF2 bootloader runs at 100MHz, so no need for a change of the
bootloader.
Signed-off-by: robert-hh <robert@hammelrath.com>
And use these to initialize the LUT table properly for the various flash
types. The different flash types differ by 3 parameters. Thus it is
easier to just keep one copy of the qspiflash_config structure with the LUT
table and update it during flash initialisation as needed.
Signed-off-by: robert-hh <robert@hammelrath.com>
Allowing to use e.g. the Adafruit bootloaders with MicroPython. The .uf2
file is created in addition to the .bin and .hex files allowing to use the
latter ones without the bootloader for debugging and testing.
Changes:
- Set the location of the ISR Vector and .text segment to 0x6000C000 and
0x6000C400.
- Reserve an area at the start of ITCM for a copy of the interrupt vector
table and copy the table on reset to this place.
- Extend `machine.bootloader()` by setting the magic number to enable the
bootloader on reset.
- Create a .uf2 file which skips the segments below 0x6000C000.
The bootloader has to be installed as a preparation step using the board
specific methods, but then the firmware's .uf2 file version can be
installed using the bootloader. The bootloader can be invoked with:
- double reset
- calling machine.bootloader()
- Using the touch1200 method
Double reset is hard to achieve on MIMXRT boards, since there is no clean
reset pin. Some MIMXRT boards provide it by switching the power.
Some boards are excluded from the .uf2 build:
- MIMXRT1050_EVK: The uf2 bootloader is built for the QSPI version of the
board. MicroPython supports the Hyperflash version.
- MIMXRT1176_EVK: No support for this board yet, but it should be possible.
Signed-off-by: robert-hh <robert@hammelrath.com>
In CMSIS 5.9.0, the compiler headers define `__VECTOR_TABLE`, which will be
substituted with its corresponding value (e.g., `__Vectors` for gcc).
However, the linker script in this port can't include compiler headers when
it's processed, so `__VECTOR_TABLE` is used as the literal variable name,
which results in an undefined linker error.
To fix this, the two possible values of `__VECTOR_TABLE` are both defined
in the linker script.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Minor change to remove support for using numeric IDs for machine.Pin. This
was previously based on the index of the pin in the board csv, but this is
different (and incompatible) with other ports.
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>
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>
Commit 552b0bbe12 did not define
MICROPY_PY_MACHINE_SDCARD properly, and thus building the firmware failed.
Signed-off-by: robert-hh <robert@hammelrath.com>
There is a single UART clock for all devices, so switching it for one will
affect all devices used at that time. This commit fixes that issue by
keeping the clock at a fixed value.
This fixed clock still supports the common baud rates between 300 and
921600 baud.
Signed-off-by: robert-hh <robert@hammelrath.com>
This is option is no longer needed as a Makefile option as the USDHC driver
is enabled for all supported series.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
At the Adafruit Metro M7 the pin GPIO_AD_13 is used for JTAG. Therefore
it is not configured for RTS at UART 2 and 3.
Signed-off-by: robert-hh <robert@hammelrath.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>
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>