Teensyduino 1.56 Beta #6

Status
Not open for further replies.

Paul

Administrator
Staff member
Here is a sixth beta test for Teensyduino 1.56.

This beta is meant to be the final release candidate for 1.56.


Linux 32 bit:
https://www.pjrc.com/teensy/td_156-beta6/TeensyduinoInstall.linux32

Linux 64 bit:
https://www.pjrc.com/teensy/td_156-beta6/TeensyduinoInstall.linux64

Linux ARM:
https://www.pjrc.com/teensy/td_156-beta6/TeensyduinoInstall.linuxarm

Linux ARM64:
https://www.pjrc.com/teensy/td_156-beta6/TeensyduinoInstall.linuxaarch64

MacOS 10.10 to 12.x:
https://www.pjrc.com/teensy/td_156-beta6/Teensyduino_MacOS_Catalina.zip

MacOS 10.7 to 10.14:
https://www.pjrc.com/teensy/td_156-beta6/TeensyduinoInstall.dmg

Windows:
https://www.pjrc.com/teensy/td_156-beta6/TeensyduinoInstall.exe


Changes since Teensyduino 1.56-beta5:

Fix SD example SdFat_Usage on Teensy 2.0
Fix SdFat example BackwardCompatibility on Teensy 2.0
SoftwareSerial add bool operator
Fix SD src-utility conflict when installed on top of 1.53 with Arduino 1.8.5-1.8.9
Audio fix compiler errors & warnings with Teensy LC
Audio Fix MidiSynthKeyboard example on Teensy 4
Audio async spdif example to compile on all boards
ILI9488_t3 fix compile errors in examples (KurtE)
ILI9488_t3 better document examples (mjs513)
LittleFS fix RAM Test_Integrity on Teensy 3.5 & 3.6 (Defragster)
LittleFS add Cypress and Fuji 2MBit FRAM support (KurtE)
MIDI fix DualMerger example
Fix Snooze hibernate/sd_datalogger example
 
Still First?

TD 1.56b6 on IDE 1.8.19 installed good and proper.

A couple of sketches on T_3.6 and T_4.1 upload in the great PJRC Teensy way.
 

The web shows this : cplusplus.com/reference/cstdarg/va_end/:
Code:
void va_end (va_list ap);
End using variable argument list
Performs the appropriate actions to facilitate a normal return by a function that has used the va_list object ap to retrieve its additional arguments.

[B]This macro should be invoked before the function returns whenever va_start has been invoked from that function.[/B]

And the linked code does use va_start(ap, format);

Also: The C library macro void va_end(va_list ap) allows a function with variable arguments which used the va_start macro to return. If va_end is not called before returning from the function, the result is undefined.
 
Last edited:
Updated over previous beta - tested examples Using the Fuse written Lockabel TMM from
1. FastLED
2. ILI9341
3. Entropy
4. FastCRC
5. ILI9488

Some non TD Libraries
1. Adafruit GFX demo
2. EloquentTinyML
3. Bill G's ChiRT (chibos)
4. EigenTest sketch

Only issue is my TeensyOpenGL (this is my OpenGL lib) seems to hang the Teensy Micromod board - yellow light flashes 7 times ) which I have to see whats causing the problem in the sketch.

Also the testing FS with MTP, ie., SD, LittleFS, etc.
 
I tested Ethernet Webclient with W5500 on Teensy 4.0 and Teensy 3.6, WavFilePlayer on Teensy 4.0 with rev D audio shield and Teensy 3.2 with rev C audio, and HM01B0 testv3 on MicroMod. So far all looking good.

Then I noticed we might have a problem with SD listfiles. When I run it with BUILTIN_SDCARD, all 5 files on my card print, but it never gets to "done!" and reboots after several seconds. Same on Teensy 3.6, but hangs. But it works fine with SPI.

Running SD listfiles from 1.55 seems to work.

Is anyone else able to reproduce this SD listfiles issue?
 
I tested Ethernet Webclient with W5500 on Teensy 4.0 and Teensy 3.6, WavFilePlayer on Teensy 4.0 with rev D audio shield and Teensy 3.2 with rev C audio, and HM01B0 testv3 on MicroMod. So far all looking good.

Then I noticed we might have a problem with SD listfiles. When I run it with BUILTIN_SDCARD, all 5 files on my card print, but it never gets to "done!" and reboots after several seconds. Same on Teensy 3.6, but hangs. But it works fine with SPI.

Running SD listfiles from 1.55 seems to work.

Is anyone else able to reproduce this SD listfiles issue?

Ran it with @KurtE's SD version with the sdCard CS pin function and it worked with 1.56beta6. Reloaded the stock version installed with beta6 and still seems to be working on a T4.1:
Code:
Initializing SD card...initialization done.
MemoryHexDump_git/
  .gitattributes                                   68    08:42  December 17, 2021
  .gitignore                                       32    08:42  December 17, 2021
  examples/
    memdump/
      memdump.ino                                1100    08:42  December 17, 2021
    SDFileDump/
      SDFileDump.ino                             4586    08:42  December 17, 2021
  keywords.txt                                     24    08:42  December 17, 2021
  library.properties                              295    08:42  December 17, 2021
  LICENSE                                        1083    08:42  December 17, 2021
  README.md                                      3157    08:42  December 17, 2021
  src/
    MemoryHexDump.cpp                            3882    08:42  December 17, 2021
    MemoryHexDump.h                               550    08:42  December 17, 2021
222/
  aaa.txt                                         256    20:40  December 17, 2021
  bbb.txt                                         512    20:40  December 17, 2021
  ccc.txt                                         768    20:40  December 17, 2021
333/
  aaa.txt                                         256    20:40  December 17, 2021
  bbb.txt                                         512    20:40  December 17, 2021
  ccc.txt                                         768    20:40  December 17, 2021
111/
  aaa.txt                                         256    20:40  December 17, 2021
  bbb.txt                                         512    20:40  December 17, 2021
  ccc.txt                                         768    20:40  December 17, 2021
done!

Tried a Teensy Micromod and showed same list - I just moved the card over that I tested with on the T4.1
 
The MTP index file is causing the problem. Looks like we end up with DateTimeFields having an invalid month. This fix prevents the crash.

https://github.com/PaulStoffregen/SD/commit/6059a9b9aca7828001c797774770c17f755f96ed

Should probably dig deeper and look at why we're returning an invalid date.


Code:
Initializing SD card...initialization done.
SDTEST1.WAV                                  16787550    09:00  September 24, 2021
SDTEST2.WAV                                  16425698    09:00  September 24, 2021
SDTEST3.WAV                                  13617358    09:00  September 24, 2021
SDTEST4.WAV                                  17173152    09:00  September 24, 2021
[B][COLOR="#FF0000"]mtpindex.dat                                        0    00:00  ??? 0, 1980[/COLOR][/B]
done!
 
Looks like it's crashing with the specific card I had in the SDIO socket. When I move the card to SPI, same crash.

Was going to post worked on MMOD running using SD and SD out of my libraries folder, but I synced them both up to what is up on github (main branches)

Might be interesting with your disk to take to pc and see if they complain about the validity of the disk...
Code:
Initializing SD card...initialization done.
222/
  aaa.txt                                         256    17:18  December 17, 2021
  bbb.txt                                         512    17:18  December 17, 2021
  ccc.txt                                         768    17:18  December 17, 2021
333/
  aaa.txt                                         256    17:18  December 17, 2021
  bbb.txt                                         512    17:18  December 17, 2021
  ccc.txt                                         768    17:18  December 17, 2021
111/
  aaa.txt                                         256    17:18  December 17, 2021
  bbb.txt                                         512    17:18  December 17, 2021
  ccc.txt                                         768    17:18  December 17, 2021
done!
 
Agree. Been setting the sketch up to put the index file in flash or ram like @KurtE as set up so have seen that error

Have been testing the MM with the ILI9341 display with Kris Kasprzak Graph function library and testing the Quad encoder and all seems to be working.
 
Will take a look at the index file... I have avoided the index file on SD for awhile as there are issues with index files on removable media, like what happens if there is no disk... Or the disk is read only or...

Need to add more fallback code in to allow it then either move to different storage or make a limited index in memory...
 
Will take a look at the index file... I have avoided the index file on SD for awhile as there are issues with index files on removable media, like what happens if there is no disk... Or the disk is read only or...

Need to add more fallback code in to allow it then either move to different storage or make a limited index in memory...

The index in memory seems to working out as the best option so far but never tested on other than T3.6, T4x and TMM. So probably a good approach.
 
I ran the Simple mtp_teensy sketch commented out making ram drive, so index created on SD... I walked the directories and did a 1 command and a list... Note first time I faulted, as I have not updated this sketch to default which storage the commands are talking to (2 command) and so it walks off using null pointer.

Code:
Dump Storage list(2)
store:0 storage:10001 name:SD_Card fs:20005724
store:1 storage:20001 name:Program fs:20005db4

Dump Index List
0: 0 1 1 -1 0 23 0 0 /
1: 1 1 0 -1 0 0 0 0 /
20: 0 1 1 0 0 29 1639892384 1639892384 222
21: 0 1 1 0 20 32 1639892388 1639892388 333
22: 0 1 1 0 21 26 1639892392 1639892392 111
23: 0 0 0 0 22 0 1640152166 928540800 mtpindex.dat
24: 0 0 0 22 0 256 1639892394 1639761498 aaa.txt
25: 0 0 0 22 24 512 1639892394 1639761498 bbb.txt
26: 0 0 0 22 25 768 1639892396 1639761498 ccc.txt
27: 0 0 0 20 0 256 1639892384 1639761498 aaa.txt
28: 0 0 0 20 27 512 1639892386 1639761498 bbb.txt
29: 0 0 0 20 28 768 1639892386 1639761498 ccc.txt
30: 0 0 0 21 0 256 1639892388 1639761498 aaa.txt
31: 0 0 0 21 30 512 1639892390 1639761498 bbb.txt
32: 0 0 0 21 31 768 1639892392 1639761498 ccc.txt

 Space Used = 491520
Filesystem Size = 31902400512
Directory
---------
222/
  aaa.txt                             256
  bbb.txt                             512
  ccc.txt                             768
333/
  aaa.txt                             256
  bbb.txt                             512
  ccc.txt                             768
111/
  aaa.txt                             256
  bbb.txt                             512
  ccc.txt                             768
mtpindex.dat                          0
You will notice the index file has strange looking modify date(928540800)... Maybe because the file stays open... Will now reprogram to the SD List...

Edit: the SD list now does walk off deep end and fault/reset...
Code:
CrashReport:
  A problem occurred at (system time) 6:17:7
  Code was executing from address 0xA90
  CFSR: 8200
	(PRECISERR) Data bus error(address in BFAR)
	(BFARVALID) Accessed Address: 0x200702A4
  Temperature inside the chip was 40.56 °C
  Startup CPU clock speed is 600MHz
  Reboot was caused by auto reboot after fault or bad interrupt detected
Initializing SD card...initialization done.
222/
  aaa.txt                                         256    (17 18 18 32 121 11 17):17:18  December 17, 2021
  bbb.txt                                         512    (17 18 18 32 121 11 17):17:18  December 17, 2021
  ccc.txt                                         768    (17 18 18 32 121 11 17):17:18  December 17, 2021
333/
  aaa.txt                                         256    (17 18 18 32 121 11 17):17:18  December 17, 2021
  bbb.txt                                         512    (17 18 18 32 121 11 17):17:18  December 17, 2021
  ccc.txt                                         768    (17 18 18 32 121 11 17):17:18  December 17, 2021
111/
  aaa.txt                                         256    (17 18 18 32 121 11 17):17:18  December 17, 2021
  bbb.txt                                         512    (17 18 18 32 121 11 17):17:18  December 17, 2021
  ccc.txt                                         768    (17 18 18 32 121 11 17):17:18  December 17, 2021
mtpindex.dat                                        0    (0 0 0 32 80 255 0):00:00
This is with:
Code:
   Serial.printf("(%u %u %u %u %u %u %u):", tm.hour, tm.min, tm.sec, tm.wday, tm.year, tm.mon, tm.mday);
  Serial.flush();
Need to look at how these numbers translate. That is did SD return 0...
 
Last edited:
@KurtE
Looking at Storage.cpp not sure we ever do a UpdateDates call to set a create/modify dates for the index file:
 
Follow on:
From SDFile class:
Code:
	virtual bool getModifyTime(DateTimeFields &tm) {
		uint16_t fat_date, fat_time;
		if (!sdfatfile.getModifyDateTime(&fat_date, &fat_time)) return false;
		tm.sec = FS_SECOND(fat_time);
		tm.min = FS_MINUTE(fat_time);
		tm.hour = FS_HOUR(fat_time);
		tm.mday = FS_DAY(fat_date);
		tm.mon = FS_MONTH(fat_date) - 1;
		tm.year = FS_YEAR(fat_date) - 1900;
		return true;
	}
So with the data printed above: mtpindex.dat 0 (0 0 0 32 80 255 0):00:00

FS_YEAR returned 1980...

Code:
static inline uint16_t FS_YEAR(uint16_t fatDate) {
  return 1980 + (fatDate >> 9);
So the file did not have a date/time... i.e. 0.

Likewise Month:
Code:
static inline uint8_t FS_MONTH(uint16_t fatDate) {
  return (fatDate >> 5) & 0XF;
}
Returned 0 and we subtracted 1 so we get the 255...

We probably should detect this and print no date...
 
Code:
Returned 0 and we subtracted 1 so we get the 255...

We probably should detect this and print no date...
not a bad idea.
 
@KurtE
Looking at Storage.cpp not sure we ever do a UpdateDates call to set a create/modify dates for the index file:
I don't think we should be....

That is for normal local files, the file system is in charge of setting dates and times. We should only manually update the dates if we receive a file from the host and the host says
the dates should be xyz...

I think the main issue is the file is never closed and the FS probably updates this on closure. So value is 0...
 
I don't think we should be....

That is for normal local files, the file system is in charge of setting dates and times. We should only manually update the dates if we receive a file from the host and the host says
the dates should be xyz...

I think the main issue is the file is never closed and the FS probably updates this on closure. So value is 0...

Yep -dates are updated on file close so if its never closed then dates will never be updated.
 
Here is a modified version of:
Code:
void printTime(const DateTimeFields tm) {
  const char *months[12] = {
    "January", "February", "March", "April", "May", "June",
    "July", "August", "September", "October", "November", "December"
  };
  //Serial.printf("(%u %u %u %u %u %u %u):", tm.hour, tm.min, tm.sec, tm.wday, tm.year, tm.mon, tm.mday);
  //Serial.flush();
  // Check for year 1980 and invalid month as indicator that the file did not have a date/time stamp
  if ((tm.year == 80) && (tm.mon == 255)) {
    Serial.print("<No Modify date>");
  } else {
    if (tm.hour < 10) Serial.print('0');
    Serial.print(tm.hour);
    Serial.print(':');
    if (tm.min < 10) Serial.print('0');
    Serial.print(tm.min);
    Serial.print("  ");
    Serial.print(months[tm.mon]);
    Serial.print(" ");
    Serial.print(tm.mday);
    Serial.print(", ");
    Serial.print(tm.year + 1900);
  }
}
Code:
Initializing SD card...initialization done.
222/
  aaa.txt                                         256    17:18  December 17, 2021
  bbb.txt                                         512    17:18  December 17, 2021
  ccc.txt                                         768    17:18  December 17, 2021
333/
  aaa.txt                                         256    17:18  December 17, 2021
  bbb.txt                                         512    17:18  December 17, 2021
  ccc.txt                                         768    17:18  December 17, 2021
111/
  aaa.txt                                         256    17:18  December 17, 2021
  bbb.txt                                         512    17:18  December 17, 2021
  ccc.txt                                         768    17:18  December 17, 2021
mtpindex.dat                                        0    <No Modify date>
done!
 
Looks like we have the same code in 3 different sketches, this one as well as the two in LittleFS(ListFiles and LittleFS_Program_Simple_Datalogger-dates)

Edit: but this may be specific to SD as of their differences in date/time storage
 
@Paul @mjs513, could fix in the example as I showed above.

Or maybe better: in SD.h

Code:
	virtual bool getCreateTime(DateTimeFields &tm) {
		uint16_t fat_date, fat_time;
		if (!sdfatfile.getCreateDateTime(&fat_date, &fat_time)) return false;
		if ((fat_date == 0) && (fat_time == 0)) return false;
		tm.sec = FS_SECOND(fat_time);
		tm.min = FS_MINUTE(fat_time);
		tm.hour = FS_HOUR(fat_time);
		tm.mday = FS_DAY(fat_date);
		tm.mon = FS_MONTH(fat_date) - 1;
		tm.year = FS_YEAR(fat_date) - 1900;
		return true;
	}
	virtual bool getModifyTime(DateTimeFields &tm) {
		uint16_t fat_date, fat_time;
		if (!sdfatfile.getModifyDateTime(&fat_date, &fat_time)) return false;
		if ((fat_date == 0) && (fat_time == 0)) return false;
		tm.sec = FS_SECOND(fat_time);
		tm.min = FS_MINUTE(fat_time);
		tm.hour = FS_HOUR(fat_time);
		tm.mday = FS_DAY(fat_date);
		tm.mon = FS_MONTH(fat_date) - 1;
		tm.year = FS_YEAR(fat_date) - 1900;
		return true;
	}
Note I added the lines: if ((fat_date == 0) && (fat_time == 0)) return false;
Code:
Initializing SD card...initialization done.
222/
  aaa.txt                                         256    17:18  December 17, 2021
  bbb.txt                                         512    17:18  December 17, 2021
  ccc.txt                                         768    17:18  December 17, 2021
333/
  aaa.txt                                         256    17:18  December 17, 2021
  bbb.txt                                         512    17:18  December 17, 2021
  ccc.txt                                         768    17:18  December 17, 2021
111/
  aaa.txt                                         256    17:18  December 17, 2021
  bbb.txt                                         512    17:18  December 17, 2021
  ccc.txt                                         768    17:18  December 17, 2021
mtpindex.dat                                        0
done!

This feels cleaner to me... So did PR
https://github.com/PaulStoffregen/SD/pull/39
 
Hello. I have upgraded my project to Arduino 1.8.19 because Log4J problem, and I upgrade Teensyduino to 1.56 Beta6. And now when I compile my project using this https://github.com/wwatson4506/UsbMscFat library, I obtain this error:

C:\Users\bobiller\Documents\Arduino\libraries\UsbMscFat-UsbMscFat\src\PFsLib\PFsExFatFormatter.cpp: In member function 'bool PFsExFatFormatter::format(PFsVolume&, uint8_t*, print_t*)':
C:\Users\bobiller\Documents\Arduino\libraries\UsbMscFat-UsbMscFat\src\PFsLib\PFsExFatFormatter.cpp:105:5: error: 'DBG_FAIL_MACRO' was not declared in this scope
DBG_FAIL_MACRO;

Before with 1.8.15 and Teensy 1.55 there isn't this error.
 
Status
Not open for further replies.
Back
Top