can see directories, can detect SD card, but can’t get into it to read or write files to it below is what happens when running some simple code
Root directories:
rom
flash
sdcard
SD card detected! mount()/remount() skipped or failed: ‘str’ object has no attribute ‘readblocks’ Error accessing /sd: [Errno 19] ENODEV
• This is a known ENODEV bug in OpenMV v4.7.0 on STM32H7 boards.
OpenMV v4.7.0; MicroPython v1.25.0-r0; OPENMV4P with STM32H743
Type “help()” for more information.
I was using copilot to help with writing and reading to the SD card, I’m finding out copilot is unfamiliar with all the SD card usage on h7. I eventually found img.save for storing images but am struggling with fully utilizing the SD card on h7 via openMV.
thanks much, finally have several hours I was lucky to insist with copilot to use a different import a different library. now we are importing pyb file I/O commands and we seem to be good, though just did a simple text write and read. I will copy your suggestion and try it as I’m very new to microcontrollers, about 2 months on pi pico before coming over here
finally got copilot to use pyb, code below
import pyb
# Check SD card status
sd = pyb.SDCard()
if sd.present():
print("✅ SD card detected! Listing files...")
try:
# Use OpenMV's SD card file system commands
with open("test_file.txt", "w") as f:
f.write("Hello, Rookie OpenMV dude!\n")
print("✅ File 'test_file.txt' written successfully!")
# Read the file contents
with open("test_file.txt", "r") as f:
content = f.read()
print("📖 File contents:\n", content)
except OSError as e:
print(f"❌ Error accessing SD card: {e}")
else:
print("❌ No SD card found. Please insert one.")
output:
✅ SD card detected! Listing files...
✅ File 'test_file.txt' written successfully!
📖 File contents:
Hello, Rookie OpenMV dude!
OpenMV v4.7.0; MicroPython v1.25.0-r0; OPENMV4P with STM32H743
Type "help()" for more information.
>>>