Teensy 4.0 First Beta Test

Status
Not open for further replies.
Hi @Paul and @mjs513 - Hopefully will get to mailbox this morning... Annie still keeping us busy but that is more offline...

So was playing around with Spreadsheet and added another page, with more user friendly information (like which Arduino object) (have not uploaded yet)...
Code:
Pin	Name	GPIO	Serial	I2C	SPI	PWM	CAN	Audio	XBAR	FlexIO	Analog	SD
 0	AD_B0_03	1.3	Serial1(6) RX		SPI1(3) CS0	PWM1_X1	2_RX		IO-17			
 1	AD_B0_02	1.2	Serial1(6) TX		SPI1(3) MISO	PWM1_X0	2_TX		IO-16			
 2	EMC_04	4.4				PWM4_A2		2:TX_DATA	IO-06	1:4		
 3	EMC_05	4.5				PWM4_B2		2:TX_SYNC	IO-07	1:5		
 4	EMC_06	4.6				PWM2_A0		2:TX_BCLK	IO-08	1:6		
5	EMC_08	4.8				PWM2_A1		2:RX_DATA	IO-17	1:8		
6	B0_10	2.10				PWM2_A2	QT4_1	1:TX3_RX1		2:10		
7	B1_01	2.17	Serial2(4) RX			PWM1_B3		1:TX_DATA	IO-15	2:17, 3:17		
8	B1_00	2.16	Serial2(4) TX			PWM1_A3		1:RX_DATA	IO-14	2:16, 3:16		
 9	B0_11	2.11				PWM2_B2	QT4_2	1:TX2_RX2		2:11		
10	B0_00	2.0			SPI(4) CS0	QT1_0		MQS_RIGHT		2:0     		
11	B0_02	2.2			SPI(4) MOSI	QT1_2	1_TX			2:2		
12	B0_01	2.1			SPI(4) MISO	QT1_1		MQS_LEFT		2:1     		
13	B0_03	2.3			SPI(4) SCK	QT2_0	1_RX			2:3		
14/A0	AD_B1_02	1.18	Serial3(2) TX			QT3_2		SPDIF_OUT		3:2	A1:7, A2:7	
15/A1	AD_B1_03	1.19	Serial3(2) RX			QT3_3		SPDIF_IN		3:3	A1:8, A2:8	
16/A2	AD_B1_07	1.23	Serial4(3) RX	Wire1(3) SCL				SPDIF_EXTCLK		3:7	A1:12, A2:12	
17/A3	AD_B1_06	1.22	Serial4(3) TX	Wire1(3) SDA				SPDIF_LOCK		3:6	A1:11, A2:11	
18/A4	AD_B1_01	1.17	Serial3(2) CTS	Wire(1) SDA		QT3_1				3:1	A1:6, A2:6	
19/A5	AD_B1_00	1.16		Wire(1) SCL		QT3_0				3:0	A1:5, A2:5	
20/A6	AD_B1_10	1.26	Serial5(8) TX					1:RX_SYNC		3:10	A1:15, A2:15	
21/A7	AD_B1_11	1.27	Serial5(8) RX					1:RX_BCLK		3:11	A1:0, A2:0	
22/A8	AD_B1_08	1.24				PWM4_A0	1_TX			3:8	A1:13, A2:13	
23/A9	AD_B1_09	1.25				PWM4_A1	1_RX	1:MCLK		3:9	A1:14, A2:14	
---	----	----	------	---	---	---	---	----	----	-----	------	
24/A10	AD_B0_12	1.12	Serial6(1) TX	Wire2(4) SCL		PWM1_X2					A1:1  	
25/A11	AD_B0_13	1.13	Serial6(1) RX	Wire2(4) SDA		PWM1_X3	GPT1_CLK				A1:2	
26/A12	AD_B1_14	1.30			SPI1(3) MOSI			1:TX_BCLK		3:14	A2:3  	
27/A13	AD_B1_15	1.31			SPI1(3) SCK			1:TX_SYNC		3:15	A2:4  	
28	EMC_32	3.18	Serial7(7) RX			PWM3_B1						
29	EMC_31	4.31	Serial7(7) TX		SPI2(1) CS1	PWM3_A1						
30	EMC_37	3.23				GPT1_3 	3_RX	3:MCLK	IO-23			
31	EMC_36	3.22				GPT1_2	3_TX	3:TX_DATA	IO-22			
32	B0_12	2.12						1:TX1_RX3	IO-10	2:12		
33	EMC_07	4.7				PWM2_B0		2:MCLK	IO-09	1:7		
												
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
With the (number) the actual underlying IMXRT object number.

So needless to say I have not tried any of the extended SPI stuff out yet...

As for how to do SD stuff. I assume we need a version of the T3.5/6 stuff that uses the (BUILTIN) like CS select pin, and uses the stuff from chapter 25 of the IMXRT1060 manual (Ultra Secured Digital Host Controller)uSDHC...

Not sure if anyone has tried to see how different the stuff is here versus what the KinetisK stuff Chapter 60 SDHC of my T3.6 pdf...

But assuming my core stuff and it is complete, in theory I think we could use my SPI2 object with pin 36 as the chip select... Not sure if you would need to do something special for pins 38/39 ... (probably not connect ?)
 
@PaulStoffregen

I think @KurtE core has a lot of the same changes but there looks like some differences on the 1062 pins. Not sure which is correct. Going to have to try and sort it out - Argh. Currently I am using his updated core (at least for the updated files - also I just updated pwm.c to your version) as well as his updated SPI library. Well guess I have a you know what kind of core I am using :)
 
SD CARD LIBRARY

@KurtE, @PaulStoffregen and others. Ok, got it working. The reason for the failure was that the 1062 was not addressed with the last change. Had to add 1062 as well. Once i got that all straightended out it does compile and run :)

For the 1062 i did this, not sure if its the right way to do it, let me know:
Code:
#if defined(__MK64FX512__) || defined(__MK66FX1M0__) || defined(__IMXRT1052__)
	#include "NXP_SDHC.h"
	#define BUILTIN_SDCARD 254
#elif defined(__IMXRT1062__)
	#include "NXP_SDHC.h"
	#define BUILTIN_SDCARD 36
#endif


Code:
Initializing SD card...initialization done.
SYSTEM~1/
	INDEXE~1		76
	WPSETT~1.DAT		12
OPERAT~1.WAV		772140
2001/
	CALCUL~1.WAV		426300
	COMPLE~1.WAV		276460
	DANGER~1.WAV		372892
	ENOUGH~1.WAV		513388
	FUNCTI~1.WAV		237356
	ONE_MO~1.WAV		202236
	OPERAT~1.WAV		772140
	SORRY_~1.WAV		791164
	STOP.WAV		200844
FLAC/
	T1_1024.FLA		9802802
BERLIN~1.FLA		30401785
CHRIST~1.AAC		3177823
MTPINDEX.DAT		0
ODD.MP3		21430
ODD1.MP3		46888
ZARATH~1.MP3		489461
ODD1.WAV		553004
SDTEST1.WAV		16787550
CALCUL~1.WAV		426300
done!

EDIT: I went ahead and put in a PR for this fix. At least it will work for now with the T4B2 sd card.
 
Last edited:
I committed a fix for the digital pins 5-8 & 33 for the digital functions and PWM.

https://github.com/PaulStoffregen/cores/commit/89522d4cffc20f65c63d7e6a66d5e6ca95c6fd8c

Then I spent quite a lot of time looking at the audio library problem. The I2S waveforms look good. Very mysterious....

It is strange - just as a sanity check I reran the sketch on the 1052 and its working without a problem. I also double checked on the 1062, same problem. Not even sure where to begin looking.
 
Received the T4 - looks great!

Oh man.. so many posts - too much to read now :)
@Defragster: PWM is not implemented - I don't think PWM is needed, there is the better MQS?!? Edit: PWM for Audio

I2S: I'll dig into this... I'm pretty sure we find the problem :)
 
TALKIE LIBRARY

Just did a PR to the Talkie Library to correctly define 1062 for Beta board - had 1060 in a couple places so PWM talkie now works on the T4B2 board. Tested on pin8
 
Made it to PMB - have nice new shiny unit :D

Now time to hopefully start checking things out: Note: I see the No Port - Raw Hid ... as mentioned in other posts.

So far I verified I can output on Serial2 with my updated pins... Will verify the rest of them, with program to walk stuff down the chain...
 
ähm.. no T4 ? Have I missed something?
Guess I have to take a look at the Arduino-files...

2019-04-23 18_49_37-Start.png

Power-on/off works.
 
TD 1.46 released:


What I didn't post there is that ...\hardware\teensy\avr\boards.txt needs edit to enable Beta T4's.

Global Replace of : '#teensy4b' with 'teensy4b' to enable both boards b1 and b2.

Then same blink uploaded well to the Beta T4's

Not sure why the difference but in my boards.txt I don't have any lines commented out. I see the selection for Teeny 4-beta 1 and teensy 4 - beta2 in my dropdown without having to do anything. Am I missing something?
 
Not sure why the difference but in my boards.txt I don't have any lines commented out. I see the selection for Teeny 4-beta 1 and teensy 4 - beta2 in my dropdown without having to do anything. Am I missing something?

Did you install the released TD 1.46 from PJRC.com? I did and that is where I found those lines commented out.

Thanks for finding that post - I should have put that in my summary link - that is the kind of stuff I intended to go there.
 
Did you install the released TD 1.46 from PJRC.com? I did and that is where I found those lines commented out.

Thanks for finding that post - I should have put that in my summary link - that is the kind of stuff I intended to go there.

Yeah but its getting tougher and tougher. I downloaded from the link in post#2 for 1.46-beta11 for Windows. That's why I thought it was strange having different boards.txt files.
 
I updated post #2 with link to released copy that comment on the comments.

Not sure when beta of 1.47 will start with 1062 updates as noted by KurtE
 
@manitou

I tested using an SD card on the Audio Shield and was able to play different file types. The sketch I used is in post https://forum.pjrc.com/threads/54711-Teensy-4-0-First-Beta-Test?p=199104&viewfull=1#post199104 if you want to give it a try.
I'm still having SD problems with T4 beta1. @mjs513, I tried the sketch but it fails with Unable to access the SD card. I did some more testing and it's quite weird. I unplugged audio and T4 from T4 beta1 adapter. I hooked jumpers to audio shield (SPI silk screen connectors (CS MOSI MISO SCK)) and ran them to T3.2 SPI (10-13) and SD example listfiles worked. if I run the jumpers to the T4 beta1 (SPI 10-13) , listfiles fails to find the SD. However if i hook T4 beta1 SPI pins to sparkfun SD adapter, listfiles works. So T3.2 can talk to audio adapter microSD and sparkfun SD adapter, but T4 beta1 can only talk to sparkfun SD. Weird! :confused:

T4SD.jpg
running 1.8.8 with 1.46-beta11

Solved: repalced Kingston uSD with SanDisk uSD and T4 beta1 could read it just fine.

EDIT: works with Kingston with Paul's fix
 
Last edited:
Has someone tested I2C ? The Audioshield problem looks like it is - at least for a part - a I2C problem. I added a println() around every write in the codec cpp file and get some zeroes - not successful.
 
@FrankB - I have not tested i2c - or seen it was. I'll see if I have T4-1 sketch that did

I do - will run T:\tCode\T4\ssd1306_128x64_i2c\ssd1306_128x64_i2c.ino asap

td 1.46 dropped :: "T:\arduino_1.8.9_146\hardware\teensy\avr\libraries\Adafruit_SSD1306" ??
 
Last edited:
@defragster - wonder if that link is at beta10, and not beta11?

@manitou - that is weird. I did notice that every once in a while I have to reset the teensy by plugging and unplugging to get it to read the SD card which is weird in and unto itself. I tested on the 1052 reading a external sd card and that seemed to work. I also just tested and pushed a fix to SD library to use the SD card on the new B2 breakout boards and that worked as well. So that is weird.

@Frank B. I haven't tested I2C yet - it was next on my list of things to check. Guess I better check i2c now.


EDIT: @Frank B.
Just ran I2Cscanner on a HMC5883L device and it seems to be recognized.
Code:
I2C Scanner
Scanning...
Device found at address 0x1E  (LSM303D,HMC58/983L,FXOS8700,LIS3DSH)
done

Also just ran the test sketch and seems to be working.
 
Last edited:
Hm... tried SSD1306... getting some errors:
Code:
n file included from C:\Arduino\hardware\teensy\avr\libraries\Adafruit_GFX\Adafruit_GFX.cpp:35:0:

C:\Arduino\hardware\teensy\avr\libraries\Adafruit_GFX\glcdfont.c:13:0: warning: "PROGMEM" redefined

  #define PROGMEM

 ^

In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:41:0,

                 from c:\temp\arduino_build_636984/pch/Arduino.h:6,

                 from C:\Arduino\hardware\teensy\avr\libraries\Adafruit_GFX\Adafruit_GFX.h:5,

                 from C:\Arduino\hardware\teensy\avr\libraries\Adafruit_GFX\Adafruit_GFX.cpp:34:

C:\Arduino\hardware\teensy\avr\cores\teensy4/avr/pgmspace.h:28:0: note: this is the location of the previous definition

 #define PROGMEM __attribute__((section(".progmem")))

 ^

C:\Arduino\hardware\teensy\avr\libraries\Adafruit_GFX\Adafruit_SPITFT.cpp: In constructor 'Adafruit_SPITFT::Adafruit_SPITFT(uint16_t, uint16_t, int8_t, int8_t, int8_t, int8_t, int8_t, int8_t)':

C:\Arduino\hardware\teensy\avr\libraries\Adafruit_GFX\Adafruit_SPITFT.cpp:124:24: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'PORTreg_t {aka volatile unsigned char*}' in assignment

     dcPortSet          = portSetRegister(dc);

                        ^

C:\Arduino\hardware\teensy\avr\libraries\Adafruit_GFX\Adafruit_SPITFT.cpp:125:24: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'PORTreg_t {aka volatile unsigned char*}' in assignment

     dcPortClr          = portClearRegister(dc);

                        ^

C:\Arduino\hardware\teensy\avr\libraries\Adafruit_GFX\Adafruit_SPITFT.cpp:126:24: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'PORTreg_t {aka volatile unsigned char*}' in assignment

     swspi.sckPortSet   = portSetRegister(sck);

                        ^

C:\Arduino\hardware\teensy\avr\libraries\Adafruit_GFX\Adafruit_SPITFT.cpp:127:24: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'PORTreg_t {aka volatile unsigned char*}' in assignment

     swspi.sckPortClr   = portClearRegister(sck);

                        ^

...ETC

The I2C Scanner works
 
For the audioshield, I get :
Code:
Scanning...
No I2C devices found

Edit: Oops, sorry, this is because the SGTL5000 needs an mclk!

However, I get this response with my patched codec:
Code:
Begin c:\temp\arduino_modified_sketch_234989\PlaySynthMusic.ino
chip ID = A011
1
1
1
1
1
1
1
0
1
1
0
0
0
1
1
volume
0
setup done
Proc = 0.98 (1.42),  Mem = 0 (5)
Proc = 2.73 (2.81),  Mem = 2 (16)
Proc = 2.32 (2.81),  Mem = 2 (16)
Proc = 2.49 (2.81),  Mem = 2 (16)

...
- it should be all 1s
 
Weird, just downloaded a fresh Arduino IDE and installed 1.46 and noticed that the githubs core_pins.h does not match the core_pins.h I just installed. Mine has no mention of #if defined(__IMXRT1062__) at line 51 as defined on the Pauls GitHub page? Was that added in after? Does it matter?
 
Weird, just downloaded a fresh Arduino IDE and installed 1.46 and noticed that the githubs core_pins.h does not match the core_pins.h I just installed. Mine has no mention of #if defined(__IMXRT1062__) at line 51 as defined on the Pauls GitHub page? Was that added in after? Does it matter?

The core_pins.h was from this morning. The beta11 update was from yesterday so you have to manually make the change.
 
Status
Not open for further replies.
Back
Top