Teensy 4.1 Beta Test

Is there any 8 GPIO pins that is mapped directly to memory so it can be written in one byte on the Teensy 4.1 ? That is if I want to control 8 GPIO at once by writing one byte to memory. There is a special configuration for this type but can't remember what it is called.

Application is for a 8 bit parallel interface to a LCD. This should be faster than SPI ?
 
Is there any 8 GPIO pins that is mapped directly to memory so it can be written in one byte on the Teensy 4.1 ? That is if I want to control 8 GPIO at once by writing one byte to memory. There is a special configuration for this type but can't remember what it is called.

Application is for a 8 bit parallel interface to a LCD. This should be faster than SPI ?

IIRC yes - there are more than 8 pins - seems like 16 [port contiguous - but not edge pin contiguous] - from the same port exposed with the pins added to fill the edges. You can confirm from KurtE or other notes in prior posts on the numbers. Looks like 16 :: AD_B1_[00-15]. It takes a 32 bit port write.

p#64: Teensy-4-1-Beta-Test
p#7: Teensy-4-1-Beta-Test
 
IIRC yes - there are more than 8 pins - seems like 16 [port contiguous - but not edge pin contiguous] - from the same port exposed with the pins added to fill the edges. You can confirm from KurtE or other notes in prior posts on the numbers. Looks like 16 :: AD_B1_[00-15]. It takes a 32 bit port write


Yes, the upper 16 bits of GPIO6_DR are mapped to pins 19 (bit 16), 18, 14, 15, 40, 41, 17, 16, 22, 23, 20, 21, 38, 39, 26 and 27 (bit 31) on the 4.1.
 


Yes, the upper 16 bits of GPIO6_DR are mapped to pins 19 (bit 16), 18, 14, 15, 40, 41, 17, 16, 22, 23, 20, 21, 38, 39, 26 and 27 (bit 31) on the 4.1.

Great - that is how I read Kurt's table - though this is an old printout it matches pin order indicated.

@skpang - there are T_4.0 posted examples showing PORT writes ( and reads ).
 
@MJS513


Not sure which other thread you are referring to. Tried Searching for it. Guess I missed it:(

Did any other of the sketches work? Specifically piptest? Very curious about the the display you are using.
Oops my mistake its a 1024x600, ER-TFTM070-6 7 in display,

Sorry only tested with those two sketches. Next time I hook it up will run the piptest.

Did post yet but was thinking about resurrecting the old rethread on RA8876, https://forum.pjrc.com/threads/59273-Ra8876?highlight=ra8876.
 
You can always use this sketch to print the pin / port mapping. https://github.com/TeensyUser/doc/wiki/Mapping-Pins-to-Ports (Didn't test it for a T4.1 but should work...)

This is the output for T4.1:
Code:
PIN   GPIOn-BITm  |  GPIOn-BITm    PIN

------------------|-------------------

00  -> GPIO6-03   |   GIPO6-02  ->  01
01  -> GPIO6-02   |   GIPO6-03  ->  00
02  -> GPIO9-04   |   GIPO6-12  ->  24
03  -> GPIO9-05   |   GIPO6-13  ->  25
04  -> GPIO9-06   |   GIPO6-16  ->  19
05  -> GPIO9-08   |   GIPO6-17  ->  18
06  -> GPIO7-10   |   GIPO6-18  ->  14
07  -> GPIO7-17   |   GIPO6-19  ->  15
08  -> GPIO7-16   |   GIPO6-20  ->  40
09  -> GPIO7-11   |   GIPO6-21  ->  41
10  -> GPIO7-00   |   GIPO6-22  ->  17
11  -> GPIO7-02   |   GIPO6-23  ->  16
12  -> GPIO7-01   |   GIPO6-24  ->  22
13  -> GPIO7-03   |   GIPO6-25  ->  23
14  -> GPIO6-18   |   GIPO6-26  ->  20
15  -> GPIO6-19   |   GIPO6-27  ->  21
16  -> GPIO6-23   |   GIPO6-28  ->  38
17  -> GPIO6-22   |   GIPO6-29  ->  39
18  -> GPIO6-17   |   GIPO6-30  ->  26
19  -> GPIO6-16   |   GIPO6-31  ->  27
20  -> GPIO6-26   |   GIPO7-00  ->  10
21  -> GPIO6-27   |   GIPO7-01  ->  12
22  -> GPIO6-24   |   GIPO7-02  ->  11
23  -> GPIO6-25   |   GIPO7-03  ->  13
24  -> GPIO6-12   |   GIPO7-10  ->  06
25  -> GPIO6-13   |   GIPO7-11  ->  09
26  -> GPIO6-30   |   GIPO7-12  ->  32
27  -> GPIO6-31   |   GIPO7-16  ->  08
28  -> GPIO8-18   |   GIPO7-17  ->  07
29  -> GPIO9-31   |   GIPO7-18  ->  36
30  -> GPIO8-23   |   GIPO7-19  ->  37
31  -> GPIO8-22   |   GIPO7-28  ->  35
32  -> GPIO7-12   |   GIPO7-29  ->  34
33  -> GPIO9-07   |   GIPO8-12  ->  45
34  -> GPIO7-29   |   GIPO8-13  ->  44
35  -> GPIO7-28   |   GIPO8-14  ->  43
36  -> GPIO7-18   |   GIPO8-15  ->  42
37  -> GPIO7-19   |   GIPO8-16  ->  47
38  -> GPIO6-28   |   GIPO8-17  ->  46
39  -> GPIO6-29   |   GIPO8-18  ->  28
40  -> GPIO6-20   |   GIPO8-22  ->  31
41  -> GPIO6-21   |   GIPO8-23  ->  30
42  -> GPIO8-15   |   GIPO9-04  ->  02
43  -> GPIO8-14   |   GIPO9-05  ->  03
44  -> GPIO8-13   |   GIPO9-06  ->  04
45  -> GPIO8-12   |   GIPO9-07  ->  33
46  -> GPIO8-17   |   GIPO9-08  ->  05
47  -> GPIO8-16   |   GIPO9-22  ->  51
48  -> GPIO9-24   |   GIPO9-24  ->  48
49  -> GPIO9-27   |   GIPO9-25  ->  53
50  -> GPIO9-28   |   GIPO9-26  ->  52
51  -> GPIO9-22   |   GIPO9-27  ->  49
52  -> GPIO9-26   |   GIPO9-28  ->  50
53  -> GPIO9-25   |   GIPO9-29  ->  54
54  -> GPIO9-29   |   GIPO9-31  ->  29
 
@blackketter - just added your T4 footprint and symbol to my kicad lib. Nice work.

Footprints pretty much match what I have on my breakout board for the T4.1 (just overlaid yours on the pads I put on the pcb. Couldn't do a match up of the ethernet connector. And didn't get a chance yet to check the symbol table.

Great, thanks!

One question: Is there value in putting locations for pogo pins to connect to the USB device pads in the KiCAD footprint?
 
@blackketter - Short answer from my view and how I use it - now. Don't know if others would share that point of view :)
 
@MJS513


Not sure which other thread you are referring to. Tried Searching for it. Guess I missed it:(

Did any other of the sketches work? Specifically piptest? Very curious about the the display you are using.
Ok just rehooked the display up to the T4.1 and ran the pip test and it worked - really cool and really fast. One change I made to the lib besides changing the rst and bl pins (just cant help myself) was to add in a W25Q128JV memory chip since any of the others listed wont fit. Hope I did it right :) Oh, gave you the wrong link for the thread I was talking about, here is the correct one.
 
Great, thanks!

One question: Is there value in putting locations for pogo pins to connect to the USB device pads in the KiCAD footprint?
I went ahead and added it. Here's what the symbol looks like:

Screen Shot 2020-04-26 at 10.01.50 AM.jpg
 
I wondered how you got the nice list
That was some funny detective work on a rainy sunday afternoon :)

Since the T4.x PMW timers are also not documented on the PJRC page, I extended the script to print these as well. This version can be found here https://github.com/luni64/TeensyTimerTool/wiki/Avoid-PWM-timer-clashes. Very useful if you want to use the QUAD timers and need to avoid clashes with PWM. If I can talk you into running this on your T4.1 I'll add the tables to the TeensyTimerTool documentation.
 
That was some funny detective work on a rainy sunday afternoon :)

Since the T4.x PMW timers are also not documented on the PJRC page, I extended the script to print these as well. This version can be found here https://github.com/luni64/TeensyTimerTool/wiki/Avoid-PWM-timer-clashes. Very useful if you want to use the QUAD timers and need to avoid clashes with PWM. If I can talk you into running this on your T4.1 I'll add the tables to the TeensyTimerTool documentation.

Had to go to TeensyTimerTool here for usable code:: ...\libraries\TeensyTimerTool\examples\PinInformation\PinInformation.ino

-------------------------------
Sorted by pin number
Pin | GPIO Reg | PWM timer
----|------------|-------------
00 | GPIO6_03 | FLEX_PWM1
01 | GPIO6_02 | FLEX_PWM1
02 | GPIO9_04 | FLEX_PWM4
03 | GPIO9_05 | FLEX_PWM4
04 | GPIO9_06 | FLEX_PWM2
05 | GPIO9_08 | FLEX_PWM2
06 | GPIO7_10 | FLEX_PWM2
07 | GPIO7_17 | FLEX_PWM1
08 | GPIO7_16 | FLEX_PWM1
09 | GPIO7_11 | FLEX_PWM2
10 | GPIO7_00 | QUAD1
11 | GPIO7_02 | QUAD1
12 | GPIO7_01 | QUAD1
13 | GPIO7_03 | QUAD2
14 | GPIO6_18 | QUAD3
15 | GPIO6_19 | QUAD3
16 | GPIO6_23 | no pwm
17 | GPIO6_22 | no pwm
18 | GPIO6_17 | QUAD3
19 | GPIO6_16 | QUAD3
20 | GPIO6_26 | no pwm
21 | GPIO6_27 | no pwm
22 | GPIO6_24 | FLEX_PWM4
23 | GPIO6_25 | FLEX_PWM4
24 | GPIO6_12 | FLEX_PWM1
25 | GPIO6_13 | FLEX_PWM1
26 | GPIO6_30 | no pwm
27 | GPIO6_31 | no pwm
28 | GPIO8_18 | FLEX_PWM3
29 | GPIO9_31 | FLEX_PWM3
30 | GPIO8_23 | no pwm
31 | GPIO8_22 | no pwm
32 | GPIO7_12 | no pwm
33 | GPIO9_07 | FLEX_PWM2
34 | GPIO7_29 | no pwm
35 | GPIO7_28 | no pwm
36 | GPIO7_18 | FLEX_PWM2
37 | GPIO7_19 | FLEX_PWM2
38 | GPIO6_28 | no pwm
39 | GPIO6_29 | no pwm
40 | GPIO6_20 | no pwm
41 | GPIO6_21 | no pwm
42 | GPIO8_15 | FLEX_PWM1
43 | GPIO8_14 | FLEX_PWM1
44 | GPIO8_13 | FLEX_PWM1
45 | GPIO8_12 | FLEX_PWM1
46 | GPIO8_17 | FLEX_PWM1
47 | GPIO8_16 | FLEX_PWM1
48 | GPIO9_24 | no pwm
49 | GPIO9_27 | no pwm
50 | GPIO9_28 | no pwm
51 | GPIO9_22 | FLEX_PWM3
52 | GPIO9_26 | no pwm
53 | GPIO9_25 | no pwm
54 | GPIO9_29 | FLEX_PWM3

-------------------------------
Sorted by PWM timer
Pin | GPIO Reg | PWM timer
----|------------|-------------
10 | GPIO7_00 | QUAD1
11 | GPIO7_02 | QUAD1
12 | GPIO7_01 | QUAD1
13 | GPIO7_03 | QUAD2
19 | GPIO6_16 | QUAD3
18 | GPIO6_17 | QUAD3
14 | GPIO6_18 | QUAD3
15 | GPIO6_19 | QUAD3
01 | GPIO6_02 | FLEX_PWM1
25 | GPIO6_13 | FLEX_PWM1
24 | GPIO6_12 | FLEX_PWM1
42 | GPIO8_15 | FLEX_PWM1
43 | GPIO8_14 | FLEX_PWM1
44 | GPIO8_13 | FLEX_PWM1
45 | GPIO8_12 | FLEX_PWM1
46 | GPIO8_17 | FLEX_PWM1
47 | GPIO8_16 | FLEX_PWM1
08 | GPIO7_16 | FLEX_PWM1
07 | GPIO7_17 | FLEX_PWM1
00 | GPIO6_03 | FLEX_PWM1
09 | GPIO7_11 | FLEX_PWM2
06 | GPIO7_10 | FLEX_PWM2
05 | GPIO9_08 | FLEX_PWM2
04 | GPIO9_06 | FLEX_PWM2
37 | GPIO7_19 | FLEX_PWM2
36 | GPIO7_18 | FLEX_PWM2
33 | GPIO9_07 | FLEX_PWM2
51 | GPIO9_22 | FLEX_PWM3
54 | GPIO9_29 | FLEX_PWM3
28 | GPIO8_18 | FLEX_PWM3
29 | GPIO9_31 | FLEX_PWM3
23 | GPIO6_25 | FLEX_PWM4
02 | GPIO9_04 | FLEX_PWM4
03 | GPIO9_05 | FLEX_PWM4
22 | GPIO6_24 | FLEX_PWM4
20 | GPIO6_26 | no pwm
30 | GPIO8_23 | no pwm
53 | GPIO9_25 | no pwm
52 | GPIO9_26 | no pwm
31 | GPIO8_22 | no pwm
50 | GPIO9_28 | no pwm
49 | GPIO9_27 | no pwm
48 | GPIO9_24 | no pwm
16 | GPIO6_23 | no pwm
17 | GPIO6_22 | no pwm
35 | GPIO7_28 | no pwm
21 | GPIO6_27 | no pwm
32 | GPIO7_12 | no pwm
34 | GPIO7_29 | no pwm
41 | GPIO6_21 | no pwm
40 | GPIO6_20 | no pwm
39 | GPIO6_29 | no pwm
38 | GPIO6_28 | no pwm
26 | GPIO6_30 | no pwm
27 | GPIO6_31 | no pwm

-------------------------------
Sorted by GPIO register:
Pin | GPIO Reg | PWM timer
----|------------|-------------
01 | GPIO6_02 | FLEX_PWM1
00 | GPIO6_03 | FLEX_PWM1
24 | GPIO6_12 | FLEX_PWM1
25 | GPIO6_13 | FLEX_PWM1
19 | GPIO6_16 | QUAD3
18 | GPIO6_17 | QUAD3
14 | GPIO6_18 | QUAD3
15 | GPIO6_19 | QUAD3
40 | GPIO6_20 | no pwm
41 | GPIO6_21 | no pwm
17 | GPIO6_22 | no pwm
16 | GPIO6_23 | no pwm
22 | GPIO6_24 | FLEX_PWM4
23 | GPIO6_25 | FLEX_PWM4
20 | GPIO6_26 | no pwm
21 | GPIO6_27 | no pwm
38 | GPIO6_28 | no pwm
39 | GPIO6_29 | no pwm
26 | GPIO6_30 | no pwm
27 | GPIO6_31 | no pwm
10 | GPIO7_00 | QUAD1
12 | GPIO7_01 | QUAD1
11 | GPIO7_02 | QUAD1
13 | GPIO7_03 | QUAD2
06 | GPIO7_10 | FLEX_PWM2
09 | GPIO7_11 | FLEX_PWM2
32 | GPIO7_12 | no pwm
08 | GPIO7_16 | FLEX_PWM1
07 | GPIO7_17 | FLEX_PWM1
36 | GPIO7_18 | FLEX_PWM2
37 | GPIO7_19 | FLEX_PWM2
35 | GPIO7_28 | no pwm
34 | GPIO7_29 | no pwm
45 | GPIO8_12 | FLEX_PWM1
44 | GPIO8_13 | FLEX_PWM1
43 | GPIO8_14 | FLEX_PWM1
42 | GPIO8_15 | FLEX_PWM1
47 | GPIO8_16 | FLEX_PWM1
46 | GPIO8_17 | FLEX_PWM1
28 | GPIO8_18 | FLEX_PWM3
31 | GPIO8_22 | no pwm
30 | GPIO8_23 | no pwm
02 | GPIO9_04 | FLEX_PWM4
03 | GPIO9_05 | FLEX_PWM4
04 | GPIO9_06 | FLEX_PWM2
33 | GPIO9_07 | FLEX_PWM2
05 | GPIO9_08 | FLEX_PWM2
51 | GPIO9_22 | FLEX_PWM3
48 | GPIO9_24 | no pwm
53 | GPIO9_25 | no pwm
52 | GPIO9_26 | no pwm
49 | GPIO9_27 | no pwm
50 | GPIO9_28 | no pwm
54 | GPIO9_29 | FLEX_PWM3
29 | GPIO9_31 | FLEX_PWM3
 
Thanks a lot

Very cool manipulations and lookup and printing work for good info!

I didn't check COUNTS of ANALOG and DIGITAL pins against the #defines for those - assume they are all there? A prior new Teensy beta needed an update.
 
Looks like fun output of the different pin information...

For the fun of it, I hacked up my card view with the SDIO part... Sort of screwy looking graphics wise, but I think it shows most of the data.

T4.1-Cardlike.jpg
 
KurtE: hmmm, the two memory solder pads on the bottom use SPI1? That is good to know, though I was hoping that they used SPI2. I was thinking about putting 2 uncanny eyes terminals on SPI, and SPI1, and add sound effects from flash memory. Of course I could use a micro-SD card, and/or the larger flash memory for that. In theory, the only time I need to put things on a separate SPI is with the cheap clone 240x240 displays without the CS pin, but I would imagine having 2 separate devices on the same bus can slow things down.

Have you tried SPI1 with a full population (2 memory chips and a random other SPI device like a display), and things are properly tri-stated? Do you have a digikey part number for the psram? I have the flash chips, but I didn't have the right terms for the psram?

I assume the first two lines missing on your graphics is due to the monitor size, and you were more concerned about getting the bottom lines. They
 
KurtE: hmmm, the two memory solder pads on the bottom use SPI1? That is good to know, though I was hoping that they used SPI2.
Actually I think I typed them in wrong and they are Teensy SPI2 (on the hardware lpspi1 object...)
Will update - Correct data on my other page of all of the details

T4.1-Cardlike.jpg

The interesting question is what should the default pins be for SPI2?
Should they be like the T4 and be on the SDCard pins (only option for T4) or should they be on the Memory chips, which if you are not using memory chips may be more usable on T4.1?
Right now in beta it is the SDCard pins.
 
@MM … "Can Be Used for SPI???" - but as Frank notes if either gets 'chipped up" then those common pads go/MUX into QSPI as one of the FLEXSPI connects where the MCU handles much of the overhead for access of either or both FLASH and PSRAM.

Multiple SPI displays have been tested and used in the past weeks - while using QSPI RAM or FLASH in some fashion. In fact the SPI displays were using the QSPI RAM for DMA buffer space.

Paul got some PSRAM chips 'somewhere' mjs513 and Frank and I got some weeks or months back from eBay like places. There are one labelled by ESP

ESPRESSIF ESP-PSRAM64H 3.3V SOP8 64Mbit PSRAM ESP-PSRAM64 (https://www.aliexpress.com/item/4000242457828.html?spm=a2g0s.9042311.0.0.7dee4c4dMcsgyA)

10PCS IPS6404LSQ IPS6404L-SQ-SPN 3.3V SOP8 64Mbit SQPI PSRAM Tape and Reel Package with Datesheet (https://www.aliexpress.com/item/33028533291.html?spm=a2g0s.9042311.0.0.7dee4c4dMcsgyA).
 
Yep - as Mentioned IF you use one of these for memory chips, not sure how will it would work to try to switch modes at different times. My guess is it might not be easy to switch back and forth in a reliable way.
 
Thanks everybody for the information. I must admit to not really poking under the covers much bewteen SPI, QSPI, etc. It is good to here multiple things on multiple SPI buses all work (I suspected they would, but we do have the logical problem of devices without CS pins not being able to share a bus).

I was just playing around with TeensyTransfer on Teensy 4.0. The changes were fairly simple to get it to work with the flash on the 4.0 audio shield.

Basically, I needed to:
  • Change include of mk20dx128.h to Arduino.h;
  • Change the Teensy ifdefs to just use CORE_TEENSY instead of KINETISK and KINETISL;
  • Add #ifdefs in case F_CPU, F_PLL, F_BUS, and F_MEM aren't defined;
  • I haven't added support for the Teensy 4.0/4.1 yet in the teesny_info function.

I suspect there are parts that don't work, because neither HAS_KINETIS_FLASH_FTFA nor HAS_KINETIS_FLASH_FTFL are defined, and the speed is > 120Mhz.
 
Back
Top