Trouble with SD Card

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
ahmet_cihan
Posts: 7
Joined: Mon Jun 20, 2016 9:23 am

Trouble with SD Card

Post by ahmet_cihan » Mon Jun 20, 2016 2:04 pm

Hi community.
After connecting pyboard to my PC, I insert MicroSD Card to pyboard. Just standard boot from flash.. When I write
>>> os.listdir('/')
I can see
['flash', 'sd']
so, it's clear that the board can identify SD Card. But when I write
>>> os.listdir('/sd')
I get this error;
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: No such file or directory: '/sd'

So, I can't read or write SD card. What could be the problem?

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Trouble with SD Card

Post by dhylands » Mon Jun 20, 2016 3:08 pm

I think that only unpatrtitioned SDcards which are formatted using FAT32 are supported.

I know lots of SDs get reformatted using multiple partitions (for say Raspberry Pi), and I don't think that these are suppoted.

ahmet_cihan
Posts: 7
Joined: Mon Jun 20, 2016 9:23 am

Re: Trouble with SD Card

Post by ahmet_cihan » Mon Jun 20, 2016 4:29 pm

Thank you for your answer Dave. Bad luck for me because I have tried 2 different SD card which are formatted single partition FAT32 :) I changed one of them to NTFS, it's same. Now I'm trying EXT4.. No, it's same. What can I do anymore?

torwag
Posts: 220
Joined: Fri Dec 13, 2013 9:25 am

Re: Trouble with SD Card

Post by torwag » Mon Jun 20, 2016 5:07 pm

You have to carefully read Daves answer ;)

Unpartitioned SD card. Means no partition at all.
Under linux that means you need to have no sdb1 or sdbX but only sdb.
And you need to format sdb and not sdbX

Not sure how to manage this under the windows world, which I left long time ago.
There is no support for EXT4, NTFS and Co.
Good luck

EDIT: Could be also sdc sdd or whatever, you need to check... don't tell me you erased your harddisk by using my sdb example :P

User avatar
Roberthh
Posts: 3668
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Trouble with SD Card

Post by Roberthh » Mon Jun 20, 2016 7:47 pm

Hi folks, I cannot confirm that. I just looked at two SD cards on two systems, size 8 and 16GB, but I had a 64GB card used too. Boths cards are accepted by PyBoardV1. Both have a single partition with a partition sector formatted as FAT. On on system, the cards show up as /dev/sde1, on the other as /dev/mmcblk0 and /dev/mmcblk0p1. What I did, I reformatted the cards before using as FAT.
SO maybe you should confirm that the cards have a single partition only, or use a different computer for verification, that they are properly formatted.
P.S.: When inserted into PYBoard, the cards are shown as /dev/sdc1.

ahmet_cihan
Posts: 7
Joined: Mon Jun 20, 2016 9:23 am

Re: Trouble with SD Card

Post by ahmet_cihan » Tue Jun 21, 2016 8:01 am

I used GParted to format SD Cards, under Linux. No flags, no partitioning, just plain format to FAT32.
Note that; there is NO trouble when I reset the board while SD card is connected. PyBoard is running from SD Card properly. So, I don't think there is a format unsuitability.

Now, I'm going to change the firmware to the latest version.

User avatar
Roberthh
Posts: 3668
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Trouble with SD Card

Post by Roberthh » Tue Jun 21, 2016 8:50 am

Hello ahmet_cihan, just two questions:
a) are there any files on the SD card you're trying
b) when PyBoard is connected to your PC, is the SD card visiblle as external drive?
Regards, Robert

ahmet_cihan
Posts: 7
Joined: Mon Jun 20, 2016 9:23 am

Re: Trouble with SD Card

Post by ahmet_cihan » Tue Jun 21, 2016 10:12 am

Hi Robert.
1- There is not any file on the SD Card.
2 - When I boot Pyboard with a SD Card, PC can see SD Card as an external drive. In this case there is no problem. Problem occurs when I connect SD Card after flash boot.

I changed the firmware to the latest. What now; I insert SD Card after flash boot
>>> os.listdir('/')
I can see
['flash']

This is more logical :) Because formerly, I could see 'sd' with this command but it gave error when I tried to list 'sd'. But now I can't see 'sd' in the list of '/'.
Still no problem with SD boot.

User avatar
Roberthh
Posts: 3668
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Trouble with SD Card

Post by Roberthh » Tue Jun 21, 2016 11:01 am

What do you mean with
Still no problem with SD boot.
, especially when there is no file on the SD card.
PyBoard boots from its image in flash outside the file system. It just takes boot.py and main.py from a filesystem in flash or SD if present.
There might be a problem with the SD card connector.

ahmet_cihan
Posts: 7
Joined: Mon Jun 20, 2016 9:23 am

Re: Trouble with SD Card

Post by ahmet_cihan » Tue Jun 21, 2016 11:18 am

I will explain step-by-step;

SD Card: no data, no file, FAT32 formatted.
PC: Linux (Ubuntu 15.04)

A - Connect SD Card -> then -> Plug in USB
1- Command "screen /dev/ttyACM0"
2- Darkness :)
3- CTRL+C
4- I have console.
5- >>> import os
>>> os.listdir('/')
['flash', 'sd']
6- No problema!

B- Plug in USB, NO SD Card
1- Command "screen /dev/ttyACM0"
2- Darkness :)
3- CTRL+C
4- I have console.
5- >>> import os
>>> os.listdir('/')
['flash']
6- Connect SD Card
7->>> os.listdir('/')
['flash']
still cannot see 'sd'

Post Reply