2012-05-15 08:40 AM
Hi all,
I'm trying to add an LCD screen to my discovery. I have bought one from ITEASTUDIO (http://iteadstudio.com/store/index.php?main_page=product_info&cPath=18&products_id=538) I'm modifing the stm324xg_eval_lcd.c but I have a doubt!! In the function LCD_CtrlLinesConfig in the SRAM Address lines configuration it uses the PF0 pin as address pin (and from EVAL user manual FSMC_A0) but in my discovery I don't have any FSMC_A0!!! Only, FSMC_A16, etc... Can I use this pin (FSMC_A16) as my FSMC_A0 address or is it a problem to drive the TFT_RS pin of my lcd?? thanks! C #lcd-stm32f4discovery2012-05-15 08:52 AM
Hi,
Yes you can use the FSMC_A16 instead of FSMC_A0. You only need to change the LCD_BASE. If you are using NE3 - Bank 3 of NOR/SRAM, you should change to this value: #define LCD_BASE ((uint32_t)(0x60000000 | 0x08000000 | 0x00000001<<16)). Best regards, A.Paiva2012-05-15 11:40 AM
Hi,
I don't tryed to connect a TFT module to STM32F4-discovery, but I think it is needed to make some little modification:
To WRITE
- Remove R50 to disconnect LED8 and related driver from FMSC_NWE - Remove R41 R42 (Led RED Led BLUE) to free FSMC_D0 and FMSC_D1 pinTo READ (TFT Chip Device ID etc)
- Remove connession between PD4 and R43/Pin 32 Audio DAC (Reset pin) to free FSMC_NOE pin Regerds, Alessandro.2012-05-16 03:46 AM
Thanks for the replay!
Can you explain how do you obtained LCD_BASE address? 0x60000000 is the base for bank #1 in FSMC? and the other two what are they? thanks in advance C42012-05-16 06:35 AM
I can partially respond to my self.
LCD_BASE ((uint32_t)(0x60000000 | 0x08000000 | 0x00000001<<16)) 0x60000000 base FSMC - BANK1 0x08000000 base NOR/SRAM bank3 but 0x00000001<<16 select the base address for the Data address FSMC_A16? if I'd like to use FSMC_A6 , I have to shift 0x00000001<<6? thanks again C42012-05-16 05:28 PM
I merely wrote my own code for driving an external LCD via 6 outputs(4-bit for data, 1 for E, 1 for RS). I'm not sure if you are merely trying to make your external LCD just like the one that would have been attached to other ST eval boards, or if you are merely trying to drive an external LCD from your STM32F4-Discovery. But, I wouldn't mind helping you out, if you are merely wanting to drive an external LCD via your STM32F4-Discovery. I have attached a picture I just took tonight of it in operation. I could also attach my code if that would be helpful. Either way, just wanting to help out :). Have a good one!
PS - To view the attachment, click on ''View Properties/Attachments'' in the upper-right of my post. ________________ Attachments : tyai.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzrQ&d=%2Fa%2F0X0000000bQS%2F2GCIOWS2dPxZXpotaLGlvPmNt8qheMJYfPoeuqjxuJ0&asPdf=false2012-05-17 03:20 AM
Thanks 69.ninja, I think could help to send me your code.... Can you tell me also witch LCD are you using?
I'm tryng messing around but the lcd still doesn't working... I'll send some piece of code I have changed starting from stm32f4xx_it.c #define LCD_BASE ((uint32_t)(0x60000000 | 0x00000000)) //BANK1Change the FSMC bank to bank1 to use NE1 void LCD_CtrlLinesConfig(void) { GPIO_InitTypeDef GPIO_InitStructure; /* Enable GPIOD, GPIOE, GPIOF, GPIOG and AFIO clocks */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOG | RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOF, ENABLE); /*-- GPIO Configuration ------------------------------------------------------*/ /* SRAM Data lines, NOE and NWE configuration */ //PORTD ----------------------------------------------------->select my data port e ne1 e NWE GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_14 | GPIO_Pin_15 | GPIO_Pin_7 | GPIO_Pin_4 |GPIO_Pin_5;; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOD, &GPIO_InitStructure); GPIO_PinAFConfig(GPIOD, GPIO_PinSource0, GPIO_AF_FSMC); GPIO_PinAFConfig(GPIOD, GPIO_PinSource1, GPIO_AF_FSMC); GPIO_PinAFConfig(GPIOD, GPIO_PinSource4, GPIO_AF_FSMC); GPIO_PinAFConfig(GPIOD, GPIO_PinSource5, GPIO_AF_FSMC); GPIO_PinAFConfig(GPIOD, GPIO_PinSource7, GPIO_AF_FSMC); GPIO_PinAFConfig(GPIOD, GPIO_PinSource14, GPIO_AF_FSMC); GPIO_PinAFConfig(GPIOD, GPIO_PinSource15, GPIO_AF_FSMC); //PORTE GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10; GPIO_Init(GPIOE, &GPIO_InitStructure); GPIO_PinAFConfig(GPIOE, GPIO_PinSource7 , GPIO_AF_FSMC); GPIO_PinAFConfig(GPIOE, GPIO_PinSource8 , GPIO_AF_FSMC); GPIO_PinAFConfig(GPIOE, GPIO_PinSource9 , GPIO_AF_FSMC); GPIO_PinAFConfig(GPIOE, GPIO_PinSource10 , GPIO_AF_FSMC); /* SRAM Address lines configuration */ //A16! GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11; GPIO_Init(GPIOD, &GPIO_InitStructure); GPIO_PinAFConfig(GPIOD, GPIO_PinSource11, GPIO_AF_FSMC); void LCD_FSMCConfig(void) { FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure; FSMC_NORSRAMTimingInitTypeDef p; /* Enable FSMC clock */ RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE); /*-- FSMC Configuration ------------------------------------------------------*/ /*----------------------- SRAM Bank 1 ----------------------------------------*/ //seleziono bank1 per avere NE1 /* FSMC_Bank1_NORSRAM1 configuration */ p.FSMC_AddressSetupTime = 5; p.FSMC_AddressHoldTime = 0; p.FSMC_DataSetupTime = 9; p.FSMC_BusTurnAroundDuration = 0; p.FSMC_CLKDivision = 0; p.FSMC_DataLatency = 0; p.FSMC_AccessMode = FSMC_AccessMode_A; /* Color LCD configuration ------------------------------------ LCD configured as follow: - Data/Address MUX = Disable - Memory Type = SRAM - Data Width = 16bit - Write Operation = Enable - Extended Mode = Enable - Asynchronous Wait = Disable */ FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM1; //BANK1 FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM; FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_8b; //8Bit FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable; FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); /* Enable FSMC NOR/SRAM Bank1 */ FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE):changed FSMC BANK1 If the code is right, maybe the clock freqyency is wrong and the timing of LCD is wrong...2012-05-17 03:22 AM
Then my main.c is
STM324xG_LCD_Init(); LCD_Clear(Red); LCD_SetBackColor(Blue);2012-05-17 06:51 AM
still no working.... I'have tryied to change FSMC parameters multiply them by 9 (HCLK = 72 in eval, 8 in Discovery ->72/8=9)
but nothing change!! I can see the led blu e red do an on/off cycle at reset meaning that something is happning!! HELP!!2012-05-17 02:27 PM
Some hint for you. ( I hope it is usefull )
In the LCD Init have you set properly the write offset to switch between CMD / DATA according the address line that you use for RS pin? If you stop the execution after reset pulse, you can read into FMSC base address the ID-code of your LCD chip ?