Hi Ian,
The alignment cannot be fixed inside the driver, the STM32F1 DMA does not allow unaligned accesses. It is something they fixed in the STM32F2 were they added a "PINCOS" configuration bit into the DMA CR register that allows for unaligned accesses (there are a lot of other enhancements to the DMA).
This leaves us with few options:
- Use an intermediate buffer into the FatFs integration module for unaligned accesses (but this is slow).
- Do not use DMA at all for SDIO (and this is probably worse).
- Evaluate if it is possible to work with the FatFs author to not require unaligned accesses.
- Verify if it is possible to make FatFs not pass unaligned pointers by not giving it unaligned pointers (all read/write will have to be aligned).
- Evaluate another FAT FS library.
Giovanni
Debugging SDIO
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Debugging SDIO
About the problem you reported, I modified a bit the test case in order to perform series of multiple reads and writes but I have been unable to reproduce it. Any news?
Giovanni
Giovanni
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Debugging SDIO
Hi,
I committed an update in the repository, now the driver transparently supports unaligned accesses (using an intermediate buffer), it works in the test application and I will put together a FatFs demo ASAP.
Giovanni
I committed an update in the repository, now the driver transparently supports unaligned accesses (using an intermediate buffer), it works in the test application and I will put together a FatFs demo ASAP.
Giovanni
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Debugging SDIO
Hi,
There is a working FatFs demo now, it is on the repository. I hope to integrate the newest FatFs version as next step.
Giovanni
There is a working FatFs demo now, it is on the repository. I hope to integrate the newest FatFs version as next step.
Giovanni
Re: Debugging SDIO
Hi Giovanni,
Apologies for the silence
I got pulled into something else but I'm back working on this. Let me try the latest.
ian
Apologies for the silence
ian
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Debugging SDIO
Hi Giovanni,
I made some progress. I got the latest ChibiOS working (I usually have to patch a couple of my changes before it does). I got the Shell example to work but that only reads. The HAL SDIO example failed on the writes on my 2Gb, but worked fine on the ST eval default 128Mb. Since the 2Gb is a good card (very fast!) I can only assume that there's a write timeout that can be adjusted somewhere. In any case I'm going to try a couple of other SD cards to see if I can get a large fast one working. Have you tried any card that's 2Gb+ and class 4 or higher?
Ian
I made some progress. I got the latest ChibiOS working (I usually have to patch a couple of my changes before it does). I got the Shell example to work but that only reads. The HAL SDIO example failed on the writes on my 2Gb, but worked fine on the ST eval default 128Mb. Since the 2Gb is a good card (very fast!) I can only assume that there's a write timeout that can be adjusted somewhere. In any case I'm going to try a couple of other SD cards to see if I can get a large fast one working. Have you tried any card that's 2Gb+ and class 4 or higher?
Ian
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Debugging SDIO
Hi,
I don't have a fast card right now I will try to find one. Try to understand how the write operation fails, does it fail randomly or it is a systematic error?
There is a timeout setting you may try to change: STM32_SDC_DATATIMEOUT
Giovanni
I don't have a fast card right now I will try to find one. Try to understand how the write operation fails, does it fail randomly or it is a systematic error?
There is a timeout setting you may try to change: STM32_SDC_DATATIMEOUT
Giovanni
Re: Debugging SDIO
It's systematic. Every time I write to a new area of the card it fails with a timeout, then if I try it again it works from then on. It's independent of ChibiOS, since the same thing happens with the STLib demo. I guess what I haven't tried to figure out is whether it stays like this forever of fails again after a while.
Re: Debugging SDIO
I'm going to try with a few different cards, don't worry about it. I was asking in case you had.