NXP Documentation error?

Adlibber

Member
I am an enthusiastic newcomer to the complexities of modern 32-bit microcontroller technology. What better way to understand this new world than try and follow Paul Stoffregen's Teensy 4.0 Bare-metal Example code. Thank you Paul.

Eventually everything was becoming clear apart from one cloudy bit: the location of the Boot Image FlexSPI NOR configuration parameters.

According tp page 216 of NXP's i.MX RT1060 Processor Reference Manual, rev 2/2019: "The ROM expects the 512-byte FlexiSPI NOR configuration parameters block to be present at offset 0x400 in serial NOR flash attached to FLEXSPI_A_SS0_B".

Now I've read somewhere else that this could should be at a zero offset and indeed this is how Paul does it in his example.

Am I being rather stupid or is the manual incorrect?
 
The sad reality is many more minor errors are lurking in those 3437 pages. Some of them confused me for many hours too!
 
I'd just like to say to you, Paul, thank you very much for getting me on the way with the complexities of the bare metal coding of your blink app. I couldn't get your cli loader to work on my iMac Big Sur system but that turned out to be down to me not understanding something in the make file. After making some trivial adjustments it just worked. My next venture is to gradually code all this in assembler.

Is it possible for me, living in UK, to purchase directly from you?

Once again a big, big thank you for all the work you do, including your philosophy of KISS, otherwise knows as Occam's Razor.
 
It is possible but shipping charges are silly. Not Paul's fault but USPS. Better to buy from Paul's UK distributors.
 
I said UK distributors. Amazon is not a PJRC distributor.
UK distributors are:-

Cool Components, HobbyTronics, Oak Tree LLC, PiHut and Pimoroni.

They are listed here.

Oops sorry, I see that Oak Tree LLC is selling through Amazon, but check the prices I think you will see that it is buyer that is being shafted.
Prices for a T3.2 and LC are:-

..............................T3.2....... LC
Cool Components ...£19.99.. £11.39
HobbyTronics ........ £19.20.. £11.94
Oak Tree LLC......... £20.29.. £17.59(LC with pins)
PiHut.................... £18.00.. £11.00 both with header pins (not soldered)
Pimoroni............... £18.00.. £11.40

As you can see PiHut has the best prices and supplies free (not soldered) header pins.
But also bear in mind Oak Tree LLC has free shipping, though this may not be next day. I have used a number of these suppliers and most of them do 24hr Royal mail.

The best price used to be buying Teensy from OSHPark. But they are unable to do that at the moment. Shipping from them was only $1.
 
Last edited:
Just completed a main.S for the blink programme. Blown away by the performance of this little machine (Teensy 4.1). The Assembler version is four times faster than the C code: the uncalibrated delay loop requires 100,000,000 cycles to achieve a delay of approximately half a second. Thats about three clocks a loop!

But how any beginner could have got to this stage without all the demo code available is beyond me. Understanding the i.MX RT1060 manual is not a logical statement.
 
Is it possible for me, living in UK, to purchase directly from you?

Sadly, PJRC can no longer ship small orders to the UK. Well, not unless you have a VAT ID number.

The UK recently added a new requirement for VAT collection before shipping. Large companies like Amazon are doing it. Small companies like PJRC, not so much.

Your best option is definitely to buy from one of the UK distributors.
 
Just completed a main.S for the blink programme. Blown away by the performance of this little machine (Teensy 4.1). The Assembler version is four times faster than the C code: the uncalibrated delay loop requires 100,000,000 cycles to achieve a delay of approximately half a second. Thats about three clocks a loop!

But how any beginner could have got to this stage without all the demo code available is beyond me. Understanding the i.MX RT1060 manual is not a logical statement.

Indeed the T_4.1 is fast - and PJRC support code makes avoiding the RefManual generally easy :) - and the resulting code is tested for correctness and presented for use.

Would be cool to see that on a thread. ASM.s code used versus c code for blink - not sure what it entailed?

This C sketch toggles LED pin 100M times in one third of a second just over 2.0 cycles per loop and second loop watches for half second of cycles to pass and only completes 60M cycles - so 10 cycles per loop with ref of the CYCCNT taking 3 cycles IIRC:
Code:
void setup() {
	while (!Serial && millis() < 4000 );
	Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
	pinMode( 13, OUTPUT );

	uint32_t tClk = ARM_DWT_CYCCNT;
	int ii;
	[B]for ( ii = 0; ii < 100*1000*1000; ii++ ) digitalToggleFast(13);[/B]
	tClk = ARM_DWT_CYCCNT - tClk;
	Serial.printf("[100M] %lu loops LED toggle in cycles %lu\n", ii, tClk);
	Serial.printf("[100M] %lu loops LED toggle in Sec %f\n", ii, 1.0*tClk/F_CPU_ACTUAL);

	tClk = ARM_DWT_CYCCNT;
	[B]for ( ii = 0; ii < 100*1000*1000; ii++ ) if ( ARM_DWT_CYCCNT-tClk > F_CPU_ACTUAL/2) break;[/B]
	tClk = ARM_DWT_CYCCNT - tClk;
	Serial.printf("%lu loops test to half Sec in cycles %lu\n", ii, tClk);
	Serial.printf("%lu loops test to half Sec %f\n", ii, 1.0*tClk/F_CPU_ACTUAL);
}
void loop() {}

Output:
Code:
T:\tCode\FORUM\MinWait\MinWait.ino Mar  8 2021 17:15:59
T:\tCode\FORUM\MinWait\MinWait.ino Mar  8 2021 17:27:39
[100M] 100000000 loops LED toggle in cycles [B]200010460[/B]
[100M] 100000000 loops LED toggle in Sec [B]0.333351[/B]
[B]59996864[/B] loops test to half Sec in cycles 300000012
59996864 loops test to half Sec 0.500000
 
Happy to provide the assembler version of the main.c file. I am working on an iMac Big Sur and from the command line, i.e. not using Arduino.

Are you familiar with Paul's Bare Metal Blink code? I'm using the same folder structure and have kept his boot.c and startup.c as provided. I lost a few hours today with weird behaviour with the find command in the Makefile but found a way to deal with it!

If you can tell me how I can upload the (small) main.S source - I can't figure how to do it!
 
Happy to provide the assembler version of the main.c file. I am working on an iMac Big Sur and from the command line, i.e. not using Arduino.

Are you familiar with Paul's Bare Metal Blink code? I'm using the same folder structure and have kept his boot.c and startup.c as provided. I lost a few hours today with weird behaviour with the find command in the Makefile but found a way to deal with it!

If you can tell me how I can upload the (small) main.S source - I can't figure how to do it!

On post lower right - 'Go Advanced' - allows file upload in that mode with item on the toolbar. Not sure if it respects .s as an extension - would need to make it .txt or put in a zip - but shouldn't be that large?
 
Back
Top