EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

LPC2478: SD card DMA

Started by John July 27, 2011
Hello!
Sorry for my bad English! I need help. =)

I write files on the SD card. I am using a filesystem from Keil.
When I set the Base address of Cache Buffer in USB RAM - everything OK.
But when I set the Base address in SDRAM (EMC) - its not work!

I have a question - is the DMA of LPC2478 can to transmit data from the MCI FIFO to SDRAM? Or it can only transmit from the MCI FIFO to USB RAM?

Thank you!

An Engineer's Guide to the LPC2100 Series

Hi,

Yes, GPDMA can transfer data direclty from MCI to external SDRAM. If you
take a look at the chapter 32 from the LPC2478 user manual, you'll see the
memory areas accessible via GPDMA.
Check again your GPDMA configuration, especially Source/Destination Addres
Registers.

Regards,
Kuba

2011/7/27 John

> **
> Hello!
> Sorry for my bad English! I need help. =)
>
> I write files on the SD card. I am using a filesystem from Keil.
> When I set the Base address of Cache Buffer in USB RAM - everything OK.
> But when I set the Base address in SDRAM (EMC) - its not work!
>
> I have a question - is the DMA of LPC2478 can to transmit data from the MCI
> FIFO to SDRAM? Or it can only transmit from the MCI FIFO to USB RAM?
>
> Thank you!
>
>
>
Thanks for the quick answer!
I use the Keil RL File System and Keil MCI driver. And settings for DMA looks good:
/* Transfer from memory to MCI-FIFO. */
GPDMA_CH0_SRC = (U32)buf;
GPDMA_CH0_DEST = (U32)&MCI_FIFO;
/* The burst size set to 8, transfer size 512 bytes. */
GPDMA_CH0_CTRL = (512 >> 2) | (0x02 << 12) | (0x02 << 15) | (0x02 << 18) | (0x02 << 21) | (1 << 26) | (1u << 31);
GPDMA_CH0_CFG = 0x10001 | (0x00 << 1) | (0x04 << 6) | (0x05 << 11);

But it works only with Base address of Cache Buffer in USB RAM... Perhaps this is the problem of Keil library, but I'm not sure.

--- In l..., Kuba Dorzak wrote:
>
> Hi,
>
> Yes, GPDMA can transfer data direclty from MCI to external SDRAM. If you
> take a look at the chapter 32 from the LPC2478 user manual, you'll see the
> memory areas accessible via GPDMA.
> Check again your GPDMA configuration, especially Source/Destination Addres
> Registers.
>
> Regards,
> Kuba
>
> 2011/7/27 John > **
> >
> >
> > Hello!
> > Sorry for my bad English! I need help. =)
> >
> > I write files on the SD card. I am using a filesystem from Keil.
> > When I set the Base address of Cache Buffer in USB RAM - everything OK.
> > But when I set the Base address in SDRAM (EMC) - its not work!
> >
> > I have a question - is the DMA of LPC2478 can to transmit data from the MCI
> > FIFO to SDRAM? Or it can only transmit from the MCI FIFO to USB RAM?
> >
> > Thank you!
> >
> >
>

Quick quess: I don't know what's your buff definition- whether it goes to
0xA000 0000 address- which is SDRAM beginning, check it or write directly:
GPDMA_CH0_SRC = 0xA0000000;

2011/7/27 John

> **
> Thanks for the quick answer!
> I use the Keil RL File System and Keil MCI driver. And settings for DMA
> looks good:
> /* Transfer from memory to MCI-FIFO. */
> GPDMA_CH0_SRC = (U32)buf;
> GPDMA_CH0_DEST = (U32)&MCI_FIFO;
> /* The burst size set to 8, transfer size 512 bytes. */
> GPDMA_CH0_CTRL = (512 >> 2) | (0x02 << 12) | (0x02 << 15) | (0x02 << 18) |
> (0x02 << 21) | (1 << 26) | (1u << 31);
> GPDMA_CH0_CFG = 0x10001 | (0x00 << 1) | (0x04 << 6) | (0x05 << 11);
>
> But it works only with Base address of Cache Buffer in USB RAM... Perhaps
> this is the problem of Keil library, but I'm not sure.
> --- In l..., Kuba Dorzak wrote:
> >
> > Hi,
> >
> > Yes, GPDMA can transfer data direclty from MCI to external SDRAM. If you
> > take a look at the chapter 32 from the LPC2478 user manual, you'll see
> the
> > memory areas accessible via GPDMA.
> > Check again your GPDMA configuration, especially Source/Destination
> Addres
> > Registers.
> >
> > Regards,
> > Kuba
> >
> > 2011/7/27 John
> >
> > > **
>
> > >
> > >
> > > Hello!
> > > Sorry for my bad English! I need help. =)
> > >
> > > I write files on the SD card. I am using a filesystem from Keil.
> > > When I set the Base address of Cache Buffer in USB RAM - everything OK.
> > > But when I set the Base address in SDRAM (EMC) - its not work!
> > >
> > > I have a question - is the DMA of LPC2478 can to transmit data from the
> MCI
> > > FIFO to SDRAM? Or it can only transmit from the MCI FIFO to USB RAM?
> > >
> > > Thank you!
> > >
> > >
> > >
> >
>
Long time ago I had the same problem
I dont remember wrere are in the data sheet, but the DMA in MCI can't
transfer to regular RAM, only to USB ram
So, tour results are correct

Regards

-----Original Message-----
From: l... [mailto:l...] On Behalf Of
John
Sent: micoles, 27 de julio de 2011 11:34
To: l...
Subject: [lpc2000] Re: LPC2478: SD card DMA

Thanks for the quick answer!
I use the Keil RL File System and Keil MCI driver. And settings for DMA
looks good:
/* Transfer from memory to MCI-FIFO. */
GPDMA_CH0_SRC = (U32)buf;
GPDMA_CH0_DEST = (U32)&MCI_FIFO;
/* The burst size set to 8, transfer size 512 bytes. */
GPDMA_CH0_CTRL = (512 >> 2) | (0x02 << 12) | (0x02 << 15) | (0x02 << 18) |
(0x02 << 21) | (1 << 26) | (1u << 31);
GPDMA_CH0_CFG = 0x10001 | (0x00 << 1) | (0x04 << 6) | (0x05 << 11);

But it works only with Base address of Cache Buffer in USB RAM... Perhaps
this is the problem of Keil library, but I'm not sure.

--- In l..., Kuba Dorzak wrote:
>
> Hi,
>
> Yes, GPDMA can transfer data direclty from MCI to external SDRAM. If you
> take a look at the chapter 32 from the LPC2478 user manual, you'll see the
> memory areas accessible via GPDMA.
> Check again your GPDMA configuration, especially Source/Destination Addres
> Registers.
>
> Regards,
> Kuba
>
> 2011/7/27 John
>
> > **
> >
> >
> > Hello!
> > Sorry for my bad English! I need help. =)
> >
> > I write files on the SD card. I am using a filesystem from Keil.
> > When I set the Base address of Cache Buffer in USB RAM - everything OK.
> > But when I set the Base address in SDRAM (EMC) - its not work!
> >
> > I have a question - is the DMA of LPC2478 can to transmit data from the
MCI
> > FIFO to SDRAM? Or it can only transmit from the MCI FIFO to USB RAM?
> >
> > Thank you!
> >
> >
>

I know, that the DMA can't transfer to regular RAM. It can only access off-chip memory via the External Memory Controller, as well as the USBRAM located on AHB1. But in my case the Keil's RL File System works correctly only with USBRAM. Although in theory it should work with External Memory Controller too...

--- In l..., "Angel Sanchez" wrote:
>
> Long time ago I had the same problem
> I dont remember wrere are in the data sheet, but the DMA in MCI can't
> transfer to regular RAM, only to USB ram
> So, tour results are correct
>
> Regards
>
> -----Original Message-----
> From: l... [mailto:l...] On Behalf Of
> John
> Sent: micoles, 27 de julio de 2011 11:34
> To: l...
> Subject: [lpc2000] Re: LPC2478: SD card DMA
>
> Thanks for the quick answer!
> I use the Keil RL File System and Keil MCI driver. And settings for DMA
> looks good:
> /* Transfer from memory to MCI-FIFO. */
> GPDMA_CH0_SRC = (U32)buf;
> GPDMA_CH0_DEST = (U32)&MCI_FIFO;
> /* The burst size set to 8, transfer size 512 bytes. */
> GPDMA_CH0_CTRL = (512 >> 2) | (0x02 << 12) | (0x02 << 15) | (0x02 << 18) |
> (0x02 << 21) | (1 << 26) | (1u << 31);
> GPDMA_CH0_CFG = 0x10001 | (0x00 << 1) | (0x04 << 6) | (0x05 << 11);
>
> But it works only with Base address of Cache Buffer in USB RAM... Perhaps
> this is the problem of Keil library, but I'm not sure.
>
> --- In l..., Kuba Dorzak wrote:
> >
> > Hi,
> >
> > Yes, GPDMA can transfer data direclty from MCI to external SDRAM. If you
> > take a look at the chapter 32 from the LPC2478 user manual, you'll see the
> > memory areas accessible via GPDMA.
> > Check again your GPDMA configuration, especially Source/Destination Addres
> > Registers.
> >
> > Regards,
> > Kuba
> >
> > 2011/7/27 John
> >
> > > **
> > >
> > >
> > > Hello!
> > > Sorry for my bad English! I need help. =)
> > >
> > > I write files on the SD card. I am using a filesystem from Keil.
> > > When I set the Base address of Cache Buffer in USB RAM - everything OK.
> > > But when I set the Base address in SDRAM (EMC) - its not work!
> > >
> > > I have a question - is the DMA of LPC2478 can to transmit data from the
> MCI
> > > FIFO to SDRAM? Or it can only transmit from the MCI FIFO to USB RAM?
> > >
> > > Thank you!
> > >
> > >
> > >
> >
>
>
>
>
>
>
>
Not very quick answer: =)
I defind buff in Net_Config.h - Keil's RL FileSystem configurations wizard. I don't have source code of Keil's library, but on debug mode I can see, that GPDMA_CH0_SRC = 0xA0000000 in the DmaStart func.
--- In l..., Kuba Dorzak wrote:
>
> Quick quess: I don't know what's your buff definition- whether it goes to
> 0xA000 0000 address- which is SDRAM beginning, check it or write directly:
> GPDMA_CH0_SRC = 0xA0000000;
>
> 2011/7/27 John > **
> >
> >
> > Thanks for the quick answer!
> > I use the Keil RL File System and Keil MCI driver. And settings for DMA
> > looks good:
> > /* Transfer from memory to MCI-FIFO. */
> > GPDMA_CH0_SRC = (U32)buf;
> > GPDMA_CH0_DEST = (U32)&MCI_FIFO;
> > /* The burst size set to 8, transfer size 512 bytes. */
> > GPDMA_CH0_CTRL = (512 >> 2) | (0x02 << 12) | (0x02 << 15) | (0x02 << 18) |
> > (0x02 << 21) | (1 << 26) | (1u << 31);
> > GPDMA_CH0_CFG = 0x10001 | (0x00 << 1) | (0x04 << 6) | (0x05 << 11);
> >
> > But it works only with Base address of Cache Buffer in USB RAM... Perhaps
> > this is the problem of Keil library, but I'm not sure.
> >
> >
> > --- In l..., Kuba Dorzak wrote:
> > >
> > > Hi,
> > >
> > > Yes, GPDMA can transfer data direclty from MCI to external SDRAM. If you
> > > take a look at the chapter 32 from the LPC2478 user manual, you'll see
> > the
> > > memory areas accessible via GPDMA.
> > > Check again your GPDMA configuration, especially Source/Destination
> > Addres
> > > Registers.
> > >
> > > Regards,
> > > Kuba
> > >
> > > 2011/7/27 John
> > >
> > > > **
> >
> > > >
> > > >
> > > > Hello!
> > > > Sorry for my bad English! I need help. =)
> > > >
> > > > I write files on the SD card. I am using a filesystem from Keil.
> > > > When I set the Base address of Cache Buffer in USB RAM - everything OK.
> > > > But when I set the Base address in SDRAM (EMC) - its not work!
> > > >
> > > > I have a question - is the DMA of LPC2478 can to transmit data from the
> > MCI
> > > > FIFO to SDRAM? Or it can only transmit from the MCI FIFO to USB RAM?
> > > >
> > > > Thank you!
> > > >
> > > >
> > > >
> > >
> >
> >
>

Another thought: have you properly initialized SDRAM? Can you write/read
to/from 0xA0000000?
Kuba

2011/7/28 John

> **
> I know, that the DMA can't transfer to regular RAM. It can only access
> off-chip memory via the External Memory Controller, as well as the USBRAM
> located on AHB1. But in my case the Keil's RL File System works correctly
> only with USBRAM. Although in theory it should work with External Memory
> Controller too...
>
> --- In l..., "Angel Sanchez" wrote:
> >
> > Long time ago I had the same problem
> > I dont remember wrere are in the data sheet, but the DMA in MCI can't
> > transfer to regular RAM, only to USB ram
> > So, tour results are correct
> >
> > Regards
> >
> > -----Original Message-----
> > From: l... [mailto:l...] On Behalf
> Of
> > John
> > Sent: micoles, 27 de julio de 2011 11:34
> > To: l...
> > Subject: [lpc2000] Re: LPC2478: SD card DMA
> >
> > Thanks for the quick answer!
> > I use the Keil RL File System and Keil MCI driver. And settings for DMA
> > looks good:
> > /* Transfer from memory to MCI-FIFO. */
> > GPDMA_CH0_SRC = (U32)buf;
> > GPDMA_CH0_DEST = (U32)&MCI_FIFO;
> > /* The burst size set to 8, transfer size 512 bytes. */
> > GPDMA_CH0_CTRL = (512 >> 2) | (0x02 << 12) | (0x02 << 15) | (0x02 << 18)
> |
> > (0x02 << 21) | (1 << 26) | (1u << 31);
> > GPDMA_CH0_CFG = 0x10001 | (0x00 << 1) | (0x04 << 6) | (0x05 << 11);
> >
> > But it works only with Base address of Cache Buffer in USB RAM... Perhaps
> > this is the problem of Keil library, but I'm not sure.
> >
> > --- In l..., Kuba Dorzak wrote:
> > >
> > > Hi,
> > >
> > > Yes, GPDMA can transfer data direclty from MCI to external SDRAM. If
> you
> > > take a look at the chapter 32 from the LPC2478 user manual, you'll see
> the
> > > memory areas accessible via GPDMA.
> > > Check again your GPDMA configuration, especially Source/Destination
> Addres
> > > Registers.
> > >
> > > Regards,
> > > Kuba
> > >
> > > 2011/7/27 John
> > >
> > > > **
> > > >
> > > >
> > > > Hello!
> > > > Sorry for my bad English! I need help. =)
> > > >
> > > > I write files on the SD card. I am using a filesystem from Keil.
> > > > When I set the Base address of Cache Buffer in USB RAM - everything
> OK.
> > > > But when I set the Base address in SDRAM (EMC) - its not work!
> > > >
> > > > I have a question - is the DMA of LPC2478 can to transmit data from
> the
> > MCI
> > > > FIFO to SDRAM? Or it can only transmit from the MCI FIFO to USB RAM?
> > > >
> > > > Thank you!
> > > >
> > > >
> > > >
> > >
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
>
Yes, it's OK - I can write/read to/from my SDRAM.
I think move to Chan's FatFs. If I have time... In this case, I can check is it Keil's library bug or something else.
--- In l..., Kuba Dorzak wrote:
>
> Another thought: have you properly initialized SDRAM? Can you write/read
> to/from 0xA0000000?
>
>
> Kuba
>
> 2011/7/28 John
>
> > **
> >
> >
> > I know, that the DMA can't transfer to regular RAM. It can only access
> > off-chip memory via the External Memory Controller, as well as the USBRAM
> > located on AHB1. But in my case the Keil's RL File System works correctly
> > only with USBRAM. Although in theory it should work with External Memory
> > Controller too...
> >
> > --- In l..., "Angel Sanchez" wrote:
> > >
> > > Long time ago I had the same problem
> > > I dont remember wrere are in the data sheet, but the DMA in MCI can't
> > > transfer to regular RAM, only to USB ram
> > > So, tour results are correct
> > >
> > > Regards
> > >
> > > -----Original Message-----
> > > From: l... [mailto:l...] On Behalf
> > Of
> > > John
> > > Sent: micoles, 27 de julio de 2011 11:34
> > > To: l...
> > > Subject: [lpc2000] Re: LPC2478: SD card DMA
> > >
> > > Thanks for the quick answer!
> > > I use the Keil RL File System and Keil MCI driver. And settings for DMA
> > > looks good:
> > > /* Transfer from memory to MCI-FIFO. */
> > > GPDMA_CH0_SRC = (U32)buf;
> > > GPDMA_CH0_DEST = (U32)&MCI_FIFO;
> > > /* The burst size set to 8, transfer size 512 bytes. */
> > > GPDMA_CH0_CTRL = (512 >> 2) | (0x02 << 12) | (0x02 << 15) | (0x02 << 18)
> > |
> > > (0x02 << 21) | (1 << 26) | (1u << 31);
> > > GPDMA_CH0_CFG = 0x10001 | (0x00 << 1) | (0x04 << 6) | (0x05 << 11);
> > >
> > > But it works only with Base address of Cache Buffer in USB RAM... Perhaps
> > > this is the problem of Keil library, but I'm not sure.
> > >
> > > --- In l..., Kuba Dorzak wrote:
> > > >
> > > > Hi,
> > > >
> > > > Yes, GPDMA can transfer data direclty from MCI to external SDRAM. If
> > you
> > > > take a look at the chapter 32 from the LPC2478 user manual, you'll see
> > the
> > > > memory areas accessible via GPDMA.
> > > > Check again your GPDMA configuration, especially Source/Destination
> > Addres
> > > > Registers.
> > > >
> > > > Regards,
> > > > Kuba
> > > >
> > > > 2011/7/27 John
> > > >
> > > > > **
> > > > >
> > > > >
> > > > > Hello!
> > > > > Sorry for my bad English! I need help. =)
> > > > >
> > > > > I write files on the SD card. I am using a filesystem from Keil.
> > > > > When I set the Base address of Cache Buffer in USB RAM - everything
> > OK.
> > > > > But when I set the Base address in SDRAM (EMC) - its not work!
> > > > >
> > > > > I have a question - is the DMA of LPC2478 can to transmit data from
> > the
> > > MCI
> > > > > FIFO to SDRAM? Or it can only transmit from the MCI FIFO to USB RAM?
> > > > >
> > > > > Thank you!
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
Maybe it would be easier to detect the error if you did not use a
filesystem. First, I'd try to write/read a buffer with very basic write/read
routines. If it works, you'll know that the problem is in your filesystem.
Kuba

2011/7/28 John

> **
> Yes, it's OK - I can write/read to/from my SDRAM.
> I think move to Chan's FatFs. If I have time... In this case, I can check
> is it Keil's library bug or something else.
> --- In l..., Kuba Dorzak wrote:
> >
> > Another thought: have you properly initialized SDRAM? Can you write/read
> > to/from 0xA0000000?
> >
> >
> > Kuba
> >
> > 2011/7/28 John
> >
> > > **
>
> > >
> > >
> > > I know, that the DMA can't transfer to regular RAM. It can only access
> > > off-chip memory via the External Memory Controller, as well as the
> USBRAM
> > > located on AHB1. But in my case the Keil's RL File System works
> correctly
> > > only with USBRAM. Although in theory it should work with External
> Memory
> > > Controller too...
> > >
> > > --- In l..., "Angel Sanchez" wrote:
> > > >
> > > > Long time ago I had the same problem
> > > > I dont remember wrere are in the data sheet, but the DMA in MCI can't
> > > > transfer to regular RAM, only to USB ram
> > > > So, tour results are correct
> > > >
> > > > Regards
> > > >
> > > > -----Original Message-----
> > > > From: l... [mailto:l...] On
> Behalf
> > > Of
> > > > John
> > > > Sent: micoles, 27 de julio de 2011 11:34
> > > > To: l...
> > > > Subject: [lpc2000] Re: LPC2478: SD card DMA
> > > >
> > > > Thanks for the quick answer!
> > > > I use the Keil RL File System and Keil MCI driver. And settings for
> DMA
> > > > looks good:
> > > > /* Transfer from memory to MCI-FIFO. */
> > > > GPDMA_CH0_SRC = (U32)buf;
> > > > GPDMA_CH0_DEST = (U32)&MCI_FIFO;
> > > > /* The burst size set to 8, transfer size 512 bytes. */
> > > > GPDMA_CH0_CTRL = (512 >> 2) | (0x02 << 12) | (0x02 << 15) | (0x02 <<
> 18)
> > > |
> > > > (0x02 << 21) | (1 << 26) | (1u << 31);
> > > > GPDMA_CH0_CFG = 0x10001 | (0x00 << 1) | (0x04 << 6) | (0x05 << 11);
> > > >
> > > > But it works only with Base address of Cache Buffer in USB RAM...
> Perhaps
> > > > this is the problem of Keil library, but I'm not sure.
> > > >
> > > > --- In l..., Kuba Dorzak wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > Yes, GPDMA can transfer data direclty from MCI to external SDRAM.
> If
> > > you
> > > > > take a look at the chapter 32 from the LPC2478 user manual, you'll
> see
> > > the
> > > > > memory areas accessible via GPDMA.
> > > > > Check again your GPDMA configuration, especially Source/Destination
> > > Addres
> > > > > Registers.
> > > > >
> > > > > Regards,
> > > > > Kuba
> > > > >
> > > > > 2011/7/27 John
> > > > >
> > > > > > **
> > > > > >
> > > > > >
> > > > > > Hello!
> > > > > > Sorry for my bad English! I need help. =)
> > > > > >
> > > > > > I write files on the SD card. I am using a filesystem from Keil.
> > > > > > When I set the Base address of Cache Buffer in USB RAM -
> everything
> > > OK.
> > > > > > But when I set the Base address in SDRAM (EMC) - its not work!
> > > > > >
> > > > > > I have a question - is the DMA of LPC2478 can to transmit data
> from
> > > the
> > > > MCI
> > > > > > FIFO to SDRAM? Or it can only transmit from the MCI FIFO to USB
> RAM?
> > > > > >
> > > > > > Thank you!
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Yahoo! Groups Links
> > > >
> > >
> > >
> > >
> >
>

The 2024 Embedded Online Conference