drivers/sdcard: In test use os.umount and machine module instead of pyb.
pyb.umount(None, mountpoint) no longer works.
# Test for sdcard block protocol
# Peter hinch 30th Jan 2016
-import os, sdcard, pyb
+import os, sdcard, machine
def sdtest():
- sd = sdcard.SDCard(pyb.SPI(1), pyb.Pin.board.X21) # Compatible with PCB
- pyb.mount(sd, '/fc')
+ spi = machine.SPI(1)
+ spi.init() # Ensure right baudrate
+ sd = sdcard.SDCard(spi, machine.Pin.board.X21) # Compatible with PCB
+ vfs = os.VfsFat(sd)
+ os.mount(vfs, '/fc')
print('Filesystem check')
print(os.listdir('/fc'))
@@ -38,7 +41,7 @@ def sdtest():
result2 = f.read()
print(len(result2), 'bytes read')
- pyb.mount(None, '/fc')
+ os.umount('/fc')
print()
print('Verifying data read back')
