Wykres commitów

90 Commity (master)

Autor SHA1 Wiadomość Data
robert-hh 5ca56aaf16 mimxrt: Tidy up the board flash related files.
- Move the qspi_xxxx_flash_config.c files to hal.
  It turned out that they are less board than flash type specific.
- Change to a common flexspi_flash_config.h header file.
2021-12-14 20:31:20 +01:00
robert-hh 64aa0bcb88 mimxrt: Enable ticks_cpu at boot time for NDEBUG builds only.
Otherwise, it get's in trouble with a Debugger. Reason to be found.
Also: Increase code segment to 2 MB for the MIMXRT1050_EVK build.
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
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
robert-hh 7cc9b257a9 mimxrt/boards: Update the board.json files and add deploy_xx.md files.
- Add board.md files for MIMXRT1060_EVK and MIMXRT1064_EVK warning about
  their experimental state.
- Add separate deploy_teensy.md and deploy_mimxrt.md files.
2021-11-16 23:17:42 +11:00
robert-hh d72d699dad mimxrt/boards: Add the Seeed ARCH MIX board.
The ARCH MIX board exposes the Ethernet Pins at it's connectors.  Therefore
the software is configured for using a LAN8720 PHY device.  Breakout boards
with the LAN8720 are easily available.
2021-11-16 23:11:21 +11:00
Mike Causer 7f14344428 ports: Add images, features and urls to board.json. 2021-10-28 15:25:38 +11:00
Jim Mussared e359b077dd ports: Add board.json for all boards.
This will be used by https://micropython.org/download/ to generate the
full listing of boards and firmware files.

Optionally supports a board.md for additional customisation of the
download page, as well as deploy.md for flashing instructions.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-27 14:04:53 +11:00
robert-hh 4f89c38a6a mimxrt: Optimize the runtime speed.
By moving code to ITCM, like vm, gc, parse, runtime.  The change affects
mostly the execution speed of MicroPython code.  The speed is increased by
up to a factor of 6, especially for MCU with small cache.
2021-10-25 23:54:47 +11:00
robert-hh 90b45efa6a mimxrt/boards/make-pins.py: Allow empty lines and comments in pins.csv. 2021-10-25 23:53:51 +11:00
robert-hh e7572776c3 mimxrt: Add dht_readinto() to the mimxrt module, and freeze dht.py.
The change affects dht.py from the drivers directory as well to include the
logic for the mimxrt port.
2021-10-25 23:49:28 +11:00
robert-hh 68146aa197 mimxrt/boards: Fix the D14/D15 pin assignment of MIMXRT1050/60/64_EVK.
There are several PCB layouts in the market under the same name.
2021-10-25 15:50:38 +11:00
robert-hh 1866ed7e2e mimxrt/eth: Add LAN support and integrate the network module.
This commit implements 10/100 Mbit Ethernet support in the mimxrt port.

The following boards are configured without ETH network:
- MIMXRT1010_EVK
- Teensy 4.0

The following boards are configured with ETH network:
- MIMXRT1020_EVK
- MIMXRT1050_EVK
- MIMXRT1060_EVK
- MIMXRT1064_EVK
- Teensy 4.1

Ethernet support tested with TEENSY 4.1, MIMRTX1020_EVK and MIMXRT1050_EVK.
Build tested with Teensy 4.0 and MIMXRT1010_EVK to be still working.
Compiles and builds properly for MIMXRT1060_EVK and MIMXRT1064_EVK, but not
tested lacking suitable boards.

Tested functions are:
- ping works bothway
- simple UDP transfer works bothway
- ntptime works
- the ftp server works
- secure socker works
- telnet and webrepl works

The MAC address is 0x02 plus 5 bytes from the manifacturing info field,
which can be considered as unique per device.

Some boards do not wire the RESET and INT pin of the PHY transceiver.  For
operation, these are not required.  If they are defined, they will be used.
2021-10-25 15:14:26 +11:00
Philipp Ebensberger 7e62c9707a mimxrt/sdram: Add SDRAM support.
Adds support for SDRAM via `SEMC` peripheral. SDRAM support can be
enabled in the mpconfigboard.mk file by setting `MICROPY_HW_SDRAM_AVAIL`
to `1` and poviding the size of the RAM via `MICROPY_HW_FLASH_SIZE`.

When SDRAM support is enabled the whole SDRAM is currently used used
for MicroPython heap.

Signed-off-by: Philipp Ebensberger
2021-10-22 08:23:24 +02:00
Philipp Ebensberger 0d7366c912 mimxrt: Rework flash configuration.
- Moves definition of BOARD_FLASH_SIZE and other header files related to
	flash configuration into the Makefile.
- Adds board specific clock_config.h.
- Adds board.h, pin_mux.h, and peripherals.h as they are
	required by NXP MCU SDK in order to use our own clock_config.h.
- Renames board specific FlexSPI configuration files.
- Updates flash frequency of MIMXRT1020_EVK
- Creates separated flash_config files for QSPI NOR and
	QSPI Hyper flash.
- Unifies VFS start address to be @ 1M for 1010 and 1020 boards.
- Unifies 1050EVK boards
- Adds support to both NOR and HyperFlash on boards with
	both capabilities.
- Adds automatic FlexRAM initialization to start-up code based on
	linker script and NXP HAL.
- Applies code formatting to all files in mimxrt port.

With this change the flash configuration is restructured and
organized. This simplifies the configuration process and
provides a better overview of each board's settings. With the integration
of clock_config.h, board.h, pin_mux.h, and peripherals.h we gain better
control of the settings and clock configurations. Furthermore the
implementation of an explicit FlexRAM setup improves the system
performance and allows for performance tuning.

Signed-off-by: Philipp Ebensberger
2021-09-14 13:52:52 +02:00
Philipp Ebensberger 87f97e490c mimxrt/sdcard: Implement SDCard driver.
- Configures `PLL2->PFD0` with **198MHz** as base clock of
	`USDHCx` peripheral.
- Adds guards for SDCard related files via `MICROPY_PY_MACHINE_SDCARD`
- Adds creation of pin defines for SDCard to make-pins.py
- Adds new configuration option for SDCard peripheral pinout
        to mpconfigport.h
- Adds interrupt handling support instead of polling
- Adds support for `ADMA2` powered data transfer
- Configures SDCard to run in HS (high-speed mode) with **50MHz** only!

SDCard support is optional and requires `USDHC` peripheral.
Thus this driver is not available on `MIMXRT1010_EVK`.
SDCard support is enabled by setting `MICROPY_PY_MACHINE_SDCARD = 1`
in mpconfigboard.mk.

Signed-off-by: Philipp Ebensberger
2021-09-07 20:45:33 +02:00
robert-hh b2533fe479 mimxrt/boards: Add support for the MIMXRT1050_EVKB board. 2021-07-31 16:26:39 +10:00
robert-hh 1074c784b0 mimxrt: Add support for Hyperflash chips.
Hyperflash is used by the MIMXRT1050_EVKB, MIMXRT1060_EVK and
MIMXRT1064_EVK boards.

This commit includes:
- add support for Hyperflash
- modify MIMXRT1060_EVK and MIMXRT1064_EVK to change from QSPI to
  hyperflash.
- minor incidental changes to other boards so they still build

Note: Erasing a sector on the hyperflash is slow. It takes about a second,
which seems too long, but matches the data sheet.
2021-07-31 16:25:40 +10:00
robert-hh 98c5703027 mimxrt/machine_i2c: Add hardware-based machine.I2C to machine module.
It uses non-blocking transfer of data.  Advantage over SoftI2C:
- Higher data rate up to ~3 MHZ.
- Full protocol support.
2021-07-15 00:36:31 +10:00
robert-hh b35566af79 mimxrt/boards: Set vfs partition start to 1 MBbyte.
This avoids the irritation of the PJRC HalfKay loader on Teensy 4.0.  Block
0 and 1 are properly erased and the additional formatting in the make
script is not required anymore.
2021-06-26 22:27:02 +10:00
robert-hh f45412793e mimxrt/machine_spi: Add the SPI class to the machine module.
This class supports SPI bus controller mode, with blocking transfers.

SPI device numbers start at 0, to comply with the pinout of the Teensy
boards.  With the configured clock frequency the fastest baud rate is
33MHz.  For messages longer 16 bytes DMA is used.  The class uses the
existing framework with extmod/machine_spi.c.

Extended driver options:

- drive=n with n being between 1 and 6 or PIN.POWER_1 to PIN.POWER_6.
  Since the pins used by the SPI are fixed, no Pin settings can be made.
  Thus the drive option is added allowing to control ringing and crosstalk
  on the connection.

- gap_ns=nnnnn is the time between sent data items in a frame given in ns.
  Default is 2 clock cycles.
2021-06-26 22:14:47 +10:00
robert-hh 7417c6ac91 mimxrt/machine_pin: Implement pin.irq() functionality. 2021-06-16 01:42:10 +10:00
robert-hh 689476c576 mimxrt/machine_uart: Add the UART class to the machine module.
The implementation uses the LPUARTx devices.  Up to 8 UARTs can be used,
given that the pins are accessible.  E.g. 8 on Teensy 4.1, 5 on
MIMXRT1020_EVK.

For Tennsy 4.0 and 4.1 the UART numbers are as printed on the pinout 1..N.
The MIMXRT10xx-EVK boards have only one UART named, which gets the number
1.  All other UART are assigned to different Pins:

MIMXRT1010-EVK:
    D0/D1   UART 1
    D6/D7   UART 2
    A0/D4   UART 3

MIMXRT1020-EVK:
    D0/D1   UART 1
    D6/D9   UART 2
    D10/D12 UART 3
    D14/D15 UART 4
    A0/A1   UART 5

MIMXRT1050-EVK, MIMXRT1060-EVK, MIMXRT1064-EVK:
    D0/D1   UART 1
    D7/D6   UART 2
    D8/D9   UART 3
    A1/A0   UART 4
2021-06-16 01:21:15 +10:00
robert-hh 53fea8598e mimxrt/boards: Add board configuration files for Teensy 4.1.
These are at the moment more or less identical to the Teensy 4.0 files,
except for the pins.csv file and the flash size.
2021-06-04 01:00:39 +10:00
Philipp Ebensberger b8c65b174f mimxrt/machine_adc: Add the ADC class to the machine module.
This adds the machine.ADC class with the read_u16() method.  make-pins.py
and supporting files are updated to generate ADC information.
2021-06-04 00:51:58 +10:00
robert-hh bbdc98f72e mimxrt: Enable many Python and some extmod features.
Besides Python features this includes the extmod modules which make use of
the Pin module, especially machine.softSPI, machine.SoftI2C and onewire.
2021-06-04 00:38:18 +10:00
robert-hh a40e1473dc mimxrt: Add floating point support.
Since not all boards support double fp, all board specific .mk files are
affected too.
2021-06-04 00:37:22 +10:00
robert-hh 745b4319a2 mimxrt/boards/TEENSY40: Re-create the flash FS after deploy.
This is required since the Teensy Halfkay loader attempts to erase all of
the flash but fails to do so, at least in my tests.  Formatting brings it
back to a known state.
2021-06-01 23:52:45 +10:00
robert-hh dfd4324eb1 mimxrt: Add flash storage support with VFS and littlefs filesystem.
This commit adds full support for a filesystem on all boards, with a block
device object mimxrt.Flash() and uos.VfsLfs2 enabled.

Main changes are:
- Refactoring of linker scripts to accomodate reserved area for VFS.  VFS
  will take up most of the available flash. 1M is reserved for code.  9K is
  reserved for flash configuration, interrupts, etc.
- Addition of _boot.py with filesystem init code, called from main.c.
- Definition of the mimxrt module with a Flash class in modmimxrt.[ch].
- Implementation of a flash driver class in mimxrt_flash.c.  All flashing
  related functions are stored in ITCM RAM.
- Addition of the uos module with filesystem functions.
- Implementation of uos.urandom() for the sake of completeness of the uos
  module.

It uses sample code from CircuitPython supplied under MIT license, which
uses the NXP SDK example code.

Done in collaboration with Philipp Ebensberger aka @alphaFred who
contributed the essential part to enable writing to flash while code is
executing, among other things.
2021-06-01 23:42:57 +10:00
robert-hh c303b15f10 mimxrt: Enable frozen modules. 2021-06-01 22:57:09 +10:00
Philipp Ebensberger ff5d39529c mimxrt: Implement machine.Pin class.
- modified pin type from pin_obj_t to machine_pin_obj_t
- created machine_pin.c
- implemented basic version of make-pins.py to genertate pins.c/.h files
  automatically; the only alternate function currently supported is GPIO
- added af.csv files for all supported MCUs
- replaced pins.c/pins.h files with pin.csv for all boards
- implemented on/off/high/low/value/init methods
- Implemented IN/OUT/OPEN_DRAIN modes
- modified LDFLAGS for DEBUG build to get usefull .elf file for debugging

Signed-off-by: Philipp Ebensberger
2021-05-26 00:12:42 +10:00
svetelna 23ce25a7c3 mimxrt/boards: Add MIMXRT1050_EVK board, based on MIMXRT1060_EVK. 2021-03-11 16:42:38 +11:00
Albort Xue 5f50568b1f mimxrt/boards: Add MIMXRT1064_EVK board. 2020-09-09 00:06:33 +10:00
Albort Xue 05e5d411b5 mimxrt/boards: Set __heap_size__ to 0 in MIMXRT1011.ld.
Do not use the traditional C heap in order to save memory, because the
traditional C heap is unused in MicroPython.
2020-06-10 22:49:26 +10:00
Philipp Ebensberger 29e258611a mimxrt/boards: Integrate support for MIMXRT1020_EVK board. 2020-06-09 19:04:23 +10:00
Albort Xue e0d539f79d mimxrt/boards: Enable LED class for MIMXRT1060_EVK board. 2020-06-09 18:51:08 +10:00
Philipp Ebensberger 02cc4462b7 mimxrt: Add initial impl of machine.LED class, and basic pin support.
This commit implements an LED class with rudimentary parts of a pin C API
to support it.  The LED class does not yet support setting an intensity.

This LED class is put in the machine module for the time being, until a
better place is found.

One LED is supported on TEENSY40 and MIMXRT1010_EVK boards.
2020-06-05 11:47:48 +10:00
Albort Xue b3bc9808f2 mimxrt/boards: Add MIMXRT1060_EVK board. 2020-05-27 16:49:52 +10:00
Jim Mussared 7eea0d8b6c mimxrt: Add MIMXRT1010 board. 2020-03-11 15:36:27 +11:00
Jim Mussared f46782dde9 mimxrt: Add new, minimal port to NXP i.MX RT series CPUs.
This is an extremely minimal port to the NXP i.MX RT, in the style of the
SAMD port  It's largely based on the TinyUSB mimxrt implementation, using
the NXP SDK.  It currently supports the Teensy 4.0 board with a REPL over
the USB-VCP interface.

This commit also adds the NXP SDK submodule (also from TinyUSB) to
lib/nxp_driver.

Note: if you already have the tinyusb submodule initialized recursively you
will need to run the following as the tinyusb sub-submodules have been
rearranged (upstream):

    git submodule deinit lib/tinyusb
    rm -rf .git/modules/lib/tinyusb
    git submodule update --init lib/tinyusb
2020-03-11 15:34:13 +11:00