Teensyduino 1.54 Beta #4

Status
Not open for further replies.
@Paul and others...

And again something completely random...

Over the last few days, been hit again with people needing to increase the RX and/or TX buffers of Serial ports to get there stuff to work. Fixed it for T4... Wondering if worth it for T3.x/LC -

So far I hacked up the same type changes for Serial 1 (have not done 2-8 yet) as not sure if this is something desired or not

I pushed up the changes into the branch: https://github.com/KurtE/cores/tree/T3X_SerialX_AddMemory

Again only Serial1 done so far. Question is, is it worth completing?

Also would probably need some help testing once completed.

Again played a little more and did the changes for Serial2-6 have not done the LPUART (Serial6 on T3.6). Ran simple test code USBToSerial to make sure I could at least ring back each of the serial ports.

Code:
/* USB to Serial - Teensy becomes a USB to Serial converter
   http://dorkbotpdx.org/blog/paul/teensy_as_benito_at_57600_baud

   You must select Serial from the "Tools > USB Type" menu

   This example code is in the public domain.
*/

// set this to the hardware serial port you wish to use
#define HWSERIAL Serial5
uint8_t tx_buffer[128];
uint8_t rx_buffer[128];

unsigned long baud = 19200;
const int reset_pin = 4;
const int led_pin = 13;  // 13 = Teensy 3.X & LC
                         // 11 = Teensy 2.0
                         //  6 = Teensy++ 2.0
void setup()
{
  pinMode(led_pin, OUTPUT);
  digitalWrite(led_pin, LOW);
  digitalWrite(reset_pin, HIGH);
  pinMode(reset_pin, OUTPUT);
  Serial.begin(baud);	// USB, communication to PC or Mac
  HWSERIAL.begin(baud);	// communication to hardware serial
  HWSERIAL.addMemoryForRead(rx_buffer, sizeof(rx_buffer));
  HWSERIAL.addMemoryForWrite(tx_buffer, sizeof(tx_buffer));
}

long led_on_time=0;
byte buffer[80];
unsigned char prev_dtr = 0;

void loop()
{
  unsigned char dtr;
  int rd, wr, n;

  // check if any data has arrived on the USB virtual serial port
  rd = Serial.available();
  if (rd > 0) {
    // check if the hardware serial port is ready to transmit
    wr = HWSERIAL.availableForWrite();
    Serial.printf("(%d : %d)\n", rd, wr);
    if (wr > 0) {
      // compute how much data to move, the smallest
      // of rd, wr and the buffer size
      if (rd > wr) rd = wr;
      if (rd > 80) rd = 80;
      // read data from the USB port
      n = Serial.readBytes((char *)buffer, rd);
      // write it to the hardware serial port
      HWSERIAL.write(buffer, n);
      // turn on the LED to indicate activity
      digitalWrite(led_pin, HIGH);
      led_on_time = millis();
    }
  }

  // check if any data has arrived on the hardware serial port
  rd = HWSERIAL.available();
  if (rd > 0) {
    // check if the USB virtual serial port is ready to transmit
    wr = Serial.availableForWrite();
    if (wr > 0) {
      // compute how much data to move, the smallest
      // of rd, wr and the buffer size
      if (rd > wr) rd = wr;
      if (rd > 80) rd = 80;
      // read data from the hardware serial port
      n = HWSERIAL.readBytes((char *)buffer, rd);
      // write it to the USB port
      Serial.write(buffer, n);
      // turn on the LED to indicate activity
      digitalWrite(led_pin, HIGH);
      led_on_time = millis();
    }
  }

  // check if the USB virtual serial port has raised DTR
  dtr = Serial.dtr();
  if (dtr && !prev_dtr) {
    digitalWrite(reset_pin, LOW);
    delayMicroseconds(250);
    digitalWrite(reset_pin, HIGH);
  }
  prev_dtr = dtr;

  // if the LED has been left on without more activity, turn it off
  if (millis() - led_on_time > 3) {
    digitalWrite(led_pin, LOW);
  }

  // check if the USB virtual serial wants a new baud rate
  if (Serial.baud() != baud) {
    baud = Serial.baud();
    if (baud == 57600) {
      // This ugly hack is necessary for talking
      // to the arduino bootloader, which actually
      // communicates at 58824 baud (+2.1% error).
      // Teensyduino will configure the UART for
      // the closest baud rate, which is 57143
      // baud (-0.8% error).  Serial communication
      // can tolerate about 2.5% error, so the
      // combined error is too large.  Simply
      // setting the baud rate to the same as
      // arduino's actual baud rate works.
      HWSERIAL.begin(58824);
    } else {
      HWSERIAL.begin(baud);
    }
  }
}
Again would be better to get some more testing, but wondering if this is something we would like in PR?

Some of the subtle things to test out include things like the watermarks and when to assert the RTS.
 
512GB and 1TB = very surreal. When I ordered the 512GB samsung was kind of nervous but worked, was nervous about the 1TB card.

Together with the normal cards, I ordered one of the cheap no-name 512GB cards with the assumption it's really just 32 or 64 and would likely get corrupted if more is written. Last night I copied 390GB of MP3 files onto that card. Right now I'm listening to one of the first group copied. I'm still expecting the capacity claim to be a lie, but the fact that it's working at all seems pretty amazing!
 
Here are 2 different Amazon page with cards that look identical. Both seems to be EVO Select U1.

https://www.amazon.com/Samsung-Select-Memory-MB-ME32DA-AM/dp/B01DOB6Y5Q/

https://www.amazon.com/Samsung-MicroSDHC-Adapter-MB-ME32GA-AM/dp/B06XWN9Q99/

But one is part number "MB-ME32DA/AM", the other is "MB-ME32GA/AM". I have no idea if the "D" vs "G" is meaningful.

Any idea if the card you're using is either if "DA/AM" or "GA/AM", or maybe even a 3rd part number that also looks identical?

Just tested both chips on the T4.2 on the BuiltinSDCard and on the T3.2 with an external Card reader, both worked no problem. Also tested with an external card reader on a T4.0.

Code:
T4.1 on Internal Card Reader - Samsung EVO MB-ME32GA/AM

Cardinfo.ino

Initializing SD card...Wiring is correct and a card is present.

Card type: SDHC

Volume type is FAT32

Volume size (Kbytes): 31248384
Volume size (Mbytes): 30516

ListFiles.ino

Initializing SD card...initialization done.
System Volume Information/
	IndexerVolumeGuid		76
raven-node-sch.pdf		82781
IMXRT1050RM.pdf		36713248
2016-12-22T20_37_57.578Z-teensy-can-dual-pinout.jpg		202297
Teensy32Node.pdf		84008
SN65HVD230-CAN-Board-Schematic.pdf		55749
RavenNode-cca.pdf		67259
sn65hvd233??.jpg		107405
5.jpg		10016
done!

---------------------------------------------------

T3,2 External Card Reader
Initializing SD card...initialization done.
System Volume Information/
	IndexerVolumeGuid		76
raven-node-sch.pdf		82781
IMXRT1050RM.pdf		36713248
2016-12-22T20_37_57.578Z-teensy-can-dual-pinout.jpg		202297
Teensy32Node.pdf		84008
SN65HVD230-CAN-Board-Schematic.pdf		55749
RavenNode-cca.pdf		67259
sn65hvd233??.jpg		107405
5.jpg		10016
done!

-------------------------------------------
-------------------------------------------
T3,2 External Card Reader - Samsung EVO MB-ME32DA/AM 
ListFiles.ino

Initializing SD card...initialization done.
System Volume Information/
	IndexerVolumeGuid		76
USB_Host_Shield_Library_2.0_T4/
	address.h		10297
	adk.cpp		12820
	adk.h		4544
	avrpins.h		42758
	BTD.cpp		62734
	BTD.h		25536
	BTHID.cpp		22599
	BTHID.h		5438
	cdcacm.cpp		11286
	cdcacm.h		9665
	cdcftdi.cpp		11747
	cdcftdi.h		5764
	cdcprolific.cpp		6712
	cdcprolific.h		6693
	cdc_XR21B1411.cpp		5872
	cdc_XR21B1411.h		13301
	confdescparser.h		10372
	controllerEnums.h		5090
	gpl2.txt		18009
	hexdump.h		2136
	hidboot.cpp		7955
	hidboot.h		21296
	hidcomposite.cpp		12848
	hidcomposite.h		3614
	hidescriptorparser.cpp		58835
	hidescriptorparser.h		6899
	hiduniversal.cpp		13307
	hiduniversal.h		3636
	hidusagestr.h		54645
	hidusagetitlearrays.cpp		28774
	keywords.txt		7989
	library.json		1185
	library.properties		773
	macros.h		3986
	masstorage.cpp		42701
	masstorage.h		19504
	max3421e.h		6166
	max_LCD.cpp		7110
	max_LCD.h		3045
	message.cpp		3016
	message.h		2579
	parsetools.cpp		2292
	parsetools.h		3933
	printhex.h		2237
	PS3BT.cpp		32398
	PS3BT.h		9712
	PS3Enums.h		4246
	PS3USB.cpp		22951
	PS3USB.h		11651
	PS4BT.h		4711
	PS4Parser.cpp		6149
	PS4Parser.h		14364
	PS4USB.h		4915
	PSBuzz.cpp		3652
	PSBuzz.h		6843
	README.md		20303
	settings.h		6508
	sink_parser.h		1173
	SPP.cpp		47409
	SPP.h		8473
	Usb.cpp		35086
	Usb.h		1177
	UsbCore.h		13389
	usbhid.cpp		4897
	usbhid.h		7496
	usbhost.h		20866
	usbhub.cpp		14143
	usbhub.h		12062
	usbh_midi.cpp		22363
	usbh_midi.h		3793
	usb_ch9.h		9649
	version_helper.h		4783
	Wii.cpp		73759
	Wii.h		17918
	WiiCameraReadme.md		913
	xboxEnums.h		1683
	XBOXOLD.cpp		12016
	XBOXOLD.h		6729
	XBOXONE.cpp		17687
	XBOXONE.h		9447
	XBOXRECV.cpp		23171
	XBOXRECV.h		11050
	XBOXUSB.cpp		13099
	XBOXUSB.h		8567
	examples/
		acm/
			acm_terminal/
				acm_terminal.ino		2325
				pgmstrings.h		2803
		adk/
			adk_barcode/
				adk_barcode.ino		2095
			ArduinoBlinkLED/
				ArduinoBlinkLED.ino		2873
			demokit_20/
				demokit_20.ino		2381
			term_test/
				term_test.ino		1678
			term_time/
				term_time.ino		1410
		Bluetooth/
			BTHID/
				BTHID.ino		1880
				KeyboardParser.h		3358
				MouseParser.h		1203
			PS3BT/
				PS3BT.ino		5995
			PS3Multi/
				PS3Multi.ino		5476
			PS3SPP/
				PS3SPP.ino		5314
			PS4BT/
				PS4BT.ino		5365
			SPP/
				SPP.ino		1648
			SPPMulti/
				SPPMulti.ino		2390
			Wii/
				Wii.ino		3638
			WiiBalanceBoard/
				WiiBalanceBoard.ino		1731
			WiiIRCamera/
				WiiIRCamera.ino		4832
			WiiMulti/
				WiiMulti.ino		4595
			WiiUProController/
				WiiUProController.ino		3533
		board_qc/
			board_qc.ino		13849
		cdc_XR21B1411/
			XR_terminal/
				XR_terminal.ino		2155
		ftdi/
			USBFTDILoopback/
				pgmstrings.h		2803
				USBFTDILoopback.ino		2155
		HID/
			le3dp/
				le3dp.ino		1063
				le3dp_rptparser.cpp		1167
				le3dp_rptparser.h		819
			scale/
				scale.ino		1350
				scale_rptparser.cpp		3010
				scale_rptparser.h		1030
			SRWS1/
				SRWS1.cpp		1961
				SRWS1.h		3129
				SRWS1.ino		5890
			USBHIDBootKbd/
				USBHIDBootKbd.ino		2983
			USBHIDBootKbdAndMouse/
				USBHIDBootKbdAndMouse.ino		4331
			USBHIDBootMouse/
				USBHIDBootMouse.ino		1798
			USBHIDJoystick/
				hidjoystickrptparser.cpp		2704
				hidjoystickrptparser.h		808
				USBHIDJoystick.ino		876
			USBHIDMultimediaKbd/
				USBHIDMultimediaKbd.ino		1671
			USBHID_desc/
				pgmstrings.h		2803
				USBHID_desc.ino		1524
		hub_demo/
			hub_demo.ino		11742
			pgmstrings.h		2803
		max_LCD/
			max_LCD.ino		806
		pl2303/
			pl2303_gprs_terminal/
				pl2303_gprs_terminal.ino		2469
			pl2303_gps/
				pl2303_gps.ino		2517
			pl2303_tinygps/
				pl2303_tinygps.ino		6523
			pl2303_xbee_terminal/
				pl2303_xbee_terminal.ino		2885
		PS3USB/
			PS3USB.ino		4722
		PS4USB/
			PS4USB.ino		4571
		PSBuzz/
			PSBuzz.ino		1317
		testusbhostFAT/
			Makefile		1901
			README.md		1229
			testusbhostFAT.ino		31718
		USBH_MIDI/
			bidirectional_converter/
				bidirectional_converter.ino		3584
			eVY1_sample/
				eVY1_sample.ino		1726
			USBH_MIDI_dump/
				USBH_MIDI_dump.ino		2149
			USB_MIDI_converter/
				USB_MIDI_converter.ino		1821
			USB_MIDI_converter_multi/
				USB_MIDI_converter_multi.ino		2016
		USB_desc/
			pgmstrings.h		2803
			USB_desc.ino		9507
		Xbox/
			XBOXOLD/
				XBOXOLD.ino		3718
			XBOXONE/
				XBOXONE.ino		4064
			XBOXRECV/
				XBOXRECV.ino		4469
			XBOXUSB/
				XBOXUSB.ino		3599
5.jpg		10016
069_181.pdf		2919298
74HC_HCT1G125.pdf		198107
301_canopen (1).pdf		1313731
done!
------------------------------------------------
T4.2 Builtin-SDCARD - ListFiles.ino
Initializing SD card...initialization done.
System Volume Information/
	IndexerVolumeGuid		76
USB_Host_Shield_Library_2.0_T4/
	address.h		10297
	adk.cpp		12820
	adk.h		4544
	avrpins.h		42758
	BTD.cpp		62734
	BTD.h		25536
	BTHID.cpp		22599
	BTHID.h		5438
	cdcacm.cpp		11286
	cdcacm.h		9665
	cdcftdi.cpp		11747
	cdcftdi.h		5764
	cdcprolific.cpp		6712
	cdcprolific.h		6693
	cdc_XR21B1411.cpp		5872
	cdc_XR21B1411.h		13301
	confdescparser.h		10372
	controllerEnums.h		5090
	gpl2.txt		18009
	hexdump.h		2136
	hidboot.cpp		7955
	hidboot.h		21296
	hidcomposite.cpp		12848
	hidcomposite.h		3614
	hidescriptorparser.cpp		58835
	hidescriptorparser.h		6899
	hiduniversal.cpp		13307
	hiduniversal.h		3636
	hidusagestr.h		54645
	hidusagetitlearrays.cpp		28774
	keywords.txt		7989
	library.json		1185
	library.properties		773
	macros.h		3986
	masstorage.cpp		42701
	masstorage.h		19504
	max3421e.h		6166
	max_LCD.cpp		7110
	max_LCD.h		3045
	message.cpp		3016
	message.h		2579
	parsetools.cpp		2292
	parsetools.h		3933
	printhex.h		2237
	PS3BT.cpp		32398
	PS3BT.h		9712
	PS3Enums.h		4246
	PS3USB.cpp		22951
	PS3USB.h		11651
	PS4BT.h		4711
	PS4Parser.cpp		6149
	PS4Parser.h		14364
	PS4USB.h		4915
	PSBuzz.cpp		3652
	PSBuzz.h		6843
	README.md		20303
	settings.h		6508
	sink_parser.h		1173
	SPP.cpp		47409
	SPP.h		8473
	Usb.cpp		35086
	Usb.h		1177
	UsbCore.h		13389
	usbhid.cpp		4897
	usbhid.h		7496
	usbhost.h		20866
	usbhub.cpp		14143
	usbhub.h		12062
	usbh_midi.cpp		22363
	usbh_midi.h		3793
	usb_ch9.h		9649
	version_helper.h		4783
	Wii.cpp		73759
	Wii.h		17918
	WiiCameraReadme.md		913
	xboxEnums.h		1683
	XBOXOLD.cpp		12016
	XBOXOLD.h		6729
	XBOXONE.cpp		17687
	XBOXONE.h		9447
	XBOXRECV.cpp		23171
	XBOXRECV.h		11050
	XBOXUSB.cpp		13099
	XBOXUSB.h		8567
	examples/
		acm/
			acm_terminal/
				acm_terminal.ino		2325
				pgmstrings.h		2803
		adk/
			adk_barcode/
				adk_barcode.ino		2095
			ArduinoBlinkLED/
				ArduinoBlinkLED.ino		2873
			demokit_20/
				demokit_20.ino		2381
			term_test/
				term_test.ino		1678
			term_time/
				term_time.ino		1410
		Bluetooth/
			BTHID/
				BTHID.ino		1880
				KeyboardParser.h		3358
				MouseParser.h		1203
			PS3BT/
				PS3BT.ino		5995
			PS3Multi/
				PS3Multi.ino		5476
			PS3SPP/
				PS3SPP.ino		5314
			PS4BT/
				PS4BT.ino		5365
			SPP/
				SPP.ino		1648
			SPPMulti/
				SPPMulti.ino		2390
			Wii/
				Wii.ino		3638
			WiiBalanceBoard/
				WiiBalanceBoard.ino		1731
			WiiIRCamera/
				WiiIRCamera.ino		4832
			WiiMulti/
				WiiMulti.ino		4595
			WiiUProController/
				WiiUProController.ino		3533
		board_qc/
			board_qc.ino		13849
		cdc_XR21B1411/
			XR_terminal/
				XR_terminal.ino		2155
		ftdi/
			USBFTDILoopback/
				pgmstrings.h		2803
				USBFTDILoopback.ino		2155
		HID/
			le3dp/
				le3dp.ino		1063
				le3dp_rptparser.cpp		1167
				le3dp_rptparser.h		819
			scale/
				scale.ino		1350
				scale_rptparser.cpp		3010
				scale_rptparser.h		1030
			SRWS1/
				SRWS1.cpp		1961
				SRWS1.h		3129
				SRWS1.ino		5890
			USBHIDBootKbd/
				USBHIDBootKbd.ino		2983
			USBHIDBootKbdAndMouse/
				USBHIDBootKbdAndMouse.ino		4331
			USBHIDBootMouse/
				USBHIDBootMouse.ino		1798
			USBHIDJoystick/
				hidjoystickrptparser.cpp		2704
				hidjoystickrptparser.h		808
				USBHIDJoystick.ino		876
			USBHIDMultimediaKbd/
				USBHIDMultimediaKbd.ino		1671
			USBHID_desc/
				pgmstrings.h		2803
				USBHID_desc.ino		1524
		hub_demo/
			hub_demo.ino		11742
			pgmstrings.h		2803
		max_LCD/
			max_LCD.ino		806
		pl2303/
			pl2303_gprs_terminal/
				pl2303_gprs_terminal.ino		2469
			pl2303_gps/
				pl2303_gps.ino		2517
			pl2303_tinygps/
				pl2303_tinygps.ino		6523
			pl2303_xbee_terminal/
				pl2303_xbee_terminal.ino		2885
		PS3USB/
			PS3USB.ino		4722
		PS4USB/
			PS4USB.ino		4571
		PSBuzz/
			PSBuzz.ino		1317
		testusbhostFAT/
			Makefile		1901
			README.md		1229
			testusbhostFAT.ino		31718
		USBH_MIDI/
			bidirectional_converter/
				bidirectional_converter.ino		3584
			eVY1_sample/
				eVY1_sample.ino		1726
			USBH_MIDI_dump/
				USBH_MIDI_dump.ino		2149
			USB_MIDI_converter/
				USB_MIDI_converter.ino		1821
			USB_MIDI_converter_multi/
				USB_MIDI_converter_multi.ino		2016
		USB_desc/
			pgmstrings.h		2803
			USB_desc.ino		9507
		Xbox/
			XBOXOLD/
				XBOXOLD.ino		3718
			XBOXONE/
				XBOXONE.ino		4064
			XBOXRECV/
				XBOXRECV.ino		4469
			XBOXUSB/
				XBOXUSB.ino		3599
5.jpg		10016
069_181.pdf		2919298
74HC_HCT1G125.pdf		198107
301_canopen (1).pdf		1313731
done!
 
Thanks @mjs513,
Will retest the one I have, maybe with some other external SD reader. Like maybe one on an Adafruit display board... The one I was using was a sparkfun one with level shifters, which should work for 3.3 or 5v, but who knows, maybe something maybe sensitive on these type cards with signals coming and going through TXB104 shifters.

Note: I just ordered one of each also... Although for the one that supposedly matches the one I already had (cheaper one), I upped it to the 64mb version.
 
Hi @Paul and @mjs513
Thanks @mjs513,
Will retest the one I have, maybe with some other external SD reader. Like maybe one on an Adafruit display board... The one I was using was a sparkfun one with level shifters, which should work for 3.3 or 5v, but who knows, maybe something maybe sensitive on these type cards with signals coming and going through TXB104 shifters.

Note: I just ordered one of each also... Although for the one that supposedly matches the one I already had (cheaper one), I upped it to the 64mb version.
Sort of interesting that I retried the one on the Sparkfun board and it failed again. Several other MicroSds worked. This is a T4

I then hooked up Adafruit ST7789 display to second T4 and hooked up the SDCS pin from the display to pin 4... And the Samsung EVO SDHC worked... Will be interesting to see when the two other arrive.
 
A question about the SD wrapper for SDFat: Will I be able to use the sync() function if I use only SD.h? I've found that the sync() function is very helpful in long data logging sessions for two reasons: 1: it updates the directory so you can minimize data loss if the logger loses power in the middle of a logging session, 2: calling sync() puts the SD card into idle mode which significantly reduces power consumption. https://forum.pjrc.com/threads/59526-Low-Power-logging-and-sync()-in-EXFat
 
A question about the SD wrapper for SDFat: Will I be able to use the sync() function if I use only SD.h?

Use SD.flush(), which is calling sdfat's sync().
Or use SD.sdfs.sync();
SD.sdfs is declared public , so you can use sdfat functions directly.
 
Quick update: I went ahead and ordered a couple more of the Samsung EVO Select cards and will try them out again. In particular will be interesting to see if the two new ones act different than the ones I ordered maybe two years ago in the top of the picture. The 3 32gb ones are marked in small letters under the EVO Select as HC... The 64 is marked XC

IMG_1260.jpg

Again no idea how different they are both will write up to 20mb/s the HC one is marked Read up to 95 and the XC up to 100MB....
 
Quick update: The Sparkfun adapter appears to be able to work with both of these... So for the heck of it, I am right now using SDFormatter on one of the old ones to completely erase and overwrite it and will see if it likes it then... It is taking awhile to do the full overwrite.
 
Ok I did a complete low level reformat of one of the older ones, which created one Fat32 drive... I tried it again on the Sparkfun SPI adapter Pin 4 and it failed to initialize again. Tried it on different T4 with Adafruit display and SDCard connected again on Pin 4 and it reads the SD... Maybe I should go ping this to Sparkfun!

Edit: Emailed Sparkfun... Also including photo of back showing the two old ones and the new one.
screenshot.jpg
The one on left is new one.. Same top number but different second number... Probably some hardware revision happened.
 
Last edited:
I don't have any of the EVO Selects, but I have been doing my own playing and bench testing of cards on a 4.1, 1-54B4, with the Built in reader and FIFO_SDIO. All of these cards have worked. I can even read two "bricked" cards that nothing else seems to want to. (marked with X in bottom of pic. Most of the cards write in the 12-18MB/s range, and almost all of them will read around 22.8MB/s. The old Samsung pro writes faster than the newer one. (20 vs 17 MB/s). All cards tested were empty and freshly formatted with SDCardFormmatterV5.
CardsTested.png

These are my fastest cards. these will all write roughly 20.8MB/s, and read at roughly 22.8MB/s. The most consistent between all the tests has been the SanDiskExtreme 16GB U3. The Fastest is one of my older 32GB EVO cards that writes @ 21.3 and reads @ 23.0
FastestSDs4-1.png

Samsung EVO 32 U1
Code:
size,write,read
bytes,KB/sec,KB/sec
512,21288.45,22891.92
1024,21285.16,22923.83
2048,21332.41,22983.87
4096,21374.75,23011.87
8192,21386.53,23026.59
16384,21257.38,23056.84
32768,21392.58,23034.99




EDIT:
Interesting. Reformatted the SanDisk Extreme 16GB to ExFat, and both the read and write performance went up

Code:
size,write,read
bytes,KB/sec,KB/sec
512,22460.24,22897.86
1024,22106.87,22930.97
2048,22570.83,22979.84
4096,22183.46,23007.13
8192,22612.27,23020.65
16384,22181.35,23027.03
32768,22622.08,23030.95
 
Last edited:
These numbers suggest we are using High Speed Mode (25 MB/s) 50mhz-4bit clocking and not UHS clocking. Wonder if the hardware can handle at least the slower 100Mhz UHS clock and 50MB/s. I won't beg for the 208MHz rate of 104MB/s...

LB

The CPU Spec sheet looks promising for even the higher UHS-1 spec
Teensy4-1SDspecs.png

I've dug through the code and don't see any support for UHS-1. Would probably take a bit of work to do more than a hack job of it. Probably be a good "Feature Request'
 
Last edited:
From what I'm reading in the CPU specs and manual, That can be done using the SD/SDIO interfaces. Data sheets are here https://www.pjrc.com/teensy/datasheets.html
High level DataSheet: https://www.pjrc.com/teensy/IMXRT1060CEC_rev0_1.pdf
Deep dive Manual: https://www.pjrc.com/teensy/IMXRT1060RM_rev2.pdf

From page 1376 of the processor manual

Code:
2[B][I]4.3 eMMC/eSD/SDIO[/I][/B]
This chip has two Ultra Secured Digital Host Controller (uSDHC) modules for SD/
eMMC interface. It provides the interface between the host system and the SD/
SDIO/MMC cards.
The key features include:
• Support SD/SDIO standard, up to version 3.0
• Support MMC standard, up to version 4.5
• Support 3.3V and 1.8V operation, but do not support 1.2V operation.
• Supports 1-bit / 4-bit SD and SDIO modes, 1-bit / 4-bit / 8-bit MMC modes
• Up to 800 Mbps of data transfer for SDIO cards using 4 parallel data lines in
SDR mode
• Up to 400 Mbps of data transfer for SDIO card using 4 parallel data lines in
DDR mode
• Up to 800 Mbps of data transfer for SDXC cards using 4 parallel data lines in
SDR mode
• Up to 400 Mbps of data transfer for SDXC card using 4 parallel data lines in
DDR mode
• Up to 1600 Mbps of data transfer for MMC cards using 8 parallel data lines in
SDR mode
• Up to 800 Mbps of data transfer for MMC cards using 8 parallel data lines in
DDR mode
eMMC/eSD/SDIO

[B]i.MX RT1060 Processor Reference Manual, Rev. 2, 12/2019
1376 NXP Semiconductor[/B]

EDIT: So full UHS-1 support "should" be possible on the T4.0 and T4.1 as long as the SD card is connected to one of the two SDIO interfaces.

EDIT2: There is also a whole section on setting up SD/SDIO boot with UHS-1 support....

EDIT3: On the T4.0, you need to use the SD Card (4 bit SDIO) flats on the bottom of the board and an SD card Connector/module with NO level converters.
https://www.digikey.com/en/products/detail/molex,-llc/5031821852/5823232 or https://www.digikey.com/en/products/detail/molex/0475710001/3262277
card10b_rev1_web.png
 
Last edited:
New TeamGroup 256 GB SD card. From NewEgg : newegg.com/team-128gb-microsdxc
20201113_111002.jpg

SD\cardinfo.ino gives:
Code:
Initializing SD card...Wiring is correct and a card is present.

Card type: SDHC

Volume type is FAT64

Volume size (Kbytes): 250281984
Volume size (Mbytes): 244416

...\teensy\avr\libraries\SdFat-beta\examples\SdInfo\SdInfo.ino gives more info and works:
Code:
type any character to start
init time: 8 ms

Card type: SDXC

Manufacturer ID: 0X12
OEM ID: 4V
Product: SD   
Version: 1.0
Serial number: 0X6B13A014
Manufacturing date: 9/2014

cardSize: 256355.86 MB (MB = 1,000,000 bytes)
flashEraseSize: 128 blocks
eraseSingleBlock: true

OCR: 0XC0FF8000

SD Partition Table
part,boot,bgnCHS[3],type,endCHS[3],start,length
1,0X0,0X14,0X11,0X4,0X7,0XFE,0XFF,0XFF,65536,500629504
2,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
3,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
4,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0

Scanning FAT, please wait.

Volume is exFAT
sectorsPerCluster: 512
clusterCount:      977664
freeClusterCount:  977661
fatStartSector:    98304
dataStartSector:   131072

This sketch won't compile as installed with 'SD_FAT_TYPE = 0' : T:\arduino-1.8.13_t54\hardware\teensy\avr\libraries\SdFat-beta\examples\bench\bench.ino
Code:
"T:\\TEMP\\arduino_build_bench.ino\\sketch\\bench.ino.cpp.o"
T:\arduino-1.8.13_t54\hardware\teensy\avr\libraries\SdFat-beta\examples\bench\bench.ino:69:1: error: 'File' does not name a type
 File file;
 ^
T:\arduino-1.8.13_t54\hardware\teensy\avr\libraries\SdFat-beta\examples\bench\bench.ino: In function 'void loop()':
T:\arduino-1.8.13_t54\hardware\teensy\avr\libraries\SdFat-beta\examples\bench\bench.ino:167:8: error: 'file' was not declared in this scope
   if (!file.open("bench.dat", O_RDWR | O_CREAT | O_TRUNC)) {
        ^
T:\arduino-1.8.13_t54\hardware\teensy\avr\libraries\SdFat-beta\examples\bench\bench.ino:190:5: error: 'file' was not declared in this scope
     file.truncate(0);
     ^
T:\arduino-1.8.13_t54\hardware\teensy\avr\libraries\SdFat-beta\examples\bench\bench.ino:233:5: error: 'file' was not declared in this scope
     file.rewind();
     ^
T:\arduino-1.8.13_t54\hardware\teensy\avr\libraries\SdFat-beta\examples\bench\bench.ino:269:3: error: 'file' was not declared in this scope
   file.close();
   ^
Using library SdFat-beta at version 2.0.0-beta.8 in folder: T:\arduino-1.8.13_t54\hardware\teensy\avr\libraries\SdFat-beta

Changing this to #3 works for this disk and compiles:
Code:
// SD_FAT_TYPE = 0 for SdFat/File as defined in SdFatConfig.h,
// 1 for FAT16/FAT32, 2 for exFAT, 3 for FAT16/FAT32 and exFAT.
#define SD_FAT_TYPE 0

Read and write speed looks GOOD at 21 MB/s Write and 22 MB/s Read:
Code:
Type any character to start
FreeStack: 441472
Type is exFAT
Card size: 256.36 GB (GB = 1E9 bytes)

Manufacturer ID: 0X12
OEM ID: 4V
Product: SD   
Version: 1.0
Serial number: 0X6B13A014
Manufacturing date: 9/2014

FILE_SIZE_MB = 5
BUF_SIZE = 512 bytes
Starting write test, please wait.

write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
21095.70,47,22,23
21007.06,47,23,23

Starting read test, please wait.

read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
22725.82,23,22,22
22829.59,23,22,22

Done

Then ran ...\teensy\avr\libraries\SdFat-beta\examples\ExFatFormatter\ExFatFormatter.ino
That worked and above bench.ino gave similar results
 
Is there any chance of making the text entry box and "Send" button at the bottom of the Serial Plotter actually send data to the Teensy? The plotter is occasionally useful when I want to view an ADC input waveform without having to send the data to the PC and using a separate plotting program. It would be nice to be able to start and stop the Teensy output with command characters sent from the plotter instead of having to switch back to the Serial Monitor.

Is this something outside the control of PJRC, or just a low-priority task?
 
I think I just answered my own question. Recalling the difficulties with double-spaced cut and pasted Serial Monitor output that disappeared when you choose the port from "serial ports" instead of "Teensy Ports", I switched to the "Serial Port" and lo and behold, text from the text box gets sent to the Teensy!
 
I think I just answered my own question. Recalling the difficulties with double-spaced cut and pasted Serial Monitor output that disappeared when you choose the port from "serial ports" instead of "Teensy Ports", I switched to the "Serial Port" and lo and behold, text from the text box gets sent to the Teensy!

Good find that IDE SerMon Serial does that. Was going to suggest use TyCommander with DualSerial - let IDE Teensy SerMon OWN and do plotting and then the 2nd Serial in TyComm would allow command and also any debug spew.
 
Here is my latest attempt to fix the double spaced lines on copy to clipboard from the serial monitor on Windows.

Extract this zip file and copy teensy_serialmon.exe to {Arduino}/hardware/tools, replacing the existing file. Windows probably won't let you replace it if the serial monitor is open. The default Arduino location is C:\Program Files (x86)\Arduino.

I ran a quick test here on Windows 10 where it seems to work. Does this solve the double spaced lines on your Windows machine?
 

Attachments

  • teensy_serialmon_windows.zip
    22.4 KB · Views: 93
@Paul - that works here on Windows 10:
Code:
 Blink again - w/println - before bare println

 Blink again - w/println - after bare println - end loop.
 Blink again - w/println - before bare println

 Blink again - w/println - after bare println - end loop.
 Blink again - w/println - before bare println

 Blink again - w/println - after bare println - end loop.

<EDIT> :: This is NOT new behavior - just put back another copy of that file from another 1.54 beta install - and it has the same ODD behavior

Note: Text select to copy does odd shift of selected text - rather than inverse text color on highlight and stay steady - some lines toggle inverted text color to not visible?
Movie too big - here are three frames ...
1toggle.png2toggle.png3toggle.png
 
@Paul
Seems to work for me here as well. This is a direct copy past from the serial monitor:

Code:
LittleFS Test
flash begin
Flash ID: EF 70 18
Flash size is 16.00 Mbyte
attemping to mount existing media
success
started
printDirectory
--------------
FILE	PRINTOUTPUT1.txt		628
FILE	PRINTOUTPUT2.txt		630
FILE	file1.txt		32
FILE	file10.txt		16
FILE	file2.txt		32
FILE	file20.txt		16
FILE	file3.txt		32
FILE	file30.txt		16
FILE	mtpindex.dat		0
DIR	structuredData / 
	FILE	logger.txt		480
DIR	test1 / 
	FILE	file1.txt		16
DIR	test2 / 
	FILE	file2.txt		16
DIR	test3 / 
	FILE	file3.txt		16

Disk Usuage:
Bytes Used: 53248, Bytes Total:16777216
Before always extra lines. So looks good from my test.
 
Status
Not open for further replies.
Back
Top