NXP MCUExpresso with Teensy4.1 boot and load

Steve_AU

Active member
Guys,
I have been away from this forum for a year or so because I wanted to do a deep dive on the MIMXRT1062. As a hobbyist, time is the main problem; however, I have realised that the insights I needed were not reasonable to ask of this forum (way too detailed for any quick reply, and I had way too much to learn even to be able to talk about it). The Arduino framework was the go-to thing for me at the start; however, I wanted to operate at a lower level. I purchased a BOARD EVM from NXP and downloaded the MCUExpresso IDE and configuration tools and started typing. The 3500-page Reference Manual is the core of all insight; however, it is primarily declarative, not truly instructive until one has reached a certain threshold of learning. Claude Sonnet 5 has helped there an amazing amount. It can provide semantic insight into the "why" of NXP's thinking and guide you to the relevant manual chapters on "how". There is deep-dive detail in the CCM, the pad assignments under IOMUXC macros, the daisy-chain registers, the crossbar (XBAR) connectivity, and, in each case, the peripheral configurations which I have handled using both CMSIS functions and the peripheral wizard on MCUExpresso. Much of this detail is hidden from you in the Arduino environment, and this is a great thing, because it removes a significant barrier to entry for the XRT1062. However, to truly get to grips with the processor, I used Claude to validate concepts and logic against the reference manual and other publicly available resources. The biggest leap was understanding the IOMUXC/DaisyChain/XBAR trail, the startup and linker memory files, and the relationship between IDTC and DTC RAM types, DMA cache coherency, understanding the cache and cache flushing macros _ISB(), _DSB() and a host of other details too vast to mention here. The first real test was to (manually) configure the Quadrature encoders ENC1 or QDC1 (PHASE_A, PHASE_B, INDEX, TRIGGER) to reach the external pins. Once I had understood the steps, I could use the CMSIS functions with more comfort. One of the first decisions was to move away from the BOARD EVM and go back to the Teensy 4.1 to use the TeensyLoader.exe to boot up Teensy with code supplied by the MCUExpresso IDE. There is a simple post-link copy that produces a Teensy-loadable HEX file that runs every compile. Turnaround times under this "incremental compile and press the white button" sequence are less than 30 seconds. However, Claude admonished me not to expect Teensy4.1 to be exactly as performant as BOARD EVM projects, citing the HID and XIP via SPI protocols not necessarily being compliant, and noting that the characteristics of the Winbond flash may differ between BOARD1060 EVM and how the Teensy 4.1 behaves at boot and load compared with BOARD EVM. Does this make sense? Has anybody else gone down this path besides me who might be able to point out any issues with this approach? Is there a gotcha waiting for me? Stevo
 
Has anybody else gone down this path

I did... in 2018 before Claude or other LLMs existed, before NXP published the SDK code and MCUexpresso tools, using a pre-release reference manual (under NDA) riddled with errors and copypasta from their IMX6 chips.

First RT1052-based beta test started in December 2018, with fully functional (but slower) bootloader. We started testing RT1062 in summer of 2019 and released Teensy 4.0 in September.


Is there a gotcha waiting for me?

Yes, many.

But now you have lots of example code from Teensy and NXP's SDK and the rev 3 & 4 reference manual. Not nearly as hard as it was back in 2018 going "first" before anyone else outside NXP had used the chip.


Claude admonished me not to expect Teensy4.1 to be exactly as performant as BOARD EVM projects .... Does this make sense?

No, not really.

But you can theoretically run larger programs on those eval boards because they have external memory which Teensy 4.1 lacks.
 
Last edited:
Thanks so much, Paul Stoffregen (and others). You truly had your work cut out for you back then. These chips are a far cry from my old world with Z80, 6809 and 8051 classes of controllers. I can only offer "respect!!"

The 3500-page RM is pretty hard going, and now that I know a little bit more, it is actually (almost!) readable. If I had continued to ask all my noob questions here (which I started to do), I would have been even more of a pain in the backside for you. :D Anyway, I uncovered a whole bunch of insight that makes the RT1062 even more of a beast of a chip than I suspected.

There is simply a struggle to learn that has to be faced, and there are no short-cuts.

I started with the MCUExpresso and felt fairly comfortable at first because I had previously attacked the STM32 stuff using their version of the
Eclipse IDE. Alas, not so fast!! It has taken a year (part-time, of course) to get anywhere with the iMXRT1062, then Claude came along.

Using Claude is almost like cheating. I don't get it to write my code, but I ask it detailed questions that originally flummoxed Copilot, ChatGPT, and Gemini free versions. I asked Claude similar stuff, and I got back so much useful material that I forked out for a paid subscription to Sonnet 5.

Since 2024, I have purchased 35 Teensy 4.1's and 6 Teensy 4.0's (before SparkFun took over) because I couldn't believe how fairly priced they were.

The only STM32 equivalents would probably be the H series. Thanks again, Paul, for your reply. I can understand now just how much effort has gone into the Arduino code package. I take none of that for granted, as it's the first step toward getting acquainted with a remarkable chip, and I don't know how else ordinary people would be able to do it.

Paragraphs added for clarity.

Steve
 
Back
Top