cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F2 with RGB lcd interface

np1
Associate II
Posted on August 30, 2016 at 06:22

Dear all,

I am doing project with STM32F2 and RGB 18 bit lcd, via FSMC. But I do not know how to setup it.

And could to tell me where I can download example code of STEVAL-CCM004V2 with STM3220G-EVAL?

Best regards

Thinh
5 REPLIES 5
slimen
Senior
Posted on August 30, 2016 at 12:00

Hi,

You should look at FSMC examples which describes how to configure the FSMC controller to access the SRAM memory, within

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef2.html

firmware package, from this path: STM32Cube_FW_F2_V1.4.0\Projects\STM322xG_EVAL\Examples\FSMC

Take a look at the

http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-eval-boards/stm3220g-eval.html

page, and the 

http://www.st.com/content/ccc/resource/technical/document/reference_manual/51/f7/f3/06/cd/b6/46/ec/CD00225773.pdf/files/CD00225773.pdf/jcr:content/translations/en.CD00225773.pdf

 (section: 31 Flexible static memory controller (FSMC)) 

Regards

np1
Associate II
Posted on August 31, 2016 at 08:42

Thanks for help.

I already set up FSMC already, but I still can not understand how to control VSYNC, HSYNC and DOTCLK signals of  ILI9341 lcd. What should I do?

Regards

Walid FTITI_O
Senior II
Posted on August 31, 2016 at 17:14

Hi nguyen_phu.thinh.001,

I recommend you to have a look to the application note

http://www.st.com/content/ccc/resource/technical/document/application_note/85/ad/ef/0f/a3/a6/49/9a/CD00201pdf/files/CD00201pdf/jcr:content/translations/en.CD00201pdf

which describes how to interfaces theILI9341 lcd through FSMC.

Also, make a search in Forum you will find several threads on the topic that helps you. I pich one for you similar to your requirement :

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F2%20FSMC%20ILI9341&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=279

-Hannibal-

np1
Associate II
Posted on September 07, 2016 at 11:54

Hi,

Now I already can set up lcd, can send some setting cmd......

I base on example from ST, it build for stm32f103z..... But it using DMA for FSMC, and look DMA of stm32F1 and F2 alot different.

Could you tell me how to change DMA from F1 to F2, for current code is:

/**

* @brief  LCD_DriverDMAConfig

*         DMA channels configuration to send data to FSMC TFT-LCD.

* @param  None

* @retval None

*/

static void LCD_DriverDMAConfig(void)

{

  /* Configure clock for DMA Controller */

  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1,ENABLE);

  

  /* Deintialize DMA Channels */

  DMA_DeInit(DMA1_Channel1);   

  DMA_DeInit(DMA1_Channel2);

  DMA_DeInit(DMA1_Channel3);     

   

  /* DMA1 Channel1 Configuration for line front porch */

  DMA1_Channel1->CCR &=((uint32_t)0xFFFFFFFE); 

  DMA1_Channel1->CCR &= ((uint32_t)0xFFFF800F);

  DMA1_Channel1->CCR |= DMA_DIR_PeripheralSRC| DMA_Mode_Normal |

                        DMA_PeripheralInc_Disable | DMA_MemoryInc_Disable |

                        DMA_PeripheralDataSize_HalfWord | DMA_MemoryDataSize_HalfWord |

                        DMA_Priority_High | DMA_M2M_Enable;

  DMA1_Channel1->CNDTR = LCD_LINE_FRONT_PORCH;

  DMA1_Channel1->CPAR  = (uint32_t)DummyDisplayBuffer; 

  DMA1_Channel1->CMAR  = (uint32_t)(LCD_BASE);      

  

  

  /* DMA1 Channel2 Configuration for valid line data */

  DMA1_Channel2->CCR &=((uint32_t)0xFFFFFFFE); 

  DMA1_Channel2->CCR &= ((uint32_t)0xFFFF800F);

  DMA1_Channel2->CCR |= DMA_DIR_PeripheralSRC| DMA_Mode_Normal |

                        DMA_PeripheralInc_Enable | DMA_MemoryInc_Disable |

                        DMA_PeripheralDataSize_HalfWord | DMA_MemoryDataSize_HalfWord |

                        DMA_Priority_High | DMA_M2M_Enable;

  DMA1_Channel2->CNDTR = LCD_HORZ_LINE;

  DMA1_Channel2->CPAR  = (uint32_t)DummyDisplayBuffer; 

  DMA1_Channel2->CMAR  = (uint32_t)(LCD_BASE);      

  

  /*DMA1 Channel3 Configuration for back porch data*/

  DMA1_Channel3->CCR &=((uint32_t)0xFFFFFFFE); 

  DMA1_Channel3->CCR &= ((uint32_t)0xFFFF800F);

  DMA1_Channel3->CCR |= DMA_DIR_PeripheralSRC| DMA_Mode_Normal |

                        DMA_PeripheralInc_Disable | DMA_MemoryInc_Disable |

                        DMA_PeripheralDataSize_HalfWord | DMA_MemoryDataSize_HalfWord |

                        DMA_Priority_High | DMA_M2M_Enable;

  DMA1_Channel3->CNDTR = LCD_LINE_BACK_PORCH;

  DMA1_Channel3->CPAR  = (uint32_t)DummyDisplayBuffer; 

  DMA1_Channel3->CMAR  = (uint32_t)(LCD_BASE);      

  

  /* Enable DMA Channel1 Transfer Complete interrupt */

   DMA1_Channel1->CCR |= DMA_IT_TC;

  /* Enable DMA Channel2 Transfer Complete interrupt */

   DMA1_Channel2->CCR |= DMA_IT_TC;

  /* Enable DMA Channel3 Transfer Complete interrupt */

   DMA1_Channel3->CCR |= DMA_IT_TC;

}

/**

* @brief  LCD_DriverInterruptConfig

*         Configures the used IRQ Channels for TFT-LCD driver

* @param  None

* @retval None

*/

static void LCD_DriverInterruptConfig(void)

   /* Configure the Priority Group to 2 bits */

  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_3); 

  

  /* Enable the DMA1 channel1 Interrupt */

  NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel1_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);

  

  /* Enable DMA1 channel2 IRQ Channel */

  NVIC_InitStructure.NVIC_IRQChannel =  DMA1_Channel2_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);

  

  /* Enable DMA1 channel3 IRQ Channel */

  NVIC_InitStructure.NVIC_IRQChannel =  DMA1_Channel3_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);

  

  /* Enable the Frame Rate Control, TIM3 global Interrupt */

  NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;

  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;  

  NVIC_Init(&NVIC_InitStructure);

  

  /* Enable the SlideShow , TIM2 global Interrupt */

  NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;

  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 3;

  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;  

  NVIC_Init(&NVIC_InitStructure);

  

  /* Clear TIM2 update  interrupt pending bit */

  TIM_ClearITPendingBit(TIM2, TIM_IT_Update);

  

  /* Clear TIM3 update interrupt pending bit  */

  TIM_ClearITPendingBit(TIM3, TIM_IT_Update);

  

}

Does DMA1_Channel1 of F1 is DMA1_Stream0 of F2.....?

Regards

Thinh

np1
Associate II
Posted on September 16, 2016 at 09:42

Hi all,

Now I already success interface with TFT lcd via 16 bit RGB, ili9341, and fill sceen with single color and bitmap.

But, as me know, with RGB interface we must sceen lcd all time (60Hz...), so how I only just keep bitmap in sceen? and how I fill sceen with color and just draw part of bitmap(as any icon) together the background?

Thanks and regards