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):
MicroPython 1.12 is coming up with the message in the terminal:
MPY: can't mount SD card
RuntimeError: name too long
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
SD Card Not Working - MPY: can't mount SD card
SD Card Not Working - MPY: can't mount SD card
Last edited by Dugite on Sat Jan 25, 2020 12:41 am, edited 1 time in total.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: SD Card Not Working - MPY: can't mount SD card
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...
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: SD Card Not Working - MPY: can't mount SD card
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.
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
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:
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.
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:
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.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: SD Card Not Working - MPY: can't mount SD card
Nasty. I'm surprised your CAD system doesn't have a design rules check which would have picked this up.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: SD Card Not Working - MPY: can't mount SD card
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
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?
@ chrismas9
It is a 4 layer PCB with a power and GND plane so this should be fine?