Read / Write to microSD card on Edge?
jrullan
Posts: 168
Is there a way or driver to be able to read a file from the microSD card on the Edge?
I would like to store images there and read them into my program without bloating the spin2 file. Similarly, I would like to be able to write to the microSD to use it for data collection.
Any help is appreciated.
Edit: I've seen this post but I'm not sure where is the latest version https://forums.parallax.com/discussion/171176/memory-drivers-for-p2-psram-sram-hyperram-was-hyperram-driver-for-p2
Comments
When using flexspin, you can
and then use the C style file I/O functions (
fopen
and friends) on the libc object.Otherwise, there's this: https://forums.parallax.com/discussion/173378/the-actually-functional-spin2-sd-driver-i-hope-kyefat-sdspi-with-audio
There's also a version of FSRW around that uses the same low level driver.
That got broke by a change to Spin2 loop index behavior.
Code was fixed to compensate for that.
But now, Spin2 has reverted to previous behavior.
So, code is probably broke again...
@Wuerfel_21 would it work even when booting from the microSD card? I ask because the microSD card has to be formatted FAT32 to be used for booting the sketch and I would like to preserve that feature in my project, but at least in your version it seems (if I understood correctly) that it supports a different format KyeFAT....
Digressing a bit (or a lot) it would be so cool if when booting from the microSD card there would be an equivalent to the DAT FILE directive that could point to an external file from inside the SPIN2 program.
Edit: Corrected Kye name
Do you know where can I find that FSRW?
Yes, reads any FAT32 SD card. Including the booted one. KeyFAT is named after the Indian dude that wrote it for the Prop1.
I do the types of things you are trying to do, with my light controller project using my own version of FSRW @kye 's FAT32 and @Wuerfel_21 's sdapi driver.
https://griswoldfx.visualstudio.com/Blitzen 24
Get the fat32.spin2 and sdspi_with_audio.spin2 files from the repo.
There are some caveats:
I will be happy to help you with this, as I spent all of last year researching and fighting issues with it
I'd probably recommend that version that @Wuerfel_21 and @ke4pw mention.
Maybe FSRW is working or maybe it will not work or maybe it will erase you card and need reformatting, who knows been a while...
It's posted here though: https://forums.parallax.com/discussion/173378/the-actually-functional-spin2-sd-driver-i-hope-kyefat-sdspi-with-audio/p2
Lol, yes, Kye is his name. Can't believe I verbatim copied the spelling there.
OMG! I'm sorry, did not see that, my dyslexia is acting up. Fixed my post.
Thanks @ke4pjw , I've been busy with my project and haven't yet worked my way to test Blitzen yet. Maybe once I learn a bit more about this I will feel less intimidated to do some testing with it. I'll give it a go for sure.