Teensy 4 no SD-Card-found

mech

New member
Hello everyone,

i'm using this breakout-board: https://www.tindie.com/products/cburgess129/arduino-teensy4-teensy-40-expansion-board/#specs as preassembled version.
Since now i got something working with I2C and Wifi and a really basic type of http-server that will return some json, now i wanted to save some Data to an SD-Card, but it wont work :(

Tested example:
Code:
#include <SD.h>
#include <SPI.h>
Sd2Card card;
//SPI.setMOSI(7);  // Audio shield has MOSI on pin 7
//SPI.setSCK(14);  // Audio shield has SCK on pin 14  
void setup()
{
	Serial.begin(9600);
	master.begin(400 * 1000U);
	pinMode(led, OUTPUT);
	// configured = configure_sensor();
	delay(2000);
	
    if (!card.init(SPI_HALF_SPEED, BUILTIN_SDCARD)) {
    Serial.println("initialization failed. Things to check:");
    Serial.println("* is a card inserted?");
    Serial.println("* is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");
    return;
  } else {
   Serial.println("Wiring is correct and a card is present.");
  }
}
of course outputs the help-text

i'm developing with VSCode and PlatformIO, but also with Arduino 1.8.16 its the same ...
if i print BUILTIN_SDCARD i get "254" - is that correct?

Based on https://www.pjrc.com/teensy/card10b_rev2_web.pdf shouln't i set setMOSI to 35?

Currently i don't know where to start searching for the cause because i'm fairly new to this :(

the card is a sandisc 32GB, the smallest i could found in mediamarkt ^^
card is formated FAT32 and no problems with SD-Card-Reader in my PC

thanks in advance for any help
 
Recommend using Arduino 1.8.19 and Teensyduino 1.56, at least for testing. With PlatformIO, copies of old libraries are a common problem. So are variation in settings with INI files. Test with the latest Arduino+Teensyduino where we can help knowing exactly what code you're running, and Arduino gives a "known quantity", rather than a system which tends to vary quite a lot. Once the hardware is confirmed working with Arduino, then fiddle with PlatformIO.

Click Arduino's File > Preferences and turn on verbose output during compilation. This causes Arduino to print lots of info while compiling. Near the end it will show you the exact paths of every library it used. Check these carefully. Make sure it's using the ones from {Arduino}/hardware/teensy/avr/libraries. A very common problem we is copies of libraries in {Documents}/Arduino/libraries which override the ones Teensyduino installs. It's easy to waste a lot of time only to finally realize the wrong copy of a library was being used, so check this first.

In Arduino, I recommend using either File > Examples > SD > CardInfo, or File > Examples > SdFat > SdInfo.

If it still can't detect your card, using the latest software and correct libs, then it's time to start looking at the FFC cable between your Teensy 4.0 and that Mega carrier board. I hope you can understand we'll need to see photos to help with that.
 
As Paul mentioned, if it were me, would try with the most recent Arduino and Teensyduinio and see if the basics work.

It looks like an interesting Tindie board.

When you ordered it assembled, was it also purchased with the T4. If so was the connectors soldered on and flex cable connected between the teensy and the board?

Note: when I have done my own soldering of these connectors for myself I found that I often had problems doing so. I also found that sometimes the cables were not fully inserted and/or in straight and would have one or two signals not ring through.

So if you run a standard basic SD example sketch modified for builtin and it does not work. If it were me, I would then probably use meter to ring through and see if I connections or more likely probably run some sketch to see if I detect that io pin.

There are several sketches up on forum doing this, like the HiLow test mentioned several times. I know a version of it is up at:
https://forum.pjrc.com/threads/3875...-(ILI9341_t3n)?p=226808&viewfull=1#post226808

With it, you can use something like a jumper wire, where one end goes to either 3.3v or gnd, and if you touch a pin, it should show which pin connected to. Note; the above sketch you alternate between testing to 3.3v or gnd by hitting enter key in debug monitor...

Note: 2 of the pins are 3.3v and gnd, so you may not want to touch those pins. To give you an idea of which ones are which here is an image of a breakout board I did at one point to plug into MicroSD connector and be able to try out the signals for other things....
screenshot.jpg

I mainly show this image to give an idea of which ones are signal and which ones are power... Pin numbers may not be correct on some boards like T4.1 but...
 
thanks for your responses!

- i've updated arduino and teensyduino
- I've ringed all contacts from teensy-board to expansion-board (all about 0,3 Ohm) (i will mark them in the picture which ones i used)
- SD-library used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD

i've now checked the example "Cardinfo" (identical with the snipped in first post) and get the same error in console ("initialization failed. Things to check:...")

Code:
Memory Usage on Teensy 4.0:
  FLASH: code:45972, data:7080, headers:8384   free for files:1970180
   RAM1: variables:9024, code:44264, padding:21272   free for local variables:449728
   RAM2: variables:12384  free for malloc/new:511904
Mehrere Bibliotheken wurden für "SD.h" gefunden
 Benutzt: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD
 Nicht benutzt: C:\Program Files (x86)\Arduino\libraries\SD
Bibliothek SD in Version 2.0.0 im Ordner: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD  wird verwendet
Bibliothek SdFat in Version 2.1.0 im Ordner: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SdFat  wird verwendet
Bibliothek SPI in Version 1.0 im Ordner: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI  wird verwendet

and of course you wanted some picures:
Screenshot 2022-01-13 160448.png
Screenshot 2022-01-13 160647.jpg
Screenshot 2022-01-13 160711.jpg
Screenshot 2022-01-13 160726.jpg

any other ideas?
i have also some separate sd-card holders that i could connect (though i would have to look for how to), ideally the built in wourd work somehow
 
If it were me, and the pins rang through (And I would check at the SD connector)

I would also try a different test then card info... I have never used it
and wonder about the line: if (!card.init(SPI_HALF_SPEED, BUILTIN_SDCARD)) {...

Like try the test ReadWrite.ino (modified for built in) if that works, then :D
(But someone should update the other sketch)

If not... Not sure
 
Hi, I build and sell these boards.

you can check out the example sketches in my GitHub repo here:

https://github.com/cburgess5294/Arduino-Teensy4

There is a script to test the USB port and the SD card port. Just plug in a mouse or (or wireless mouse dongle) and insert an SD card. The script initializes the SD card and updates a file when mouse movement is detected.

This is the script that is used to test boards that are shipped fully-assembled.

If you can get it to work, send me a private message or reach out to me via Tindie and I will send you a return label so I can look at it.

Chris Burgess
 
The Teensy 4.0 supports the standard SD card library for Arduino with the dedicated SDcard pinout using the connector on the bottom of the board Teensy. You can set chipselect as follows:

const int chipSelect = BUILTIN_SDCARD;

I use this for testing the SDcard slot when I build the boards.
 
thank you all for your support! really!
unfornutaly i won't have time today to check it because of other urgent projects but i will definetly try on monday and i will report back
 
ok, i've tested again with @cburgess129 script (had to download this additional library for it https://github.com/PaulStoffregen/USBHost_t36) and it didn't work :(
then i've connected an external sd-reader via SCK(13) MISO(12) MOSI(11) CS(10) and set chipSelect=10 and it worked! (with the same SD-Card)

i don't know why but ... hey i now have a working sd-card ;)
thank you all for your support

@cburgess129 i won't need a new one, because it's just for development
 
Back
Top