SD/fat32 implementations
ke4pjw
Posts: 1,155
in Propeller 2
Has anyone developed a framework/object to access files on a fat32 filesystem of an SD card?
I know that TaqOz does this, but I didn't know if there was something outside of TaqOz.
Thanks,
Terry
I know that TaqOz does this, but I didn't know if there was something outside of TaqOz.
Thanks,
Terry
Comments
For an example, see the Fun with the P2 ROM thread.
Any thoughts about this?
Use the built-in TAQOZ to do a sanity check for you. Just reset and type the three keys [>] [space] [esc] and from TAQOZ type MOUNT. From there you can do a DIR.
If it doesn't work there then it won't work elsewhere.
Looking in sdspi.spin2, I think this may be the problem.
I don't think the pins are laid out the same.
You can also test your pin arrangement other than the default with TAQOZ by changing the sdpin constant with this expression: It's a bit more awkward than it usually is with the cramped ROM space because we are writing directly to the sdpins constant whereas normally we have a word to take care of it easily.
But the syntax is & for a decimal bytes notation (as in IP notation where every group of decimal digits represent a byte) in the sequence CS.MISO,MOSI.CLK and then the tick ' then a space and the name of the constant (sdpins) then 2+ to modify that address to point to the parameter field and then ! to store the new value into the sdpins constant. Just in case you want to double check your original setup.
BTW, the extended TAQOZ implementation of FAT32 includes all the FOPEN type commands, handling a file as virtual memory etc as well as the disk utilities and FORMAT.
becomes Which won't work with pin numbers >31!!
Pretty sure he already fixed the Start_Explicit… at least I have it in mine if you need.
The thread I've got for what I was working on is here;
https://forums.parallax.com/discussion/169786/working-on-fsrw/p1
Right now I'm trying to learn how to start a cog the right way and pass everything, basic asm engine stuff. Once I have a handle on that I plan on using the smart pins. This is my SDSPI using inline asm. It should just replace fsrw2.6 sdspi, although I made some small tweaks to the fsrw file to make things return gracefully. When all the abort code was changed to return there were some edge cases that didn't seem quite right.
So, I replaced dira and outa with DIR and OUT. I am going to look through simple serial and see how that works. I have pin 62 assigned.
I think the idea is to set smartpin mode %00101 = transition output for the clock. Then use Sync serial tx and rx to push data around. It should end up with some really optimized code, as well as nice mhz.
Now that you have the dir and out macro, you'll still need to change the pin numbers by 32 right?
I didn't try this on Eval board's uSD, used one on my own board...
I imagine those switches have to be in the right position for uSD access...
I'll look into this and see about fixing it.
I thought this stuff at the beginning would make it work, but maybe not
Maybe changing OUTA to OUTB and DIRA to DIRB in sdspi.spin2 would fix it?
fastspin provides P1 definitions for drvh_, drvl_, drvnot_, and waitx_. I should create a testp_ builtin as well, I think.
The RIGHT way to do it would be to use the DRVx instructions (and TESTP), since they can span all 64 pins. The one place to watch seems to be the READ mov ina. I have a rather large delay to make sure things work at 320mhz and that's using the TESTP instruction...
I'm pretty sure using the smart pins will make that delay go away. Cluso's way is to toggle the clock early and end up with an extra clock. I was going for the more brute force method, at least until I understand the chip better.
@Rayman, could you share your working version with all three .spin2 files in a zip? The one above only has sdspi2.spin2, but not the other spin2 files. I am sure I am doing something wrong and would like to compare with one that works.
Weird. Not sure what to do next. Maybe I should do a logic capture and compare with TAQOZ.
I think the pins just need to be initialized properly.
non-working mount with fsrw
Working mount in TAQOZ.
It might only work with FastSpin...
Ok, never mind PNut doesn't do Spin, dumb question...
I'm puzzled as to why it works for me and not you on the same hardware...
I lack a logic analyzer/scope, so I'm a bit stuck. Maybe start loking into ozpropdev's or cluso's prop2 based LA working.
I was unable to get your version of FSRW working as well. I'm wondering how much of this has to do with PortB. I'm thinking once I attach a card to PortA pins things should work but I'll let you know when I figure it out.
BTW, I've been idling the clock high without an issue.
If so, I'll upload my working binary. Can't imagine what's going on here...
You are running this as the top level file, right?:
sdrw_test_eval.spin2