EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

DMA transfers on LPC2148

Started by oliverks1 July 21, 2006
I want to use the DMA functionality on the LPC2148 to transfer data to a USB host. I have
setup and tested a bulk end point using non-DMA functionality and it works fine. I now
want to convert that end point to use DMA to offload processing from the ARM 7.

I am using the Olimex LPC-P2148 development board with a 4.1.0 version of gcc that
cross compiles for the ARM platform.

I set up a series of 4 Data Descriptors for EP 2 IN (0x82). The 4 word data descriptors are
initialized to:
DD record 7fd01090 : 04000804 : 7fd00000 : 00000000 at 0x7fd01080
DD record 7fd010a0 : 04000804 : 7fd00400 : 00000000 at 0x7fd01090
DD record 7fd010b0 : 04000804 : 7fd00800 : 00000000 at 0x7fd010a0
DD record 00000000 : 04000800 : 7fd00c00 : 00000000 at 0x7fd010b0
I then set up the UCDA array so that index 5 points to 7fd01080. The UDCA array lives in
memory address 0x7fd01000-0x7fd0107F. I seem to be able to read and write from the
USB RAM without difficulty.

I then set end point 2 so that the EP interrupt is no longer enabled and I issued the device
command SET MODE (0xF3) with a data byte of 0x01 which the spec sheet says must be
done for DMA to work. I set the USB DMA Interrupt Enable (USBDMAIntEn) to 0x07.

I set up a test program on the host to read 4096 bytes of data from the end point 0x82.
This program worked fine when I was not trying to run in DMA mode.

I then try to enable the DMA transfer by setting USB Endpoint DMA Enable (USBEpDMAEn)
to 0x00000020. Unfortunately, this does not seem to work. I get some rather strange
results.

First USB Endpoint DMA Status (USBEpDMASt) remains stubbornly zero regardless of what I
try. Second USB DMA Request Status (USBDMARSt) always reads 0x030c30c0 which
suggests that the register has not been activated. All the other DMA status registers read
back as zeros.

If anyone has DMA sample code that is known to work or suggestions of ideas to try to
make the DMA transfer to work I would appreciate hearing about it.

Oliver

An Engineer's Guide to the LPC2100 Series

Oliver,

have you had a look to the Keil USB sample code, it can be freely
downloaded from the Keil website? The have the DMA code in (when enabled
via #ifdefs), but I have never tested if the DMA code of this sample code
works.

Regards
Herbert

At 05:02 21.07.2006 +0000, you wrote:

>I want to use the DMA functionality on the LPC2148 to transfer data to a
>USB host. I have
>setup and tested a bulk end point using non-DMA functionality and it works
>fine. I now
>want to convert that end point to use DMA to offload processing from the
>ARM 7.
>
>I am using the Olimex LPC-P2148 development board with a 4.1.0 version of
>gcc that
>cross compiles for the ARM platform.
>
>I set up a series of 4 Data Descriptors for EP 2 IN (0x82). The 4 word
>data descriptors are
>initialized to:
>DD record 7fd01090 : 04000804 : 7fd00000 : 00000000 at 0x7fd01080
>DD record 7fd010a0 : 04000804 : 7fd00400 : 00000000 at 0x7fd01090
>DD record 7fd010b0 : 04000804 : 7fd00800 : 00000000 at 0x7fd010a0
>DD record 00000000 : 04000800 : 7fd00c00 : 00000000 at 0x7fd010b0
>I then set up the UCDA array so that index 5 points to 7fd01080. The UDCA
>array lives in
>memory address 0x7fd01000-0x7fd0107F. I seem to be able to read and write
>from the
>USB RAM without difficulty.
>
>I then set end point 2 so that the EP interrupt is no longer enabled and I
>issued the device
>command SET MODE (0xF3) with a data byte of 0x01 which the spec sheet says
>must be
>done for DMA to work. I set the USB DMA Interrupt Enable (USBDMAIntEn) to
>0x07.
>
>I set up a test program on the host to read 4096 bytes of data from the
>end point 0x82.
>This program worked fine when I was not trying to run in DMA mode.
>
>I then try to enable the DMA transfer by setting USB Endpoint DMA Enable
>(USBEpDMAEn)
>to 0x00000020. Unfortunately, this does not seem to work. I get some
>rather strange
>results.
>
>First USB Endpoint DMA Status (USBEpDMASt) remains stubbornly zero
>regardless of what I
>try. Second USB DMA Request Status (USBDMARSt) always reads 0x030c30c0 which
>suggests that the register has not been activated. All the other DMA
>status registers read
>back as zeros.
>
>If anyone has DMA sample code that is known to work or suggestions of
>ideas to try to
>make the DMA transfer to work I would appreciate hearing about it.
>
>Oliver


I could not get that code to work, but I did not try that hard either.
Part of the problem is I am not using their eval board. If someone
knows for sure that code works, I would try harder at porting it.

Oliver
--- In l..., Herbert Demmel wrote:
>
> Oliver,
>
> have you had a look to the Keil USB sample code, it can be freely
> downloaded from the Keil website? The have the DMA code in (when
enabled
> via #ifdefs), but I have never tested if the DMA code of this sample
code
> works.
>
> Regards
> Herbert
>
> At 05:02 21.07.2006 +0000, you wrote:
>
> >I want to use the DMA functionality on the LPC2148 to transfer data
to a
> >USB host. I have
> >setup and tested a bulk end point using non-DMA functionality and
it works
> >fine. I now
> >want to convert that end point to use DMA to offload processing
from the
> >ARM 7.
> >
> >I am using the Olimex LPC-P2148 development board with a 4.1.0
version of
> >gcc that
> >cross compiles for the ARM platform.
> >
> >I set up a series of 4 Data Descriptors for EP 2 IN (0x82). The 4 word
> >data descriptors are
> >initialized to:
> >DD record 7fd01090 : 04000804 : 7fd00000 : 00000000 at 0x7fd01080
> >DD record 7fd010a0 : 04000804 : 7fd00400 : 00000000 at 0x7fd01090
> >DD record 7fd010b0 : 04000804 : 7fd00800 : 00000000 at 0x7fd010a0
> >DD record 00000000 : 04000800 : 7fd00c00 : 00000000 at 0x7fd010b0
> >I then set up the UCDA array so that index 5 points to 7fd01080.
The UDCA
> >array lives in
> >memory address 0x7fd01000-0x7fd0107F. I seem to be able to read and
write
> >from the
> >USB RAM without difficulty.
> >
> >I then set end point 2 so that the EP interrupt is no longer
enabled and I
> >issued the device
> >command SET MODE (0xF3) with a data byte of 0x01 which the spec
sheet says
> >must be
> >done for DMA to work. I set the USB DMA Interrupt Enable
(USBDMAIntEn) to
> >0x07.
> >
> >I set up a test program on the host to read 4096 bytes of data from
the
> >end point 0x82.
> >This program worked fine when I was not trying to run in DMA mode.
> >
> >I then try to enable the DMA transfer by setting USB Endpoint DMA
Enable
> >(USBEpDMAEn)
> >to 0x00000020. Unfortunately, this does not seem to work. I get some
> >rather strange
> >results.
> >
> >First USB Endpoint DMA Status (USBEpDMASt) remains stubbornly zero
> >regardless of what I
> >try. Second USB DMA Request Status (USBDMARSt) always reads
0x030c30c0 which
> >suggests that the register has not been activated. All the other DMA
> >status registers read
> >back as zeros.
> >
> >If anyone has DMA sample code that is known to work or suggestions of
> >ideas to try to
> >make the DMA transfer to work I would appreciate hearing about it.
> >
> >Oliver
> >
> >
>
>


The 2024 Embedded Online Conference