I can't access microSD cards with Pyboard 1.1

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.
User avatar
oserror
Posts: 33
Joined: Tue Feb 12, 2019 12:26 am

I can't access microSD cards with Pyboard 1.1

Post by oserror » Mon Apr 15, 2019 8:22 pm

I have been trying to get this to work for an inordinate amount of time.

I have tried with a Class 4 4GB card and a SanDisk Extreme 32GB SDHC card and have had no luck. Both filesystems can be mounted on my Linux system.

I tried with no partitions and making a fat32 fs on each card (/dev/sde) , and I have tried using GParted. GParted created /dev/sde1.

I have two Elecrow Pyboards here, both run v1.10. I have also tried v1.94 on one board. I have tried both orientations of the card, settling on the "label is up" when the card is inserted into the slot as I have seen others use in a Google Image search for Pyboard. I just wanted to put that out there.

The Pyboards run the async led flash program and also work with a WiFi shield and can grab the homepage of my server here, so they seem to be in order.

Code: Select all

>>> os.listdir('/sd')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 19] ENODEV
>>>
I am usually able to figure out these sorts of things, but I am at a loss. I would welcome help from anyone who can assist.

Thanks!

EDIT: here's another test I did:

Code: Select all

>>> sd = pyb.SDCard()
>>> import os
>>> os.mount(sd, '/sd')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: 16
>>>

Niallp
Posts: 26
Joined: Sun Nov 29, 2015 10:25 pm
Location: Pender Island, BC

Re: I can't access microSD cards with Pyboard 1.1

Post by Niallp » Mon Apr 15, 2019 10:25 pm

What version of mp are you using ? I've just updated to the latest master and now my previously working uSD card isn't recognized.

A board using 1.9.4 works fine, SD and SDCard are in pyb but the latest (1.10.0) don't have them anymore, has the API changed ?

EDIT: found the problem, MICROPY_HW_HAS_SDCARD is now MICROPY_HW_ENABLE_SDCARD ... needed to fix my custom board files.

User avatar
oserror
Posts: 33
Joined: Tue Feb 12, 2019 12:26 am

Re: I can't access microSD cards with Pyboard 1.1

Post by oserror » Mon Apr 15, 2019 11:04 pm

Both boards are version 1.1. The micropython versions I've tried are both stable release versions, 1.9.4 and 1.10.0.

I will try earlier micropython versions and the latest master to see what happens.

User avatar
oserror
Posts: 33
Joined: Tue Feb 12, 2019 12:26 am

Re: I can't access microSD cards with Pyboard 1.1

Post by oserror » Mon Apr 15, 2019 11:14 pm

So am I understanding that the problem is with the board definition of this Crow Pyboard? I'm a little out of my depth here.

rhubarbdog
Posts: 166
Joined: Tue Nov 07, 2017 11:45 pm

Re: I can't access microSD cards with Pyboard 1.1

Post by rhubarbdog » Tue Apr 16, 2019 2:39 am

Using a card reader not the pyboard
1) delete all partitions
2) create a single partition
I'd use

Code: Select all

sudo cfdisk /dev/sdb1
3) create a fat filesystem with

Code: Select all

sudo mkfs.fat /dev/sdb1
Use lsblk to detetmine the name to use if it's not /dev/sdb1

[EDIT]
Micropython will only work with an SD Card with 1 partition

You do know that after plugging in an SD Card that you need to cycle the power or press the reset button

User avatar
oserror
Posts: 33
Joined: Tue Feb 12, 2019 12:26 am

Re: I can't access microSD cards with Pyboard 1.1

Post by oserror » Tue Apr 16, 2019 11:32 am

I followed those steps exactly. I even formatted the microSD card in Windows 10 and tried using it, with both the Class 4 card and the SanDisk Extreme card.

Both cards are visible in Linux and in Windows, but when I plug in the Pyboard 1.1, the only thing visible is the PYFLASH space. I can't seem to access the SD card at all on both Pyboard 1.1 machines.

When I plug the card into a Pyboard D, Linux mounts it as a 32GB partition, but rshell only accesses the /flash space.

I just tried with a SanDisk Ultra Class 10 (red and gray) card. The Pyboard D mounts the card in Linux as 32GB space, but I can't access it in the shell. Still, it sees the card I suppose and maybe that's a software issue. Both of my regular Pyboard 1.1 machines do not see the card.

Unless they do? But why doesn't Linux see the 32GB space when I plug in the Pyboard 1.1?

I may be missing something very simple here but I don't know what it is. I thought that when an SD card is plugged into the Pyboard 1.1, the OS would mount the SD card instead of the PYFLASH space.

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

Re: I can't access microSD cards with Pyboard 1.1

Post by Roberthh » Tue Apr 16, 2019 12:19 pm

On Pyboard D the SD card is not automatically mounted. So you have to mount it yourself.

User avatar
oserror
Posts: 33
Joined: Tue Feb 12, 2019 12:26 am

Re: I can't access microSD cards with Pyboard 1.1

Post by oserror » Tue Apr 16, 2019 2:01 pm

Roberthh wrote:
Tue Apr 16, 2019 12:19 pm
On Pyboard D the SD card is not automatically mounted. So you have to mount it yourself.
Okay, that's good to know. So my SD cards are probably fine, and the fault seems to lie with the Crow Pyboards.

There are eagle files published on their wiki but I don't have the skill set to understand them. Perhaps there is some different wiring going on there. I did find a firmware they included with that information, but the firmware didn't work for me, either.

I tried the data logger example and it failed when trying to access the SD card:

Code: Select all

Traceback (most recent call last):
  File "datalogger.py", line 22, in <module>
OSError: [Errno 19] ENODEV
I'm not sure what's going on or what to try next.

Code: Select all

>>> sd = pyb.SDCard()
>>> sd
<SDCard>
>>> dir(sd)
['__class__', 'info', 'ioctl', 'power', 'present', 'read', 'readblocks', 'write', 'writeblocks']
>>> sd.present()
False

ThomasChr
Posts: 120
Joined: Sat Nov 25, 2017 7:50 am

Re: I can't access microSD cards with Pyboard 1.1

Post by ThomasChr » Tue Apr 16, 2019 4:09 pm

I can confirm the problem.
I also got a Crow Pyboard (which seems to be a cheap version of the Pyboard 1.0 or 1.1 - I'm not sure) and it also does not mount the sd card whatever I do.
I have another clone (not Crow) which has absolutely no problem to mount the sd card. So I'm pretty sure the SD card is correctly formatted. Both pyboards have the same version of micropython on them!

ThomasChr
Posts: 120
Joined: Sat Nov 25, 2017 7:50 am

Re: I can't access microSD cards with Pyboard 1.1

Post by ThomasChr » Tue Apr 16, 2019 4:29 pm

Even sd.present() does not detect the SD Card, so it seems to be a hardware problem? Maybe the chinese guys did something wrong when copying the schematics. Are there any ways to find out whats wrong here? Maybe we can speak SPI to the microSD Card?

Post Reply