Hi Giovanni,
maybe that was discussed already, but I didn't find anything yet.
I want to use the FAT_FS by http://elm-chan.org/fsw/ff/00index_e.html on the MMC_SPI driver.
The FS requires a low-level function that finishes all pending write operations (or at least guarantees that no writing operation is pending anymore) but I don't see any possibility to do that using the MMC driver, except disconnecting and connecting again. It seems as if that function is called periodically and I would like to avoid the overheap.
Is there a way to get the content of the CSD register or some other way to determine the size / sector cout of the card?
Thank you!
Regards,
Florian
FAT FS using MMC_SPI: Sync
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: FAT FS using MMC_SPI: Sync
Good points, both are missing.
The sync could be implemented easily, the other function is present in the new SDC driver if I remember well and could be ported.
Giovanni
The sync could be implemented easily, the other function is present in the new SDC driver if I remember well and could be ported.
Giovanni
Re: FAT FS using MMC_SPI: Sync
Now I am working on SDC (and fatfs) driver. Looks like there is no need of function that finishes all pending write operations because there is no buffered write operations in it.
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: FAT FS using MMC_SPI: Sync
The MMC_SPI driver requires it because it does not wait for the last write operation to finish before returning (it is done this way to speedup it a bit). I was referring to this one.
Giovanni
Giovanni
Re: FAT FS using MMC_SPI: Sync
Understand.
Do you mind about providing of FatFS driver via ChibiOS repo in unpacked state? This will allow to improve diskio.c in more convenient way.
Do you mind about providing of FatFS driver via ChibiOS repo in unpacked state? This will allow to improve diskio.c in more convenient way.
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: FAT FS using MMC_SPI: Sync
Let me think about that, I don't know if it is a good idea to have external code unpacked like ChibiOS code, I don't want to mess with copyrights. Diskio could be moved under ./os/various/fatfs_bindings like I did for lwIP stuff, is that acceptable for you?
Giovanni
Giovanni
Re: FAT FS using MMC_SPI: Sync
yes, that sounds good.
Back to the CSD register: Would you recommend a function in the MMC driver that returns the value in the CSD (more specialized) or a function that allows to send an arbitrary command to the MMC (more generic)? A third solution was a function that reads the size of the card from the CSD by itself and returns just that size information, i.e. s.th. like mmcGetCardSize(MMCDriver).
Anyway, I have no further situation in mind, where the user app wants/should send other commands the card directly and it appears a bit risky to me.
For the sync issue, I just wrote a function mmcSync(MMCDriver) calling the internal sync function (that I think does exactly what we need, i.e. waits for all processes to finish).
Back to the CSD register: Would you recommend a function in the MMC driver that returns the value in the CSD (more specialized) or a function that allows to send an arbitrary command to the MMC (more generic)? A third solution was a function that reads the size of the card from the CSD by itself and returns just that size information, i.e. s.th. like mmcGetCardSize(MMCDriver).
Anyway, I have no further situation in mind, where the user app wants/should send other commands the card directly and it appears a bit risky to me.
For the sync issue, I just wrote a function mmcSync(MMCDriver) calling the internal sync function (that I think does exactly what we need, i.e. waits for all processes to finish).
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: FAT FS using MMC_SPI: Sync
Yes, it is correct, it is the internal sync, I would add some state checking before invoking it.
About size/cds, not sure what is better, we could do both.
Giovanni
About size/cds, not sure what is better, we could do both.
Giovanni