SD Card won't start on Audio Shield with Teensy 4.0

I'm having a new issue with my sampler pedal project. Previously, it would work fine (though with some noise, which is a whole other issue) when connected by USB to my laptop, but wouldn't launch when connected to a separate USB power supply. I narrowed it down to it failing at:

Code:
  if (!(SD.begin(SDCARD_CS_PIN))) {
    while (1) { 
//      Serial.println("Unable to access the SD card");
      displayE();
      delay(500);
    }
    displayZero();
  }

It has the same issue with the example code. Now, it fails even when connected to my laptop. I tried re-formatting (FAT32) and reloading the SD card, but it simply won't launch. Is there a chance there's a hardware issue with one board or the other, or with the soldering job (looks fine, but I haven't tested continuity yet)? The SD card works fine when plugged into any other device.
 
I'm having a new issue with my sampler pedal project. Previously, it would work fine (though with some noise, which is a whole other issue) when connected by USB to my laptop, but wouldn't launch when connected to a separate USB power supply. I narrowed it down to it failing at:

Code:
  if (!(SD.begin(SDCARD_CS_PIN))) {
    while (1) { 
//      Serial.println("Unable to access the SD card");
      displayE();
      delay(500);
    }
    displayZero();
  }

It has the same issue with the example code. Now, it fails even when connected to my laptop. I tried re-formatting (FAT32) and reloading the SD card, but it simply won't launch. Is there a chance there's a hardware issue with one board or the other, or with the soldering job (looks fine, but I haven't tested continuity yet)? The SD card works fine when plugged into any other device.

Hard to know...

For example how is your Audio Shield hooked up? Is it the proper Audio Shield for the Teensy 4.x?
What is: SDCARD_CS_PIN set to?
I am assuming pin 10?
Are there other things on your SPI buss?
 
Hard to know...

For example how is your Audio Shield hooked up? Is it the proper Audio Shield for the Teensy 4.x?
What is: SDCARD_CS_PIN set to?
I am assuming pin 10?
Are there other things on your SPI buss?

It was literally working when connected to my laptop before, I changed nothing other than taking it with me somewhere else and back home, and now it's no longer working, and it has never worked on any other USB power supply.

You could try running File > Examples > SD > CardInfo to check if the hardware is detecting your card.

I'll try that, thanks!
 
The boilerplate SD startup code in most of the demos (and which you've essentially copied) is poorly conceived, in that it gives the card just one chance to start, then whinges about it forever. I have an SD card which doesn't always respond on the first try, but usually does if given another chance. Try:
Code:
  while (!(SD.begin(SDCARD_CS_PIN))) 
  {
    //      Serial.println("Unable to access the SD card");
      displayE();
      delay(500);
      displayZero();
  }
I'm assuming here that you'll also take the other excellent advice to check the wiring, soldering, correct CS pin and audio adaptor, SD card is still working etc.!
 
The boilerplate SD startup code in most of the demos (and which you've essentially copied) is poorly conceived, in that it gives the card just one chance to start, then whinges about it forever. I have an SD card which doesn't always respond on the first try, but usually does if given another chance. Try:
Code:
  while (!(SD.begin(SDCARD_CS_PIN))) 
  {
    //      Serial.println("Unable to access the SD card");
      displayE();
      delay(500);
      displayZero();
  }
I'm assuming here that you'll also take the other excellent advice to check the wiring, soldering, correct CS pin and audio adaptor, SD card is still working etc.!

Great idea! I considered that was a likely issue as well, as I could tell if just hard locks if it fails. And yeah, I'll do all the physical diagnostics as well.

Edit: it did not help so far, other than I can now see it making and failing multiple attempts lol Gonna check over the hardware.
 
Ok, so after some further testing, the audio shield works with a tone sweep test, and now I can get the SD Card to launch only if I have a cable plugged into one of my Line Outs and USB connected to my laptop. If I use a different USB power source, it doesn't work, and if I unplug the audio cable, it doesn't work. This, combined with the noise during playback (YouTube link in original post) is making me think I have some sort of grounding issue. Any ideas on how to solve this?
 
Sorry, again hopefully others will have more ideas.

But we are again sort of shooting in the dark, as we are don't see your board and hook ups and the like. Again probably does not help you to say that it works on my boards...

Again posting a picture of your setup might help.

Also showing things like how is the Audio board connected to the T4? Do you have them directly soldered to each other, or have connectors where it plugs directly into each other?
Or do you have them both on your on a board or plugged into breadboards...

But general things I would check include: double check all of the soldering. looking for connections and shorts... I often use some simple continuity test program, which I and Defragster have posted several versions in the past. Simple version of it, simply set all of the IO pins to input_pullup or input_pulldown and then in loop, enumerate all of the pins, and see any pins that are not High or low...
(INPUT_PULLUP -> look for low) (INPUT_PULLDOWN look for HIGH). Then use jumper wire to GND or 3.3v again dependin on which way and walk from pin to pin and see if you are getting the signal there you are expecting...

I would also check for things like each GND pin to see if it actually is connected to GND...

Again as I mentioned in previous post. If you have other SPI devices on your setup other than just the Audio boards, I would check that they are logically pulled HIGH when you are trying to initialize the SD card and whenever the SD stuff is in use.

Do you have a memory chip soldered onto your Audio board? If so is Pin 6 hooked up to use it? Or are you using pin 6 for something else? But again if more than one SPI object is connected up on an SPI buss and more than one have their CS pin low, they might tromp on each other.

Likewise some SPI devices don't work well with others, especially if they connect up the MISO pin. For example some displays don't work well this way and either require being on their own buss, or cut the line if you don't need that data or hook up buffer chip between...
 
Right, sorry, I forgot that I posted the pic in my previous thread.

attachment.php


Boards are connected directly with pins, the only other things connected are the USB extension, the switches (in a 3x3 matrix), the LEDs of the 7 segment display, a MIDI output, and the Line Outs. I don't have a memory chip installed, and pin 6 is currently being used for one of the LEDs, though the pin is still joining it to the Audio Shield as well. Would snipping that pin help? The pins to the left of the board are a common ground strip. Would moving the ground from the Line Outs to the common ground potentially help? I still don't understand why it works when connected through my laptop, but not when connected to a USB power block, and only when there's a cable running from the Line Out to my mixer (also connected to my laptop by USB and power to the same power bar as my laptop). At this point, I'm starting to think giving up on USB power and choosing a different power supply is the way to go, I just want to rule out any other issues before I spend the money and time.
 
I would assume you have tried different USB cables to make sure that there is not a problem... Could be bad power or ground connection. I have had some USB cables that work to some teensy boards but not others...

You need more of the EE type... I am a retired software...

USB power block? Provide enough current? Ground connection not working? Have you measured the voltage between GND and VIN at the Audio board pins when plugged in to power block
Does it give you 5v between them? Does it give you 3.3v between the 3.3v and GND? Are all of the pins connected between Teensy and Audio Shield?
And I assuming Rev D shield.
 
I would assume you have tried different USB cables to make sure that there is not a problem... Could be bad power or ground connection. I have had some USB cables that work to some teensy boards but not others...

You need more of the EE type... I am a retired software...

USB power block? Provide enough current? Ground connection not working? Have you measured the voltage between GND and VIN at the Audio board pins when plugged in to power block
Does it give you 5v between them? Does it give you 3.3v between the 3.3v and GND? Are all of the pins connected between Teensy and Audio Shield?
And I assuming Rev D shield.

The power block should be giving it enough current. I can do the tests on the pins and get back to you. I've only used the one USB cable so far, but if it works when connected to my laptop while there's a cable in the Line Out, then it should work when connected to the USB power block under the same circumstances, and in theory it should work without the cable in the Line Out as well. This is why I'm thinking I have a weird ground loop or fault or something. I can't see any reason why the SD Card should require the Line Out to be connected in order to function. The SD Card reader shouldn't really be connected directly to the audio circuits anyways.
 
It should not require it... I have never needed to hook up anything that way... But I don't use Audio except for testing..

But feels like a bad ground circuit... And yes in theory if plugged into one thing works and another not... Should be the same, but maybe pads one of the connectors is warn, or anodized or ...
Or one connector is slightly looser than another and does not make good contact. Again I have been hit where same cable works for somethings, fails on others, so that is one of the first things I try out when I get something strange going on.
 
It should not require it... I have never needed to hook up anything that way... But I don't use Audio except for testing..

But feels like a bad ground circuit... And yes in theory if plugged into one thing works and another not... Should be the same, but maybe pads one of the connectors is warn, or anodized or ...
Or one connector is slightly looser than another and does not make good contact. Again I have been hit where same cable works for somethings, fails on others, so that is one of the first things I try out when I get something strange going on.

Yeah, fair enough. It’s all brand new equipment. I’m really leaning towards some sort of weird ground issue that’s only affecting the SD Card reader for some reason. I have a day off soon, I’ll do some more in-depth testing, etc.
 
I got it fixed up and working! Turns out it was just a bad solder point on the ground pin between the two boards, so it was only grounding the audio shield through the Line Out when I had it plugged in. Touched it with the soldering iron for a second and now it works perfectly, on any USB power, with or without the Line Out, and it fixed the noise issue. Thanks!
 
Back
Top