cancel
Showing results for 
Search instead for 
Did you mean: 

EXTI and DMA2D problem ?!!!!

zeros_and_ones1991
Associate III
Posted on February 06, 2015 at 15:16

I have Touch LCD interface connected to my STM32F429I , on the board , the PENIRQ of the touch chip (XPT2046) is connected to PE3 , thus it is connected to EXTI3. I tested the touch module and could make it work perfectly . When I use the DMA2D to perform R2M operation , everything works fine . But only when I use the M2M mode , the EXTI3 interrupt is generated and the EXTI3 flag is never cleared , even if i try clear it more than one time in the ISR . This is really strange and obviously I can not say it could be some cross talk between the IO pins , because the LCD is on all the time . Its only when i try to use the DMA2D in M2M mode , the EXTI3 is generated without me touching the screen . 

Here is the simple par of the code 

//

//

LCD_DRAW_RGB565_BMP((uint8_t*)BMP,240,320);

while(LCD_CHECK_STATUS()!=LCD_SUCCESS);

LCD_TOUCH_CON_INIT ();

//

while(1)

{

LED_TOGGLE; 

Delay_ms(1000); 

}

//

// 

The EXTI3 interrupt is generated all the time 

//

When i use the following code instead 

LCD_Clear(BLUE); 

while(LCD_CHECK_STATUS()!=LCD_SUCCESS);

LCD_TOUCH_CON_INIT ();

//

while(1)

{

LED_TOGGLE; 

Delay_ms(1000); 

}

//

Everything works fine and the EXTI3 interrupt is never generated till i touch the screen

//

// 

Here is the implementation of the R2M mode and the M2M mode 

M2M mode 

void LCD_DRAW_RGB565_BMP (uint8_t * BMP_ptr , uint16_t height , uint16_t width)

{

DMA2D_InitTypeDef dma2d ;

  DMA2D_FG_InitTypeDef FG;

NVIC_InitTypeDef NVIC_DMA2D ;

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2D,ENABLE); 

DMA2D_DeInit();

dma2d.DMA2D_CMode=DMA2D_RGB565; 

dma2d.DMA2D_Mode=DMA2D_M2M;

dma2d.DMA2D_NumberOfLine=(uint32_t)height;

dma2d.DMA2D_PixelPerLine=(uint32_t)width; 

dma2d.DMA2D_OutputBlue=0; 

dma2d.DMA2D_OutputGreen=0;

  dma2d.DMA2D_OutputRed=0;

  dma2d.DMA2D_OutputMemoryAdd=LCD_FRAME_BUFFER; 

dma2d.DMA2D_OutputOffset= 0;

FG.DMA2D_FGCM=CM_RGB565; 

FG.DMA2D_FGC_BLUE=0; 

FG.DMA2D_FGC_GREEN=0; 

FG.DMA2D_FGC_RED=0;

FG.DMA2D_FGMA=(uint32_t)(BMP_ptr); 

FG.DMA2D_FGO=0;

FG.DMA2D_FGPFC_ALPHA_MODE=NO_MODIF_ALPHA_VALUE ; 

FG.DMA2D_FGPFC_ALPHA_VALUE=0; 

//

// Configure the Fourground

DMA2D_FGConfig(&FG); 

DMA2D_Init(&dma2d); 

NVIC_DMA2D.NVIC_IRQChannel=DMA2D_IRQn; 

NVIC_DMA2D.NVIC_IRQChannelCmd=ENABLE; 

NVIC_DMA2D.NVIC_IRQChannelPreemptionPriority=1; 

NVIC_DMA2D.NVIC_IRQChannelSubPriority=0;

NVIC_Init(&NVIC_DMA2D);

//

DMA2D_ITConfig(DMA2D_CR_CEIE|DMA2D_CR_TCIE|DMA2D_CR_TEIE,ENABLE); 

LCD_STATUS=LCD_IN_PROGRESS; 

DMA2D_StartTransfer();

}//

//

//

//

R2M mode 

void LCD_Clear(uint16_t Color)

{

  DMA2D_InitTypeDef dma2d ;

NVIC_InitTypeDef NVIC_DMA2D ;

DMA2D_DeInit(); 

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2D,ENABLE);  

dma2d.DMA2D_CMode=DMA2D_RGB565; 

dma2d.DMA2D_Mode=DMA2D_R2M ;

dma2d.DMA2D_NumberOfLine=272;

dma2d.DMA2D_PixelPerLine=480; 

dma2d.DMA2D_OutputBlue=(uint32_t)((Color&0x001F)<<3); 

dma2d.DMA2D_OutputGreen=(uint32_t)((Color&0x07E0)>>3);

  dma2d.DMA2D_OutputRed=(uint32_t)((Color&0xF800)>>8);

dma2d.DMA2D_OutputAlpha=0xFF; 

  dma2d.DMA2D_OutputMemoryAdd=LCD_FRAME_BUFFER; 

dma2d.DMA2D_OutputOffset= 0;

// 

DMA2D_Init(&dma2d); 

NVIC_DMA2D.NVIC_IRQChannel=DMA2D_IRQn; 

NVIC_DMA2D.NVIC_IRQChannelCmd=ENABLE; 

NVIC_DMA2D.NVIC_IRQChannelPreemptionPriority=1; 

NVIC_DMA2D.NVIC_IRQChannelSubPriority=0;

NVIC_Init(&NVIC_DMA2D);

//

DMA2D_ITConfig(DMA2D_CR_CEIE|DMA2D_CR_TCIE|DMA2D_CR_TEIE,ENABLE); 

LCD_STATUS=LCD_IN_PROGRESS; 

DMA2D_StartTransfer();

}

//

//

This is really crazy , I would appreciate any help , Thx in advance . 
0 REPLIES 0