Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

GPIO to RAM data transfer using DMA - LPC1768

Status
Not open for further replies.

niraj chavda

Newbie level 1
Joined
Apr 5, 2011
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,310
I am working in new project for which I have shortlisted the cortex M3 family microcontroller. Most probably i will go for LPC1768. But before I proceed I would like to confirm certain points about the DMA functionality for this chip.

In my project design system will need to fetch the data from the sensor. Data lines of the sensor will be connected to 8 GPIO lines. Sensor will inform about data availability on the data lines using separate signal on the separate dedicated GPIO. Once controller receives the first signal of data availability from the sensor, the data will be available on the data lines at constant rate (say at the rate of 0.75 MHz) and need to be stored in the RAM buffer. Basically I am trying to read captured image raw data from the camera sensor and want to read the data lines whenever pixel clock occurs.

I would like to use the DMA for this purpose. I studied the datasheet and i can see that there is no direct way to achieve this, I have studied the application note for the data transfer between SRAM and gpio using timer triggered dma transfer. I tried to implement it but somehow i am not able to run it properly.

Main confusing part for me is that according to application note gpio to ram transfer should be considered as memory to memory data transfer. Now memory to memory transfer is triggered as soon as the channel is enabled (If i understand this correct).
This is exactly what is happening here. As soon as i enable the channel data transfer starts and timer has no role in triggering the DMA transfer. What I am trying to achieve is opposite, the transfer should occur only at the match condition of the timer. Below is the sample code i tried to run.


unsigned int Destdata[3] = {0x55,0x55,0x55};
unsigned int Sourcedata[3] = {0xAA,0xAA,0xAA};
unsigned int i;
char j;
unsigned int *DMAReqSel = 0x400FC1C4;
unsigned int *DMACConfigReg = 0x50004030;
unsigned int *Pinsel17 = 0x4002C01C;

SystemInit(); // Clock set up , Flash accelerator module set up

*Pinsel17 = 0x000C0000;

/* Configuring timer */
TIM0 -> CTCR = 0x0; // Timer mode
TIM0 -> TC = 0x0; // Reset Timer counter register
TIM0 -> IR = 0x3F; // Clear all previous timer interrupts
TIM0 -> PR = 0x0; // Reset Timer pre-scaler register
TIM0 -> PC = 0x0; // Reset Timer pre-scaler counter register
TIM0 -> MR0 = 0xFFFF; // Match value
TIM0 -> EMR = 0x33; // Match 0.0 -> toggle on match event
TIM0 -> MCR = 0x2; // Reset on match of timer 0



/* Configure DMA */
SC -> PCONP = 0xFFFFFFFF; // Enable clock to DMA (and all other peripharals)
*DMACConfigReg = 0x00000000; // Disabling DMA controller
GPDMA -> DMACIntTCClear = 0x00000001; // Clear all dma interrupts on channel 0
GPDMA -> DMACIntErrClr = 0x00000001; // Clear all dma error interrupts on channel 0
*DMACConfigReg = 0x00000001; // Enable DMA controller
*DMAReqSel = 0x00000001; // Enabling match0.0 event to trigger DMA request
GPDMACH0 -> DMACCConfig = 0x00000000; // DMA channel disabled
GPDMACH0 -> DMACCDestAddr = &Destdata; // DMA destination address
GPDMACH0 -> DMACCSrcAddr = &Sourcedata; // DMA source address
GPDMACH0 -> DMACCControl = 0x00480001; // DMA transfer size '1' , memory to memory transfer,
GPDMACH0 -> DMACCConfig = 0x00000001; // DMA channel enabled

TIM0 -> TCR = 0x01; // Enable timer

while(1)
{

i = TIM0 -> TC;
if(i==0xFFFF)
{
j=0;
}
}

Please help me in achieving the goal I am trying to get.

Thanks,
Niraj.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top