Commit Graph

47 Commits

Author SHA1 Message Date
Scott Shawcroft a9dc31a881
Add additional iMX RT support
This adds a script to generate the peripherals files (except clock).

It adds support for the 1015, 1020, 1040, and 1050 EVKs.

Some work was started on 1176 but it isn't working. So, the board
def is in a separate branch.

Fixes #3521. Fixes #2477.
2023-04-28 11:01:13 -07:00
Jeff Epler df916e0484
Merge remote-tracking branch 'origin/main' into mimxrt10xx-rotaryio 2023-03-23 13:02:12 -05:00
Jeff Epler b235b50647
mimxrt: no longer need to collect the pin chainge interrupt ptrs
.. the objects on the gc heap are guaranteed to be alive, as their
finali(s/z)er will disable the interrupt.
2023-03-23 09:58:40 -05:00
Jeff Epler de74b63472
move pin change interrupt stuff to peripherals 2023-03-23 09:28:14 -05:00
Jeff Epler d247e5c6c9
Add the ability for a port to gc things, collect pin change objects that way 2023-03-23 09:16:00 -05:00
Jeff Epler 47e1abdbc7
Add IncrementalEncoder for mimxrt1011
.. and write a general 'pin change interrupt' facility to power it

This uses the same quadrature state machine as atmel-samd, nrf, and
rp2040. The 1011 doesn't have a dedicated encoder peripheral, so we
go the pin-change + software route.
2023-03-23 09:14:58 -05:00
Jeff Epler c6bc9c48c9
mimxrt10xx: implement i2sout
tested on metro m7 (green prototype version) with max98357a i2s amplifier and the following test code:
```py
import board
import time
import digitalio
from audiobusio import I2SOut
from audiocore import RawSample
from microcontroller import pin
from ulab import numpy as np

n = np.array(np.sin(np.linspace(0, np.pi*2, 218, endpoint=False)) * 200, dtype=np.int16)
print(n)
r = RawSample(n, sample_rate=8000, channel_count=2)
def main():
    with digitalio.DigitalInOut(board.LED) as l:
        l.switch_to_output(True)
        value = False
        while True:
            with I2SOut(pin.GPIO_06, pin.GPIO_07, pin.GPIO_04) as i:
                time.sleep(.01)
                l.value = value = not value
                i.play(r, loop=True)
                print(i.playing)
                time.sleep(.5)
                i.stop()
                print("STOPPED")
                print(i.playing)
                time.sleep(.5)
                i.play(r, loop=True)
                print(i.playing)
                print("PLAY AGAIN")
                time.sleep(.5)
            time.sleep(1)
```

Only stereo, 16-bit, raw samples were tested; the sample rate is actually fixed
at 48kHz in the core right now. There is more to do, but the basics work.

# Conflicts:
#	ports/mimxrt10xx/Makefile
#	ports/mimxrt10xx/mpconfigport.mk
2023-03-22 12:15:25 -05:00
Scott Shawcroft 9c3c0555dd
Switch iMX RT sdk to NXP repo
Fixes #7645
2023-03-21 16:21:57 -07:00
Scott Shawcroft 5bb8a7a7c6
Improve iMX RT performance
* Enable dcache for OCRAM where the VM heap lives.
* Add CIRCUITPY_SWO_TRACE for pushing program counters out over the
  SWO pin via the ITM module in the CPU. Exempt some functions from
  instrumentation to reduce traffic and allow inlining.
* Place more functions in ITCM to handle errors using code in RAM-only
  and speed up CP.
* Use SET and CLEAR registers for digitalio. The SDK does read, mask
  and write.
* Switch to 2MiB reserved for CircuitPython code. Up from 1MiB.
* Run USB interrupts during flash erase and write.
* Allow storage writes from CP if the USB drive is disabled.
* Get perf bench tests running on CircuitPython and increase timeouts
  so it works when instrumentation is active.
2023-03-14 12:30:58 -07:00
Jeff Epler b2a08e2cce
use right DBL_TAP_REG when resetting to bootloader
This helps my development scripts work better, and probably also fixes
a problem switching from the circuitpython environment back to arduino.
(specifically, the "1200 baud" serial trick was not rebooting into
the bootloader but was just resetting)
2023-03-03 10:09:31 -06:00
Dan Halbert d8231f1588 Implement safemode.py 2023-02-13 18:26:38 -05:00
RetiredWizard fa514e22b2 mimxrt10xx gpio pins don't deinit
It looks like a rogue "return" made it's way into the reset pin code
for the mimxrt10xx port resulting in pin.deinit() not working.
2023-01-05 19:17:08 -05:00
Dan Halbert b90a6413c2 refactor to reduce duplicate code 2022-12-15 13:17:28 -05:00
Dan Halbert 5c569f03c2 redo pin never resetting for mimxrt10xx 2022-12-14 19:34:26 -05:00
Scott Shawcroft 9d10a3da66
Conditionalize LTO 2022-05-27 12:59:54 -07:00
Dan Halbert a01dec1df9 message consolidation and more use of validators 2022-05-19 15:38:37 -04:00
mjs513 208bfb33aa Deleted Warnings Chanaged ValueError Method 2022-04-17 15:04:16 -04:00
mjs513 0b6c451fdf Add Overclocking Warnings to Processor.c 2022-04-16 11:01:50 -04:00
mjs513 fd41c1ac5b Update based on PR Comments 2022-04-14 06:45:16 -04:00
root 716497c132 corrected pre-commit errors 2022-04-13 12:04:28 -04:00
root 60e330fb0d Added Settable Clock for MIMXRT BOARDS 2022-04-13 09:47:55 -04:00
Scott Shawcroft 83593a1558
Start of USB host API
This allows you to list and explore connected USB devices. It
only stubs out the methods to communicate to endpoints. That will
come in a follow up once TinyUSB has it. (It's in progress.)

Related to #5986
2022-03-07 18:07:25 -08:00
Jeff Epler 59cb8e91b2
mimxrt1011: enable -Werror=missing-prototypes 2021-11-12 19:30:47 -06:00
Scott Shawcroft 1a0b4193b7
Simplify the status LED to save power
This also removes the need to pin share because we don't use the
status LED while user code is running.

The status flashes fallback to the HW_STATUS LED if no RGB LED is
present. Each status has a unique blink pattern as well.

One caveat is the REPL state. In order to not pin share, we set the
RGB color once. PWM and single color will be shutoff immediately but
DotStars and NeoPixels will hold the color until the user overrides
it.

Fixes #4133
2021-05-13 14:41:20 -07:00
Jeff Epler 06743d91ed mimxrt1011: Fix reset-to-bootloader
The definition of DBL_TAP_REG must match tinyuf2
2021-03-19 10:11:45 -05:00
microDev a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
microDev dc332baa87
update common_hal_reset_pin() 2020-12-28 20:04:00 +05:30
Dan Halbert 8b7c23c1ee address review comments 2020-12-01 20:01:14 -05:00
Dan Halbert 104a089677 deep sleep working; deep sleep delay when connected 2020-11-26 22:06:37 -05:00
Dan Halbert a0f1ec3c4a wip 2020-11-22 19:10:09 -05:00
Dan Halbert 75559f35cc wip: ResetReason to microcontroller.cpu 2020-11-21 23:29:52 -05:00
microDev 930cf14dce
Add check for invalid io, function to disable all alarms 2020-10-27 16:17:26 -07:00
microDev e35938971a
Add description of alarm modules 2020-10-27 16:16:55 -07:00
Diego Elio Pettenò dd5d7c86d2 Fix up end of file and trailing whitespace.
This can be enforced by pre-commit, but correct it separately to make it easier to review.
2020-06-03 10:56:35 +01:00
Lucian Copeland 53fb699436 Add pin resetting across boards, fix array size detection issue 2020-05-27 11:45:15 -04:00
Scott Shawcroft 0af5dd59f2
Merge pull request #2898 from hierophect/mimxrt-claiming
MIMXRT: Implement pin claiming, pin reset, and pin protections
2020-05-20 11:32:22 -07:00
Lucian Copeland 38fd9c25f2 Re-add APA102 2020-05-19 15:33:34 -04:00
Lucian Copeland b310b04007 Remove pin/port distinction 2020-05-19 14:20:07 -04:00
Lucian Copeland 2acd173e14 Implement core requested changes 2020-05-19 13:54:47 -04:00
arturo182 058a73128c mimxrt10xx: Fix cpu.temperature crash
Fixes #2514
2020-05-18 22:30:50 +02:00
Lucian Copeland 99538c2414 Implement pin claiming, pin reset, and pin protections 2020-05-15 15:16:51 -04:00
arturo182 feac87901a mimxrt10xx: Enable displayio
Closes #2466
2020-02-19 22:26:00 +01:00
Dave Marples 77ad9aff3c Formatting updates 2020-02-16 00:40:04 +00:00
Dave Marples d13f04f953 Updated formatting 2020-02-14 23:02:02 +00:00
Dave Marples 4de2a1eb62 Fix alignment warning 2020-02-12 22:36:34 +00:00
Scott Shawcroft 7d8dac9211
Refine iMX RT memory layout and add three boards
Introduces a way to place CircuitPython code and data into
tightly coupled memory (TCM) which is accessible by the CPU in a
single cycle. It also frees up room in the corresponding cache for
intermittent data. Loading from external flash is slow!

The data cache is also now enabled.

Adds support for the iMX RT 1021 chip. Adds three new boards:
* iMX RT 1020 EVK
* iMX RT 1060 EVK
* Teensy 4.0

Related to #2492, #2472 and #2477. Fixes #2475.
2020-01-17 17:36:08 -08:00
arturo182 13e0cba6f1 Add initial MIMXRT10XX port 2020-01-06 21:08:49 +01:00