machine.SDCard missing?

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.
Post Reply
User avatar
RobH
Posts: 41
Joined: Fri Mar 23, 2018 3:37 pm
Location: Netherlands
Contact:

machine.SDCard missing?

Post by RobH » Mon Dec 07, 2020 3:22 pm

Connected an SD card reader to the ESP32 and could access it via machine.SDCard(slot=2).
Tried the same with a PyBoard, but the SDCard class is not present in 'machine', although the docs (of today) advertise it. Do I need other spectacles or do I see this right?

Regards, Rob

User avatar
pythoncoder
Posts: 4792
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: machine.SDCard missing?

Post by pythoncoder » Mon Dec 07, 2020 5:25 pm

I have accessed SD cards from the days of the Pyboard 1.0 using this official driver.
Peter Hinch

User avatar
RobH
Posts: 41
Joined: Fri Mar 23, 2018 3:37 pm
Location: Netherlands
Contact:

Re: machine.SDCard missing?

Post by RobH » Mon Dec 07, 2020 7:34 pm

Thanks Peter, I have used that driver too, but it fails with SD-cards of 2GB (well in fact the os.mount() fails). I tried to find the cause but fruitless so far.
Just by coincidence I found today in the online MP libraries doc the SDCard class in 'machine'. I tried it with an ESP32 and it appeared to work fine with a 2GB SD card! Reason enough to try it immediately with a PyBoard.
With respect to the PyBoard the SDClass documentation mentions only:
The standard PyBoard has just one slot. No arguments are necessary or supported.
which sounds to me that the SDCard class is also present in the machine library of the PyBoard.

Regards, Rob

User avatar
pythoncoder
Posts: 4792
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: machine.SDCard missing?

Post by pythoncoder » Tue Dec 08, 2020 9:57 am

I agree there is a conflict between the docs and the firmware. However even if the firmware matched the docs I can't see it would help you. The statement
The standard PyBoard has just one slot. No arguments are necessary or supported.
implies that you couldn't declare a second adaptor.

Unless I'm missing something there is no choice than to use the official driver, despite its limitations.
Peter Hinch

User avatar
RobH
Posts: 41
Joined: Fri Mar 23, 2018 3:37 pm
Location: Netherlands
Contact:

Re: machine.SDCard missing?

Post by RobH » Wed Dec 09, 2020 10:43 am

OK! It seems that I'll have to accept the limited implementation of the machine.SDCard class for PyBoard compared to that of the ESP32 port. Hopefully this is temporary.

Post Reply