External SD Card only works if inserted before the board is turned on.

Hi,
I am running smoothieboard 5X with viki2 LCD, with latest (sept. 20th) edge firmware.

I have configured my external SD card according to the panel page of the wiki and I have read the External SD Card section.
This section specifies that the SD Card must be removed when powering on the board, since the bootloader doesn’t like external SD cards. My problem is that is is recognized only if the SD card in inserted then the board boots.

When I insert my SD card before powering on the board, everything runs smooth, I can access both SD cards ( sd/ and ext/ ) and all the sub-folders, files etc.

However, when I first power up my board and then insert my external SD card, my board freezes for a minute or so. When it comes back, the Play menu shows both sd/ and ext/ but I can access only files in sd/ (sd card on the board). It freezes for a few seconds if I try to access the external card sub-folders.

Having to reboot the printer every time we need to insert an SD card is not very convenient and it is probably not a wise solution since the wiki recommends not to do so. Where should I start looking to solve this issue ?

Thanks

Imported from wikidot

How long is the cable going to your external SD card ?

While there is some support for external SD cards in Smoothie, they are essentially a very very bad idea. SD cards are not designed to be talked to over wires like this, and it’s bound to cause all sorts of very hard to figure out problems …

Cheers.

If you think the length of the wires should solve the problem, I will try to shorten them. What maximum length would you recommend ? 3", 12" ?

My cables are the stock viki2 universal cables. I don’t have the exact length, I’d say around 400-500mm.

Can you describe why external SD is not a good idea ? would shielded MOSI, MISO and SCK signals solve the issue ?

I have been able to access the SD card content a few times, when starting with the card inserted, now I can’t see it’s content. unless i plug it directly in the smoothieboard sd card slot.

Can you describe why external SD is not a good idea ?

Because it wasn’t designed to be used this way. If you have an external SD card reader on your computer, you have a SD card slot, then an actual SD card reading chip, then a USB cable, then finally your computer. You don’t have the SD card reading chip in your computer, long wires, then the SD card slot itself.

This is because USB was designed to be used over wires, and SD cards weren’t. SPI isn’t differential, doesn’t correct for errors etc … it’s not adapted to doing this. USB or Ethernet are.

The fact that it’s become common in this community, and that lots of people do it with some success, doesn’t mean it’s a good idea.

Shielding shouldn’t really help much.

We support this due to popular demand, but it still is a very bad idea and there is very very little that can be done when it doesn’t work.

Is there going to be a usb jack on the v2 and v2-pro then ?

So the issue is not related to the SPI communication itself ? Would having both a shielded cable and a slower clock a good solution ?
External SD has worked flawlessly on the 6 Marlin based printers I have built and used, even with the cheap chinese Ramps and LCDs. I picked the best board and the best display/sd I found, it is surprising that this setup doesn’t support external SD.

I really need to have an external data input located at around 2-3ft from the smoothieboard.
Should I experiment with the MicroSD card breakout board from AdaFruit ?
Would you recommend I go the raspberry pi route ?

Please give me some clues as to where I should start digging, I will solve this issue and help the community grow.

Is there going to be a usb jack on the v2 and v2-pro then ?

Yes.

So the issue is not related to the SPI communication itself ? Would having both a shielded cable and a slower clock a good solution ?

It’d help. As I said, this is a very very bad idea, but it’s one that still works for most people. A bit like biking without a helmet …

Should I experiment with the MicroSD card breakout board from AdaFruit ?

Changing breakouts won’t change much.

Would you recommend I go the raspberry pi route ?

That sounds like a much much better idea.

Very short cables won’t do the trick.

Again, here is my situation:

If I insert the card before powering the board, 100% functionnal. I can run GCode files from external SD for hours and everything works perfectly.

If I insert the card after the board have been powered, it just feels like either SPI channel is wrong or something like that… when the card is inserted, the board freezes for around a minute or two, and I can’t access what’s inside the card.

Here is my setup:

panel.external_sd                            true
panel.external_sd.spi_channel                0
panel.external_sd.spi_cs_pin                 0.27
panel.external_sd.sdcd_pin                   0.28!^

MOSI is on pin 0.18
MISO is on pin 0.17
SCK is on pin 0.15
SDCS is on 0.27
SDCD is on 0.28

What could cause the SD card to only work when inserted before the board is powered ?

I found the culprit… I wired another smoothieboard with the exact same config file and exact same pins and everything works smoothly.

Thus, something is broken on the first of the two boards I bought.
The fault was not the SD Card setup.

I noticed that I tend to get static shocks when I play with the first setup…

The bad part is that I will probably have to get it replaced by uberclock and they are not know to be very fast to answer mails…

Static shocks are very very bad for the board, and are probably not caused by the board itself, but by something in your setup, or lack of protection when manipulating things …

Rarely, static shocks have even been known to damage specific pins, which could be what happened to you.

Well, it looks like I was able to reproduce the problem… after soldering the 5 external motor driver pins and the SPI1 pins, it started to behave exactly like the other one…

This is super strange, are you also getting static shocks with that new board ?

Hi, I found the solution, and thought I should share it.

It seems that something caused some static buildup, even if I was working on an anti-static mat. This build-up was probably messing with the signal associated with the sdcd, causing the smoothieboard to freeze. Installing both the viki2 and the smoothieboard in a grounded aluminum box solved the issue. Everything works perfectly now.

Cheers