Page 1 of 1
SD Card Not Working - MPY: can't mount SD card
Posted: Thu Jan 23, 2020 11:45 pm
by Dugite
I have been developing a data logger using MicroPython 1.12 and I am currently up to PCB revision 3. The first two revisions worked fine with the SD card and it mounted as normal when you plug the USB into a PC and I could see the SD card. The third revision of my PCB, the SD card is slightly further away and the SD card is not mounting.
In the following image the board labeled '1' on the left is the revision 3 PCB (not working) and the board labeled '3' on the right is the revision 2 PCB (working):

- Capture-pcb.JPG (55.53 KiB) Viewed 5174 times
MicroPython 1.12 is coming up with the message in the terminal:
MPY: can't mount SD card
RuntimeError: name too long

- Capture.GIF (17.17 KiB) Viewed 5234 times
I have checked continuity between the STM32 pins and the SD card socket comparing both boards and all seems OK. My concern is that the slight extra distance and perhaps auto route change is causing some timing issue. But would this really be a problem with this distance?
Any comments on this would be much appreciated

Re: SD Card Not Working - MPY: can't mount SD card
Posted: Fri Jan 24, 2020 6:08 am
by pythoncoder
Continuity checks only tell you if a connection is missing. Might there be an extra one (e.g. a solder bridge)? With hardware faults there's no getting away from putting a 'scope on it...
Re: SD Card Not Working - MPY: can't mount SD card
Posted: Fri Jan 24, 2020 12:24 pm
by chrismas9
It's possible you have a crosstalk problem between CLK and CMD. On the board that works these signals change to bottom or inner layer so I can't see their routing.
On the new board CLK and CMD are routed very close together for most of their run. On the pyboard there is a guard trace (GND) on each side of the CLk to reduce crosstalk. What can happen is on the clock eege when data is sampled the edge couples a spike onto the data line (CMD) causing it to be misread. I have seen this on SPI bus. There are a couple of ways to check this:
1. As Peter sugessted look at the signals, especially the CMD line. Are there any spikes coincident with clock edges?
2. Add a small capacitor between CLK and GND at the MCU end. Work up from say 10pF. Look at the clock with oscilloscope if you can. The purpose is to slow down the clock edge to reduce crosstalk, but not enough to destry the signal. This is not recommended solution, only for diagnostics, because slow clock edges can also cause problems.
3. Cut the CLK track near the MCU, or lift the MCU CLK pin from its pad. Insert a 22 to 33 ohm resistor in series to reduce slew rate. This is an acceptable production solution.
4. Cut the CLK line at both ends and replace it with a thin wire link (eg wire wrap wire). Elevate this wire so it can't couple to the CMD or DATA lines. You should probably twist it with a GND wire connected to GND at both ends.
Re: SD Card Not Working - MPY: can't mount SD card
Posted: Fri Jan 24, 2020 2:04 pm
by Dugite
Thank you for your comments and suggestions.
I finally just found the issue (this is a part-time effort currently) which ended up being two tracks touching from the auto-routing as shown by the red arrow below:

- pcb-back (Small).JPG (110.69 KiB) Viewed 5192 times
Unfortunately, I did not pick that up before sending the design off to have 5 boards made but after cutting two tracks and jumpering them the SD card then started working.
So a good lesson here with auto-routers and making sure you check the tracks to make sure none are too close to each other.
Thanks for your input pythoncoder and chrismas9.
Re: SD Card Not Working - MPY: can't mount SD card
Posted: Sat Jan 25, 2020 10:02 am
by pythoncoder
Nasty. I'm surprised your CAD system doesn't have a design rules check which would have picked this up.
Re: SD Card Not Working - MPY: can't mount SD card
Posted: Sat Jan 25, 2020 1:01 pm
by chrismas9
If you are doing another run of boards it would be worth hand routing a GND track on each side of CLK.
Re: SD Card Not Working - MPY: can't mount SD card
Posted: Fri Feb 07, 2020 1:28 pm
by Dugite
I am not sure what happened here with the routing, but I will see how the next board goes.
@ chrismas9
It is a 4 layer PCB with a power and GND plane so this should be fine?