What kind of filesystem is needed on the SD card?
I haven't been able to find that information in the docs, maybe I'm looking in the wrong place.
https://docs.micropython.org/en/latest/ ... nd-sd-card
Damien if you're reading these, please add a few line about the filesystem for the SD card.
Thanks
SD card filesystem type
-
- Posts: 363
- Joined: Sun Apr 17, 2016 1:55 pm
Re: SD card filesystem type
I test 8G, 16G and 32G sdcard, with FAT and FAT32 filesystem, some works fine, some can't support.cappy2112 wrote:What kind of filesystem is needed on the SD card?
I haven't been able to find that information in the docs, maybe I'm looking in the wrong place.
https://docs.micropython.org/en/latest/ ... nd-sd-card
Damien if you're reading these, please add a few line about the filesystem for the SD card.
Thanks
Re: SD card filesystem type
You can't format a FAT (FAT16) partition >4Gb (2Gb for Windows).shaoziyang wrote: I test 8G, 16G and 32G sdcard, with FAT and FAT32 filesystem, some works fine, some can't support.
-
- Posts: 363
- Joined: Sun Apr 17, 2016 1:55 pm
Re: SD card filesystem type
Yes, I am sorry, I forgot it. I have a very old 2G SD card, it use FAT.Lysenko wrote:You can't format a FAT (FAT16) partition >4Gb (2Gb for Windows).shaoziyang wrote: I test 8G, 16G and 32G sdcard, with FAT and FAT32 filesystem, some works fine, some can't support.
All my sdcard may work in USB reader, but in pyboard, some work fine, some can't work.
And in SPI mode, some sdcard worked in pyboard can't be recognize.
Re: SD card filesystem type
Here is the process I used to partition, format and verify the microSD card for pyBoard.
Identify the microSD card.
Wipe microSD card
Run parted.
Create a new disk label msdos.
Determine the available space on the microSD card.
Make a primary partition including the full space.
Confirm partition creation.
Format the partition as vfat.
Install the microSD card in the pyBoard and enter the Read, Evaluate, Print, Loop (REPL) shell.
List the directories and the microSD card should show as ∕sd.
Create a file and add some text. Verift the text is there.
Remove the microSD from the pyBoard and move it to the computer.
Confirm the file created on the pyBoard exists on ther microSD card.
Move the microSD to computer and confirm file is on the microSD card.
There you go, it is verified as operational. Return the microSD card to the pyBoard.
Identify the microSD card.
Code: Select all
~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 1 7.4G 0 disk
└─sdb1 8:17 1 6.5G 0 part /media/ob/32A1-4FC21
nvme0n1 259:0 0 1.9T 0 disk
├─nvme0n1p1 259:1 0 512M 0 part /boot/efi
└─nvme0n1p2 259:2 0 1.9T 0 part /
Code: Select all
~$ sudo wipefs --all --force /dev/sdb
/dev/sdb: 8 bytes were erased at offset 0x00000052 (vfat): 46 41 54 33 32 20 20 20
/dev/sdb: 1 byte was erased at offset 0x00000000 (vfat): eb
/dev/sdb: 2 bytes were erased at offset 0x000001fe (vfat): 55 aa
Code: Select all
~$ sudo parted /dev/sdb
GNU Parted 3.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
Code: Select all
(parted) mklabel msdos
Code: Select all
(parted) print free
Model: Generic MassStorageClass (scsi)
Disk /dev/sdb: 7948MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1024B 7948MB 7948MB Free Space
Code: Select all
(parted) mkpart primary
File system type? [ext2]? fat32
Start? 1024
End? 7948
Code: Select all
(parted) print
Model: Generic MassStorageClass (scsi)
Disk /dev/sdb: 7948MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1024MB 7948MB 6924MB primary fat32 lba
Code: Select all
~$ sudo mkfs -t vfat /dev/sdb1
mkfs.fat 4.1 (2017-01-24)
Code: Select all
~$ sudo screen /dev/ttyACM0
Create a file and add some text. Verift the text is there.
Remove the microSD from the pyBoard and move it to the computer.
Confirm the file created on the pyBoard exists on ther microSD card.
Code: Select all
MicroPython v1.13 on 2020-09-02; PYBLITEv1.0 with STM32F411RE
Type "help()" for more information.
>>>
>>> import os
>>> os.listdir('/')
['flash', 'sd']
>>> os.listdir('/')
['flash', 'sd']
>>> os.listdir('/sd')
[]
>>> file = '/sd/text.txt'
>>> fh = open(file, mode='w')
>>> fh.write('This is a test')
14
>>> fh.close()
>>> os.listdir('/sd')
['text.txt']
>>> fh = open(file, mode='r')
>>> print(fh.read())
This is a test
>>> fh.close()
Code: Select all
~$ lsblk | grep sdb1
└─sdb1 8:17 1 6.5G 0 part /media/ob/32A1-4FC21
~$ ls /media/ob/32A1-4FC21
text.txt
~$ cat /media/ob/32A1-4FC21/text.txt
This is a test