Hystrix
Member
I have a Teensy 3.6 that will hang if there is an SD card in the slot. I have tried three different SD cards and the outcome is the same. All three SD cards work OK in another Teensy 3.6, so the issue seems to be with one Teensy.
The issue is easy to replicate with the following code:
With no SD inserted this is the serial output:
With SD card inserted it hangs at SD.begin:
These are the libraries being used:
Is this a hardware issue? Is there any workaround or known issue that can be resolved?
Many thanks,
Adrian
The issue is easy to replicate with the following code:
Code:
#include <SPI.h>
#include <SD.h>
// Teensy 3.5 & 3.6 SD card
#define SDCARD_CS_PIN BUILTIN_SDCARD
#define SDCARD_MOSI_PIN 11
#define SDCARD_SCK_PIN 13
int16_t check_sd_cards(void)
{
int16_t ret = -1;
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
Serial.println(F("Checking on-board SD (T_3.6)"));
if (SD.begin(SDCARD_CS_PIN))
{
Serial.print(F("Using SD-card on Teensy (T_3.6): "));
Serial.println(SDCARD_CS_PIN, DEC);
ret = SDCARD_CS_PIN;
}
if (ret < 0)
{
Serial.println(F("Cannot find SD card!"));
}
return (ret);
}
void setup() {
while(!Serial);
delay(500); // needed for serial console
int16_t sd = check_sd_cards();
Serial.println(sd, DEC);
}
void loop() {
;
}
With no SD inserted this is the serial output:
Code:
07:47:11.476 -> Checking on-board SD (T_3.6)
07:47:11.509 -> Checking audio-board SD (T_3.6)
07:47:13.504 -> Cannot find SD card!
07:47:13.504 -> -1
With SD card inserted it hangs at SD.begin:
Code:
07:54:19.559 -> Checking on-board SD (T_3.6)
These are the libraries being used:
Code:
Using library SPI at version 1.0 in folder: /home/adrian/arduino-1.8.13/hardware/teensy/avr/libraries/SPI
Using library SD at version 1.2.2 in folder: /home/adrian/arduino-1.8.13/hardware/teensy/avr/libraries/SD
Is this a hardware issue? Is there any workaround or known issue that can be resolved?
Many thanks,
Adrian