2013-07-18 11:13 PM
first of all the DMA code:
void DMA_Config(uint32_t addr){//int addr=&ipbuffer;NVIC_InitTypeDef NVIC_InitStructure;DMA_InitTypeDef DMA_InitStructure;/* Enable DMA clock */RCC_AHB1PeriphClockCmd(DMA_STREAM_CLOCK, ENABLE);/* Reset DMA Stream registers (for debug purpose) */DMA_DeInit(DMA_STREAM);while (DMA_GetCmdStatus(DMA_STREAM) != DISABLE){}/* Configure DMA Stream */DMA_InitStructure.DMA_Channel = DMA_CHANNEL;DMA_InitStructure.DMA_PeripheralBaseAddr =addr;DMA_InitStructure.DMA_Memory0BaseAddr =0x60010000; //FSMC addressDMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToMemory;DMA_InitStructure.DMA_BufferSize =480; //(uint32_t)BUFFER_SIZE;DMA_InitStructure.DMA_PeripheralInc =DMA_PeripheralInc_Enable;DMA_InitStructure.DMA_MemoryInc =DMA_MemoryInc_Disable;DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;//DMA_MemoryDataSize_Word;DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;DMA_InitStructure.DMA_Priority = DMA_Priority_High;DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;DMA_InitStructure.DMA_MemoryBurst =DMA_MemoryBurst_Single;DMA_InitStructure.DMA_PeripheralBurst =DMA_PeripheralBurst_Single;DMA_Init(DMA_STREAM, &DMA_InitStructure);/* Enable DMA Stream Transfer Complete interrupt *///DMA_ITConfig(DMA_STREAM, DMA_IT_TC, ENABLE);/* DMA Stream enable */DMA_Cmd(DMA_STREAM, ENABLE);//interrupt enableNVIC_InitStructure.NVIC_IRQChannel = DMA_STREAM_IRQ;NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;NVIC_Init(&NVIC_InitStructure);}when i call addr=&buffer[0]+4; DMA_Config(addr);this works perfectly I have checked the addr its 536903104 when i call addr=&buffer[0];and 536903108 when i call addr=&buffer[1];but both of these calls dont work .it only works whwn i call addr=&buffer[0]+4;then DMA_Config(addr);can anyone explain whats happening ?2013-07-19 01:42 AM
You might want to enable this
DMA_InitStructure.DMA_MemoryInc =DMA_MemoryInc_Disable; // ???? It would help if you provided the defines, and explained a bit better what the data patterns were you were trying to copy, and what the resultant failure modes actually produced.2013-07-19 03:49 AM
first of all thanks for your quick replay.
DMA_InitStructure.DMA_MemoryInc =DMA_MemoryInc_Disable; // ????i am doing so because i am sending it to a LCD. that has one RS line to select between RAM and registers.the buffer contains some rgb data. the error is everything gets transferred to LCD but in a distorted way. it seems like red color is high and blue is low.my image is in blue but it looks like its in red. the buffer is the output for libjpeg that converts jpeg to rgb row. here are my defines....#define DMA_STREAM DMA2_Stream0#define DMA_CHANNEL DMA_Channel_0#define DMA_STREAM_CLOCK RCC_AHB1Periph_DMA2#define DMA_STREAM_IRQ DMA2_Stream0_IRQn#define DMA_IT_TCIF DMA_IT_TCIF0#define DAM_STREAM_IRQHANDLER DMA2_Stream0_IRQHandler2013-07-19 03:59 AM
Sounds more like the video data formats are not coherent between the source and destination.
Look very carefully at the spec for the LCD, and the bit/byte ordering of the data it expects.