I'm trying to develop a program which communicatee with WIFI card over SDIO protocol. The SDIO protocol part working fine but I want to use the simple internal DMA to read and write data. However I got at every time a DMA ERROR interrupt (the DMA TRANSFER COMPLETE flag is also fired up). Here is my configuration program:
SDIO_SetWriteWatermark(SDHC_BASE_PTR, (u32)(count&0xffff));SDIO_SetReadWatermark(SDHC_BASE_PTR, (u32)(count&0xffff));SDIO_SetDMAAddress(SDHC_BASE_PTR, (u32)data); // data is an pointer over my bufferSDIO_SetCommandArgument(SDHC_BASE_PTR, arg); SDIO_SendCommand(SDHC_BASE_PTR, SDIO_CMD53_IO_RW_EXTENDED,SDIO_ENABLE_DMA | SDIO_DATA_PRESENT | SDIO_DATA_READ | SDIO_RESPONSE_LENGTH_48);
Someone has an idea to get the SDIO working fine with the internal DMA?
I didn't manage to get ADMA working on the SDIO. The problem that I had was that I was getting data from the chip (visible with logic analyser) but the ADMA2 was giving an error that its buffer descriptor was invalid (DMA error).
Its buffer descriptor is very simple and I didn't see why it should report that the valid bit is not set (even if I filled the buffer descriptor with 0xffffffff 0xffffffff it reported the same error, even though no bit is a '0'...(?)). Therefore I always used it since then in non-DMA mode.
Is this a different problem to yours or is it effectively the same?
Thanks for your reply,
Yes I have the same error as yours when I use ADMA2. That's really weird because the descriptor seems to be correct. I also tried the simple DMA mode and I have also a DMA error.
Hope that someone will can help us.
I haven't found any examples on this so I am assuming that it doesn't work (rather than invest too much time getting no where). It would ceretainly be good if freescale could add a demonstration in this mode to know that it will be worth making the attempt to overcome difficulties, whereby I would expect that the trick to getting it working will be visible in the example.
It may be due to ADMA access rights but I didn't find what may be controlling it - in which case the actual DMA error may be misleading (eg. if the DMA controller can't actually access the buffer descriptor). In other DMA cases it sometimes occurs that there is a problem with access rights but I have otherwise always found that the DMA error made this fairly clear....
The naked speed for the 4 bit SDIO for 100M Hz K60 could be around 40-50M bps. I didn't know if your driver is ready for so fast buffer transceiving? Could you send me the driver for my reference. My email is in theis topic.
you can't received anything, because I didn't sent you email. Give me few days (up to weekend). I have at the moemnt something function but I want to clear up little bit source code.
Please be more patient.
I looks that it will be works.
here is my testing project for TWR-K60. It runs on mask 0M33Z. I tested it in IAR 6.21.
So I hope that will help zou, and I also except that zou look inside and all possible bugs or improvements zou are placed on this forum(I'll be more than happy) .
So there is also tested file system FATFS (http://elm-chan.org/fsw/ff/00index_e.html).
The driver is designed just only for SD/SDHC cards.
Enjoy and let me know.
sorry for bringing this Thread back to live.
Could you please readd the Source Code of your FATfs SDIO Driver, They have been lost.
I know there is a Processor-Expert Module for Codewarrior, but I use a different Compiler. So it is not working for me.
Thanks and Regards
here is the original version that I did in past (probably same as I left it at last time).version of MQX driver based on DMA and interrupts
In these days I did new MQX version of SDHC driver based on DMA and interrupts and I was able to achive on one card with MFS (MQX File system) read speed about 17MB/s.
So this driver is little bit obsolete, but it helps as a start point.
thanks fort he code,
I got it running with my Rowley Compiler and it seems to work correct. This is a good reference.
I tried to use the ADMA2 for Data-transfer and was unable to transfer a single Byte. I think I can manage it with this reference
Thanks and Regards
Hi, good to hear that code is running.
I'm sorry to say this but you want be able to read/write only one byte by ADMA due to SDHC peripheral errata - check the document.
The data buffers MUST be aligned to 4 bytes and also the length must be greater than 4 bytes and aligned to 4 bytes.
Sorry, for the confusion. I want to read a complete sector over SDIO (512 Byte) but get only an Interrupt with DMAE and CRM Flags in the IRQSTAT Register. Receiving the CID and CSD worked fine.
Your Code gives my some hints where I could change some settings.