Page 2 of 4

Re: Debugging SDIO

Posted: Sun May 22, 2011 8:01 am
by Giovanni
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

Re: Debugging SDIO

Posted: Sun May 22, 2011 8:07 am
by Giovanni
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

Re: Debugging SDIO

Posted: Sun May 29, 2011 10:06 am
by Giovanni
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

Re: Debugging SDIO

Posted: Mon Jun 06, 2011 7:17 pm
by Giovanni
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

Re: Debugging SDIO

Posted: Mon Jun 13, 2011 7:33 pm
by ianmga
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

Re: Debugging SDIO

Posted: Mon Jun 13, 2011 7:50 pm
by Giovanni
No problems, I was wondering how to proceed with this.

Giovanni

Re: Debugging SDIO

Posted: Fri Jun 17, 2011 8:33 pm
by ianmga
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

Re: Debugging SDIO

Posted: Fri Jun 17, 2011 8:41 pm
by Giovanni
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

Re: Debugging SDIO

Posted: Sat Jun 18, 2011 12:29 am
by ianmga
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

Posted: Sat Jun 18, 2011 12:30 am
by ianmga
I'm going to try with a few different cards, don't worry about it. I was asking in case you had.