Teensy 4.0 First Beta Test

Status
Not open for further replies.
Given manitou's RTC to test running Millis and wanting confirmation ... Went back to the SetArmClock sketch and after a short run set it back to 600 MHz before exiting. Added in two serialEvent's and printed RTC to print with millis to see the clock stay in sync.

It seems more likely that dropout was from power cycling running power through the DMM to measure Current. Though as noted that affected the T4 it seemed until the 15 sec reset.

I see the T_3.? [3.1 or 3.6] dropped from T_ports list - did that once and restarted IDE and TLoader and it returned, now after testing - and swapping in my new Hub T_3.6 is missing now.

I put pins on a 3V battery holder in breadboard and it keeps time. Edited the code to not reset if it was bigger than the code value - not the linker value but the hardcoded one seeing that a new scheme is coming.
 
TALKIE LIBRARY

Just tested the Talkie library with the changes I made with a Propshield and confirms it works with a T3.5. Will submit a PR later today.

EDIT:
Talkie: PR Submitted. Only Toms Diner updated.

ResponsiveAnalogRead

PR#19 accepted and incorporated into library, dxinteractive/ResponsiveAnalogRead. Just got notified
 
Last edited:
ADC DMA
I tried porting T3 adc-dma example to T4. It's not working. DMA isr is not firing ... what did I miss?
https://github.com/manitou48/teensy4/blob/master/adcdma.ino
... thanks

Anyone have an example of using timer+XBAR+DMA+ADC for clocking ADC at selectable frequency?

EDIT: added a line ADC1_HC0 = 7; and get 2551 ticks/sec, but data value isn't changing. That's 744968 ADCs/second)

Working with DMAMEM commented out.
 
Last edited:
Tom,
Is this what you were expecting:
Code:
7.11 us
1
ADC1_GC 0x42
ADC1_HC0 0x7
ADC1_CFG 0x6B7
0
9
2539
9
2530
9
2562
If it is the just change to DMAChannel dma(true); otherwise the sketch just hangs, ie., nothing prints
 
did the String.cpp copy and the errors persist from :: Serial.println(String(counter) + " allocations made");

Same code compiles for T_3.6.

Hi @defragster, - Works for me...
Note: you mentioned String.cpp... Maybe typo or wrong file? I copied the wstring.cpp that is in the cores directory. I simply copied it from the teensy3 directory to the teensy4 directory.

Simple Example program:

Code:
void setup() {
  while (!Serial && millis() < 4000);
  Serial.begin(115200);
}

int counter;

void loop() {
  // put your main code here, to run repeatedly:
  printTitle("Test line", 1);
  counter++;
  Serial.println(String(counter) + " allocations made");
  delay(500);
}
void printTitle(String title, int font)
{
  Serial.println(title);
}
void pixelExample()
{
  printTitle("Pixels", 1);
}

Code:
Test line
1 allocations made
Test line
2 allocations made
Test line
3 allocations made
Test line
 
Hi @defragster, - Works for me...
Note: you mentioned String.cpp... Maybe typo or wrong file? I copied the wstring.cpp that is in the cores directory. I simply copied it from the teensy3 directory to the teensy4 directory.
Just for fun I did the same thing just now and ran KurtE's sketch and worked exactly the same way.

A question, I also noticed that stream.cpp wasn't in the T4 core. Shouldn't that be copied over as well?
 
Just for fun I did the same thing just now and ran KurtE's sketch and worked exactly the same way.

A question, I also noticed that stream.cpp wasn't in the T4 core. Shouldn't that be copied over as well?

Yes - I believe you are right!
When I updated the above sketch to:
Code:
void setup() {
  while (!Serial && millis() < 4000);
  Serial.begin(115200);
  Serial1.begin(115200);
}

int counter;
char buffer[4];

void loop() {
  // put your main code here, to run repeatedly:
  printTitle("Test line", 1);
  counter++;
  Serial.println(String(counter) + " allocations made");
  if (Serial1.available()) {
    Serial1.readBytes(buffer, sizeof(buffer));
  }
  delay(500);
}
void printTitle(String title, int font)
{
  Serial.println(title);
}
void pixelExample()
{
  printTitle("Pixels", 1);
}
The link fails:
Code:
C:\Users\kurte\Documents\Arduino\Teensy Tests\test_use_strings/test_use_strings.ino:16: undefined reference to `Stream::readBytes(char*, unsigned int)'

collect2.exe: error: ld returned 1 exit status

Error compiling for board Teensy 4-Beta1.

But compiles fine if I copy stream.cpp from Teensy3 to Teensy4...

Can create PR if desired. Not sure to continue it in my Core SPI fixes or it's own?

Update - Created PR #324
 
Last edited:
Tom,
Is this what you were expecting:
Code:
7.11 us
1
ADC1_GC 0x42
ADC1_HC0 0x7
ADC1_CFG 0x6B7
0
9
2539
9
2530
9
2562
If it is the just change to DMAChannel dma(true); otherwise the sketch just hangs, ie., nothing prints

I have dma.begin(true); so sketch doesn't hang for me. I can't get the "9" number to change if I jumper A0 to GND or 3v3 ???
 
Last edited:
I have dma.begin(true); so sketch doesn't hang for me. I can't get the "2539" number to change if I jumper A0 to GND or 3v3 ???
You are right that the sketch doesn't change - just checked it. Ok - just reloaded with DMAchannel(false) and it ran - not sure that happened the first time. Have to go back and read the ADC chapter. It almost looks like the adc isn't connected to the dma channel. Just talking out loud - my thought process.

@kurtE - I see you already created the PR.
 
Offtopic:

One day, I hope I can see this great demo (Audio-part here: https://forum.pjrc.com/threads/54772-Arduino-Music-Player?p=194512&viewfull=1#post194512) on a Teensy4 - with graphics.
It's a pity that the demo-scene is gone and nobody from the remaining rest has found microcontrollers as valuable demo-hw. Good night.

Here's the mod player hacked / ported to the audio library and some lame TFT action / starfield I made with a T3.6. It's running at ~140 frames on my custom audio / video board, but there's not many cycles left to do anything pretty. Bring on the T4!
Incidentally, the board is for a handheld version of your C64 emulator and a 8080 arcade emulator I made. I'm getting around to transferring the T3.6 directly to the board so it's nice and thin.

https://www.youtube.com/watch?v=zxLHw6GvBzg (Long live the DemoScene!)
 
@manitou
Was looking through the sketch and couldn't see anything. But I noticed it looks like it reads once on startup - not continuously. For instance, if I jumper pin 14 to 3.3v it will read 1023 when I plug the t4 but if I move the jumper to ground it doesn't update. Strange. Have to look a little more

EDIT: Tried to put into continuous mode instead of 1 shot but that didn't work. Only time it changed was on startup when I pin 14 jumpered to 3.3v, then it read 1023, but if I moved the jumper to ground it didn't work.
 
Last edited:
Paul, I received the board. A neighbor received it for me when I wasn't home. I can only say "wow" it's great. Do you make the plexiglas plates yourself?
What are the solderpads for?
I'll test the serial ports tonight, and I think I can start playing a bit with audio Saturday.

@Itec, I guess you can do a lot with the T4. Almost too good for demos :) I'm still looking for "the" idea that will push the T4 to its limits... The C64 on the 3.6 is very close to its limit (there is a bit more room now as the 3.6 can do 256MHz since a few weeks, but...) Also have some plans for the T4... Unfortunately my day has only 24h, and unfortunately I have to work in between.
I'll try your code when the T4-Beta-test is done! (Long live the DemoScene!):cool:
 
Last edited:
Do you make the plexiglas plates yourself?

Yes. Used a laser to cut them and tap tool on my drill press for those threaded standoffs.

Erin soldered all the beta boards, but I hand soldered these 5 breakout boards.

What are the solderpads for?

Just behind the USB host connector is a place to solder a I2C EEPROM chip, and 2 pullup resistors for SDA & SCL. I tested it with a 24LC02A EEPROM and MB85RC256V FRAM chip.

Underneath where the beta board plugs in is a place to solder a SPI flash memory. It's connected to SPI1 (pins 1, 26, 27) and its CS signal connects to pin 22. On the bottom side, right underneath that 8 pin chip, are places to solder 3 pullup resistors. One connects to CS (pin 22) and the other 2 are pullup for the unused SPI flash pins (WP & HOLD).

I have not done any testing with the SPI flash on SPI1, and you probably shouldn't bother either. We're almost certainly going to give up SPI1 to get CAN FD on the final pinout.
 
@Paul,
any suggestion for connecting to uSD pins? Solder wire or do you know a 1mm pin-spacing connector system?
 
SPI class problem.
SPI class missing override:
void usingInterrupt(int interruptName);
Fixed on github?
 
Briefly WEIRD

As noted, my T4 requires pressing program button after every upload. In testing my ADC-DMA sketch at one point I recompiled with A0 still jumpered to GND, and the upload worked several times without requiring a button press! I unhooked GND-A0 jumper, and it again required button press. Jumper A0-GND and upload worked properly ... ALAS, my luck ran out, and now, even with A0-GND jumper, it still requires button press after upload
 
I have not done any testing with the SPI flash on SPI1, and you probably shouldn't bother either. We're almost certainly going to give up SPI1 to get CAN FD on the final pinout.

That means no SPI-display on SPI1, too - so either display on SPI4 (or other SPI devices) or MQS ? oops..
You might want to consider carefully what's more important, CAN-FD or SPI.. personally, I can live with both, but no audio-output without extra chip if SPI is needed doesn't sound that tempting. I've never used CAN FD - What can it be used for?
 
ADC DMA
I tried porting T3 adc-dma example to T4. It's not working. DMA isr is not firing ... what did I miss?
https://github.com/manitou48/teensy4/blob/master/adcdma.ino
... thanks

Anyone have an example of using timer+XBAR+DMA+ADC for clocking ADC at selectable frequency?

EDIT: added a line ADC1_HC0 = 7; and get 2551 ticks/sec, but data value isn't changing. That's 744968 ADCs/second)

OK I commented out DMAMEM on the buffer and the sketch worked. github updated
2526 ticks A0 = 11
that's 646656 ADCs/second (res 10, average 1)
 
I have not done any testing with the SPI flash on SPI1, and you probably shouldn't bother either. We're almost certainly going to give up SPI1 to get CAN FD on the final pinout.

So you are saying that I should not create an SPI1 object, as it is likely to not be in final product...
It looked like it was probably using pins: 0, 1, 26, 27
 
That means no SPI-display on SPI1, too - so either display on SPI4 (or other SPI devices) or MQS ? oops..
You might want to consider carefully what's more important, CAN-FD or SPI.. personally, I can live with both, but no audio-output without extra chip if SPI is needed doesn't sound that tempting. I've never used CAN FD - What can it be used for?

Hm, i've looked at the pinout-table (post #3) now.. I think i've confused SPI3 and SPI1 - on which pins is SPI1 at the moment?
 
@KurtE

Just picked up a SSD1306 128X64 (blue and yellow) from amazon. Downloaded you PR changes and it worked like a charm with Adafruit_SSD1306/GFX libraries. At least now I have an excuse to get a whole bunch of new toys :)
 
remove MEM_CACHE_WBWA, add MEM_NOCACHE instead. If that works, it's a cache problem and you might want to try the cache-functions. Not sure if that's faster than disabling the cache... worth a benchmark?
Since I was on line, gave the change a try, it worked.

2526 ticks A0 = 11
that's 646656 ADCs/second (res 10, average 1)
same set up, his test sketch except with the change to startup, getting between 2545 and 2575 ticks.
 
Kurt, great work !
My first test:
Code:
//connect  Serial1 TX -> Serial2 RX, Serial2 TX -> Serial3 RX, Serial3 TX -> Serial4 RX....


#define SPD 5333333

void setup() {
 delay(800);
 Serial.println("Hello world");
 Serial1.begin(SPD);
 Serial2.begin(SPD);
 Serial3.begin(SPD);
 Serial4.begin(SPD);
 Serial5.begin(SPD);
 Serial6.begin(SPD);
 Serial7.begin(SPD);
 Serial8.begin(SPD);
 Serial1.print("012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\n");
}

void loop() {
 
 if (Serial1.available()) Serial2.write(Serial1.read());
 if (Serial2.available()) Serial3.write(Serial2.read());
 if (Serial3.available()) Serial4.write(Serial3.read());
 if (Serial4.available()) Serial5.write(Serial4.read());
 if (Serial5.available()) Serial6.write(Serial5.read());
 if (Serial6.available()) Serial.write(Serial6.read());
 
}
Works flawlessly. So, max speed is 5333333 BIT/s. That's good.
 
Status
Not open for further replies.
Back
Top