Teensy 4.0 First Beta Test

Status
Not open for further replies.
Fixed PWM pins for SDCards: https://github.com/PaulStoffregen/cores/pull/381

Tested with:
Code:
void setup() {
  pinMode(13, OUTPUT);

  analogWriteFrequency(34, 100);
  analogWriteFrequency(35, 100);
  analogWriteFrequency(36, 100);
  analogWriteFrequency(37, 100);
  analogWriteFrequency(38, 100);
  analogWriteFrequency(39, 100);
  analogWrite(34, 40);
  analogWrite(35, 80);
  analogWrite(36, 120);
  analogWrite(37, 160);
  analogWrite(38, 200);
  analogWrite(39, 240);
}

void loop() {
  digitalWrite(13, !digitalRead(13));
  delay(500);
}

Verified with:
screenshot.jpg
 
Fixed PWM pins for SDCards: https://github.com/PaulStoffregen/cores/pull/381

Tested with:
Code:
void setup() {
  pinMode(13, OUTPUT);

  analogWriteFrequency(34, 100);
  analogWriteFrequency(35, 100);
  analogWriteFrequency(36, 100);
  analogWriteFrequency(37, 100);
  analogWriteFrequency(38, 100);
  analogWriteFrequency(39, 100);
  analogWrite(34, 40);
  analogWrite(35, 80);
  analogWrite(36, 120);
  analogWrite(37, 160);
  analogWrite(38, 200);
  analogWrite(39, 240);
}

void loop() {
  digitalWrite(13, !digitalRead(13));
  delay(500);
}

Verified with:
View attachment 16790
Nice work Kurt. Never even realized those SD pins were PWM capable. Always focused just on the SD Card aspect of them. Those draft cards Paul posted are coming in handy. You guys make it look so easy at times. Distractions are keeping me real busy, not enough time with the T4. Been playing with the HDMI adapter. Works nice but there are differences in the draw commands, some are almost identical others are a bit different. Just kind of playing with it a few minutes here and there. Have a board setup to permanently setup a T3.6 as a Logic analyzer if I can ever get to that as well.

BOUNCE LIB
Played around with this and seems like it is working on pins 0, 1. Problem is I am not really getting double readings that I can see. Have to get a little more into the weeds I guess.
 
@mjs513 - Thanks, I knew they were, as they show up in my excel document:
Code:
34	SD_B0_03	2.15	Serial5(8) RTS		SPI2(1) MISO	PWM1_B1			IO-07			DATA1
35	SD_B0_02	3.14	Serial5(8) CTS		SPI2(1) MOSI	PWM1_A1			IO-06			DATA0
36	SD_B0_01	3.13		Wire1(3) SDA	SPI2(1) CS0	PWM1_B0			IO-05			CLK
37	SD_B0_00	3.12		Wire1(3) SCL	SPI2(1) SCK	PWM1_A0			IO-04			CMD
38	SD_B0_05	3.17	Serial5(8) RX		SPI2(1) B_DQS	PWM1_B2			IO-09			DATA3
39	SD_B0_04	3.16	Serial5(8) TX		SPI2(1) B_SSO_B	PWM1_A2			IO-08			DATA2

Just forgot to take a look at pwm to see if someone else had put them in or not... (NOT) :D

Luckily easy to create test case, as it helped me to verify that I updated table correctly (I had one mistype...)

Now back to some other distractions (like clean up yard...)
 
Good work @KurtE with the pin checks ALT and bonus PWM's ... Though Paul's cyclic trigger routing for the SD pins was really tricky testing the POGO.

Distracted like @mjs513 here - pulled apart a lightly used 8-10 year old laptop drive and 120 GB formatted and running with T4 Updated USBHost from @KurtE Bluetooth branch and then the old drive hits 13 MB/Sec same as others when bumping buffer to 64 KBytes.

My Big Brother just got a second HP from Costco with a factory Bad HDD that failed during Win 10 update to latest ... hours of slowness - one got farther then factory diagnostics pointed to HDD fail on the second. Spent a couple hours on the phone with him during that ...
 
@all

Wondering if the RA8875 library has been tried yet.
Could not find anything about it in the T4 thread.

I pulled out my Adafruit RA8875 driver board with 7" touch screen to test with the T4 today. Using Sumotoy's RA8875 library I was able to run most all of the example sketches
The touch screen calibration sketch locks up at the 'ok, Now Touch Bottom/Right angle!' prompt. I fixed it before but can't remember what I did or how I did it.

Only had to add defines for the T4 to any of these defines in 'RA8875.cpp', 'RA8875.h' and 'RA8875UserSettings.h'.

From:
Code:
#if defined(__MK20DX128__) || defined(__MK20DX256__)//Teensy 3.0 , 3.1
To:
Code:
#if defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK66FX1M0__) || defined(__IMXRT1062__)//Teensy 3.0 , 3.1

In the sketches I only had to change this:
Code:
  tft.begin(RA8875_800x480);
To this:
Code:
  tft.begin(Adafruit_800x480);

Adafruit RA8875 looks like it will need alot of work to get it to work with the T4 unless somebody else has already done it.
 
Interesting question is how best to handle libraries like these. Sumo toy has not logged in for something like 2 years. Also has not updated many of these for several more...

Edit: And if by chance sumotoy(Max) is reading this. Hope you are doing OK.
 
Last edited:
@kurte

The last time I saw anything from him on GitHub was this https://github.com/sumotoy/RA8876.
I also hope he is doing well.

I updated his RA8875 driver to use it as a terminal emulator with T36 and a structured BASIC. His code was very fast. But I needed a bigger display.
Eyes are not what they used to be:)
That is why I was hoping to see his RA8876 driver. So I went to the RA8876_Lite driver from RAiO and modified it. I want to port it to the T4.
It should not be that hard as it is working well with T36.
 
@defragster - Thanks, with PWM it is pretty easy as the tables were already there, just needed to add 6 new items at the end. Most of the information for these table entries are in my excel document.

and @others, The one part that I don't have there is the IO pin MUX values for the different modes (that is what Mux value in this case turns the pin into using PWM mode)

Maybe at some point will add that data... Plus while not in this case sometimes a more confusing thing is that for Input like functions, there may also be an INPUT_SELECT mux value that you need to set if that same Input function can be done on multiple pins.

One thing sort of confusing to me about these input select mux registers. Is for example the Serial TX pins have these as well, example: IOMUXC_LPUART8_TX_SELECT_INPUT
I filled that one in to my Hardware Serial code for Serial5, but did not look up the ones for the other Serial ports yet as so far the code does not need it. If I were a guessing person, I would guess that this is mainly (only?) used if you switch the Serial port into Half duplex mode. Which so far our standard HardwareSerial class does not do...

I wish we did allow something like: Serial1.begin(1000000, SERIAL_8N1 | SERIAL_HALF_DUPLEX);
Where the begin mode would do the setup for half duplex, and the Serial.write() code would do like it does for transmitterEnable(); And set the pin into TX mode and when the tx queue is empty and ... sets the pin back into RX mode...

@defragster Sounds like you have been busy with lots of non T4 stuff ;) Me too.. Spent most of yesterday outside on deck trying out green egg...

On the USBHost mass storage stuff, Hopefully at some point soon we will have the Bluetooth branch brought into the main release branch of USBHost_t36 so the hang on using buffers of exact duplicates of max will not hang. Or could create another quick patch to just have that. Also at some point would be interesting to see if some of this mass storage support could be somehow brought into builds and/or some other way to make it easier for others to find, as it great functionality to have!

Now back to playing (maybe even some on T4)
 
@all

Wondering if the RA8875 library has been tried yet.
Could not find anything about it in the T4 thread.

...
Adafruit RA8875 looks like it will need alot of work to get it to work with the T4 unless somebody else has already done it.

Which version are you trying out? The version installed by Teensyduino? Which appears to match Paul's version: https://github.com/PaulStoffregen/Adafruit_RA8875

Which github says is something like 55 commits behind the Adafruit master version.

Or the version you can install from library manager (Version 1.3.1). Which probably matches what they have on github
 
@Kurte

I am using the version installed in Teensyduino. I will get latest version from GitHub and test it.
Will probably get the latest 'Adafruit_GFX' from GitHub as well.

Thanks Kurte:)
 
@Kurte

Downloaded the latest versions of 'Adafruit_RA8875' and 'Adafruit_GFX'.

I went through all of the example sketches. Just had to change pin assignments for SD cs, Reset and INT pins.
I compiles clean and all sketches work as expected including touch screen and touch screen calibration.

The touch screen sketch has the ability to store calibration values to eeprom. I want to check that out on the T4.
The 'ra8875_bitmap_fast.ino' sketch loads a picture of a parrot to the screen and measures the load time.
Going to use MSC to see how fast it loads from an HDD and Flash drive.

Thanks again for the help Kurte.
 
T4 HDMI Shield Test

@KurtE, @wwatson, @all

Finally finished a graphics test sketch similar to that used for the ILI9341/9488. Did find a couple of drawbacks that I have to figure out though.
1. There really isn't a screen rotation
2. Text rotation is 90 degrees only - this one I am not sure about.
3. There is no newline command in the existing library so I created one from info using the xlatb 8876 driver. Here are some numbers but really shouldn't compare to the TFT displays. The 8876 does h/w acceleration:
Code:
Running ra8876_Lite::begin(args)...
RA8876 connect pass!
Ra8876_Lite::ra8876PllInitial(pclk)...
PLL initialization successful
Name of LCD: CEA 1280x720p@60Hz 16:9 VIC#4
LCD width: 1280
LCD height: 720
H blanking: 370
H front porch: 110
H pulse width: 40
V blanking: 30
V front porch: 5
V pulse width: 5
Pclk Polarity: 0
Vsync Polarity: 1
Hsync Polarity: 1
DE Polarity: 0
CH703X start running from here...
Benchmark                Time (microseconds)
testText              17947
Rectangles (outline)     12973
Rectangles (filled)      411121
Circles (filled)         95637
Circles (outline)        80590
Triangles (outline)      8742
Triangles (filled)       133401
Rounded rects (outline)  14356
Rounded rects (filled)   442527
Ellipse   8810
Ellipse Fill  416475
Gradient test took 53 ms
Done!
 
@mjs513

Not sure if you have the RA8876 RM. If not then here is the link:
https://www.buydisplay.com/download/ic/RA8876.pdf

On page 52, section 11.4 it describes rotation and mirroring. It says that it can rotate counter clockwise by 90 or 180 degrees and mirroring is the same as 360 degrees vertically or horizontally.
I THINK!! Anyway it can be accomplished.
What is the SPI speed you are using? According to the RM you should be able to run at 50MHz. I have never been able to go above 28MHz. I think it's because of the ribbon cable length I am using and the length of the leads to the ribbon cable. Probably 8" to 9" from the T36.
Nice to see it working.
When I can afford it, I want one:)
 
@mjs513

Not sure if you have the RA8876 RM. If not then here is the link:
https://www.buydisplay.com/download/ic/RA8876.pdf

On page 52, section 11.4 it describes rotation and mirroring. It says that it can rotate counter clockwise by 90 or 180 degrees and mirroring is the same as 360 degrees vertically or horizontally.
I THINK!! Anyway it can be accomplished.
What is the SPI speed you are using? According to the RM you should be able to run at 50MHz. I have never been able to go above 28MHz. I think it's because of the ribbon cable length I am using and the length of the leads to the ribbon cable. Probably 8" to 9" from the T36.
Nice to see it working.
When I can afford it, I want one:)

Thanks for the link. I do have a copy but I was interpreting that as applicable to only images not text. Probably wrong - have to look again.

Running SPI at default for Teensy in the lib - 50Mhz. Could be with ribbon. Had some problems with cable lengths running at SPI high speeds.
 
What's Going on with sumotoy and his Libraries?

@kurte

The last time I saw anything from him on GitHub was this https://github.com/sumotoy/RA8876.
I also hope he is doing well.

I updated his RA8875 driver to use it as a terminal emulator with T36 and a structured BASIC. His code was very fast. But I needed a bigger display.
Eyes are not what they used to be:)
That is why I was hoping to see his RA8876 driver. So I went to the RA8876_Lite driver from RAiO and modified it. I want to port it to the T4.
It should not be that hard as it is working well with T36.

Saw this note in one of sumotoy's github repositories:
I'm not disappeared...
Last year, around August I got disease, in the same year, around november a loved member of my family was in Hospital and in less than a month left us, this caused a coincidence of problems over problems so my spare time dissolved.
That's life, there's things over your control and nothing I can do, I accepted but have to stop some activities.
I will go back here? Sure, I already started, but slowly... I got disease as well so I cannot spend too much time.
I've enjoy a lot helping community to build something amazing, I got several projects videos and pictures from people that used my libraries and I'm always happy to see those things but in the same time got lot of bad letters from people that pretend this and that, fix this... Everyone need a break during life, last year was my turn and I'm happy to still be here to say this... Please understand.
 
@mjs513 - the HDMI demo on uTube showed menu and screen rotation - it seemed that was text over image. I don't have one and haven't looked beyond that.

@willie.f.t - yeah I remember that post and kept hoping to see a return to health note if not the forum for more code. @sumotoy did some good work on the TFT's I had and played with while he was active.
 
ST7735_t3 - Since there was a forum question about multiple st7735 displays, I thought I would take a look to see if this library was updated to work with T4...

It has not... Did not find any references to it except on message 4 or was it 6... Also no PR requests...

Side note/questions:

Wondering: the current library still has code in it for Arduino AVR and Due boards... OK to remove? A couple years ago I removed it in my Fork/Spin Branch of this library.

T4 - Again none of the SPI FIFO queue stuff with ... If I look at it, I might try hacking it up the same way I did for the ILI9341_t3 library (Still waiting on PR)...

But before I do it, need to see if I can find at least one of these displays in my boxes...

Got to go.
 
Here a (hopefully) final draft for the pinout cards.

card10_rev1.png

I had intended to send this out for printing Tuesday, so now a couple days behind.

Especially if you have a pinout spreadsheet, or just the text in msg #3, please give this a quick look over for any errors.
 
Maybe there is an arrow missing - it's not 100% clear where the pins 24-33 are - or it's just because the green area is a bit misleading at the moment(?) and it will be more clear with the real photo
 
Maybe there is an arrow missing - it's not 100% clear where the pins 24-33 are - or it's just because the green area is a bit misleading at the moment(?) and it will be more clear with the real photo

I would agree with Frank. On the T3.x cards arrows went to each pad on the underside. With that said, the alignment of the pins on the underside doesn't really allow enough room to point to each pad. So, an arrow to each row?
 
I would agree with Frank. On the T3.x cards arrows went to each pad on the underside. With that said, the alignment of the pins on the underside doesn't really allow enough room to point to each pad. So, an arrow to each row?

I tried a couple ways to use arrows, but with the pads arranged as they are, it seemed more confusing than helpful.


Which signals are on the round testpads between 24-33?

From 24 to 32:

NVCC_PLL
VCC_CPU (0.9 to 1.3)
VDD_SNVS_IN
VDD_USB_CAP

Here's info on all the other test points....

To the left of pin 29's pad:

VDD_HIGH_CAP

Underneath the BGA, from near pin 19 to center:

GPIO_AD_B0_00
VDD_SNVS_CAP

Underneath the 8 pin FFC connector (not populated on the final product), from near 3.3V to near pin 1:

MKL02 Programming Clock
MKL02 Programming Data
PMIC_ON_REQ

Near GND and pin 0:

VBUS_USB (connected to VIN - after fuse & reverse polarity protection mosfet - the input to the 3.3V regulator)


Most of these test points are power supplies. The test fixture begins by connecting all the GND pins to GND, then applied power to one of the power pins. The test passes if all the power supplies are in the correct range, and the MKL02 chip responds to an identification command. This test is repeated for each positive power pin. Between each test, resistors are connected to all the power supply pins to fully discharge the *many* capacitors on T4. The a similar set of tests is done for each GND pin, where the T4 is "floating" at 3.3V and 1 of the GND pins is used. Access to *all* power supply signals is critical for these tests to work. Discharging all the caps is also critical. Almost all those test points are for this power pins test.

After testing all the power pins, the test fixture checks connectivity of almost all signals. Each pin is driven high with all the others low, then it's driven low with all the others high. Most are read using JTAG boundary scan, but some are read via the MKL02.

A special test is done to check both LEDs. The T4's current consumption is measured first for a baseline, then each LED is turned on, and a final measurement is done with both off. The before and after need to closely match, and each LED is checked for approx the expected increase in current consumption.

Another special test is done for the pullup resistor on PMIC_ON_REQ, by connecting a extra pulldown resistor in the tester and verifying the voltage is correct for the combination acting as a resistor divider.

More special tests are done to check the 2 USB host signals and the On/Off pin, since those aren't accessible by the JTAG boundary scan.

After the tester writes the bootloader into the MKL02 and the restore program into the top 4K sector of the W25Q16, the very last test checks for 24 MHz and 32 kHz from the 2 crystals. 24 MHz is checked by turning on the CLKOUT feature on one of the SD pins. 32 kHz is checked by GPIO_AD_B0_00, which is the only pin on the chip (as far as I know) capable outputting a direct copy of the 32 kHz oscillator (not re-synced to the IPG clock). The tester has a 74HC4060 chip to divide the high frequency into the kHz range. Then it uses FreqMeasure to check each for the correct frequency. The test is run by a Teensy 3.6, so the total error also includes its crystal. Currently the tester only fails a T4 if the total error is more than 80 ppm. This frequency test is done last because the 32 kHz crystal takes about half a second to start oscillating (or perhaps it's oscillating sooner but the iMXRT still uses its internal RC oscillator for some reason).

Actually, there are 2 more tests done, which involve power cycling again. The MKL02 control over the iMXRT PSWITCH pin is checked by verifying VCC_CPU really does turn off and can turn back on again. VBAT is also checked by powering down everything else, and then the SNVS input and output are checked (at least 2.8V arriving through the diode, and SNVS regulator creating at least 0.9V).


Maybe that's more than anyone might ever want to know about the test procedure, but hopefully it shines some light on why there are so many test points. This iMXRT chip has several power supply voltages. All need to be checked, and the tester needs to be able to fully discharge every capacitor so each individual power up test begins with the T4 fully off.

Of all those test points, I'd imagine GPIO_AD_B0_00 is probably the only one interesting for regular use. You can get one more I/O pin if you really want. But as I/O pins go, it doesn't offer much, really just another PWM. Its XBAR path is already on pin 8. Other than the 32 kHz output, it's other features aren't useful without more pins trapped under the BGA.
 
Adafruit_gfx, adafruit_ili9341, adafruit_st7735 and st7735_t3

None of these compile on T4...

I did some changes to Adafruit_gfx - https://github.com/KurtE/Adafruit-GFX-Library/tree/T4_Beta

That I was able to build and run graphicstest example app on T4 using PJRC ILI9341 display using pins (CS=10, DC=9, reset=23)

I also was able to get graphicstest example to work on ST7735 SPI display with adafruit_st7735... library.

Still working on ST7735_t3 as more 32 bit registers... And likewise SPI data different...

Anyway if anyone wises to try it out before I try issuing a PR to Adafruit that would be great.
 
Here a (hopefully) final draft for the pinout cards.

...

I had intended to send this out for printing Tuesday, so now a couple days behind.

Especially if you have a pinout spreadsheet, or just the text in msg #3, please give this a quick look over for any errors.

Maybe on purpose to save space? T_LC and T_3.2 cards show Analog/PWM critical function: Resolution (Ref)

@KurtE - I'll try linked and downloaded > adafruit_ili9341
 
Status
Not open for further replies.
Back
Top