RIP to BT Garner of MindRec.com... BT passed away early 2023 from health problems. He was one of the top PCE homebrew developers and founder of the OG Turbo List, then PCECP.com. Condolences to family and friends.
IMG
IMG
Main Menu

Everdrive SDK / SD card IO

Started by megatron-uk, 12/31/2013, 06:11 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

megatron-uk

I'm afraid the get next sector code isn't implemented yet.

MooZ

Good news!
I managed to make disk_write_single_sector work. But there's something weird.
Right after sending the 512 bytes, you write the 2 bytes CRC and read some kind of status. If you do a bitwise and with $1f and get 5, the write is supposed to be ok. Then you wait for the end of the transfer (which is something like while(spi_reg != 0xff) { nop; }).
But in my case, I'm getting $ff when I'm reading the write status...

MooZ

Long live to Microchip engineers! Thanks to their PIC code, I managed to fix Single Sector write.
Next is Multiple Sector writes.

megatron-uk

That sounds as though it was a hardware bug with write support? Is that the case?

If so, then bloody well done for figuring that out!  =D>

MooZ

It's not a hardware bug. It's just that sd cards are a little bit picky about writing.

MooZ

Multiple sector writes are finally working! I still need to add the C "export".
By the way, I tried to compile with the "new" HuC and it's complaining about long lines and some other weird stuffs (why were the underscore removed from _si, _cl and co?).

NightWolve

#56
Heya Moozy.

'fraid I don't see Megatron posting much anymore, might want to PM him. He went from most prolific updater to MIA.

MooZ


megatron-uk

Hey all,

I've just spent a few hours working on the Everdrive-fat libraries over the past couple of days (where has the time gone???).

I've refactored a few things as well as added some missing 32bit math functions I needed (subtraction, for one). It should be easier to follow now.

I too had a problem using the later versions of huc and pceas, so I've gone back to the 3.21 release. A shame, as the new version with struct support would have made things a lot more compact (all the free fat drivers out there are ansi-c and use structs extensively).

Anyway, I'm now working on the get-next-cluster and get-next-sector code, so reading the entirety of a file from the SD card should not be far off.

Everything is on github, as usual: https://github.com/megatron-uk/everdrive-fat

trapexit

QuoteI too had a problem using the later versions of huc and pceas
What problems? Best to try and get them addressed.