nimaltd Posted March 4, 2017 Report Share Posted March 4, 2017 (edited) I use stm32f103VE in FSMC 8bit. my lcd is ili9481 in 8 bit interface. how can config my lcd ? i cant drive it . its not work. #define GDISP_REG ((volatile uint16_t *) 0x60000000)[0] /* RS = 0 */ #define GDISP_RAM ((volatile uint16_t *) 0x60FF0000)[0] /* RS = 1 */ static GFXINLINE void init_board(GDisplay *g) { (void) g; HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_2); } static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { (void) g; HAL_GPIO_WritePin(LCD_RST_GPIO_Port,LCD_RST_Pin,(GPIO_PinState) !state); } static GFXINLINE void set_backlight(GDisplay *g, uint8_t percent) { (void) g; if(percent > 99) percent = 99; htim2.Instance->CCR2 = percent; } static GFXINLINE void acquire_bus(GDisplay *g) { (void) g; } static GFXINLINE void release_bus(GDisplay *g) { (void) g; } static GFXINLINE void write_index(GDisplay *g, uint16_t index) { (void) g; GDISP_REG = index&0x00ff; } static GFXINLINE void write_data(GDisplay *g, uint16_t data) { (void) g; GDISP_RAM = (data>>8); GDISP_RAM = data&0x00ff; } static GFXINLINE void setreadmode(GDisplay *g) { (void) g; } static GFXINLINE void setwritemode(GDisplay *g) { (void) g; } static GFXINLINE uint16_t read_data(GDisplay *g) { (void) g; uint16_t data; data = (GDISP_RAM<<8); data |= GDISP_RAM; return data; } Edited March 4, 2017 by nimaltd Link to comment Share on other sites More sharing options...
nimaltd Posted March 4, 2017 Author Report Share Posted March 4, 2017 and please tell me about FSMC initlizing on cubemx Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted March 4, 2017 Report Share Posted March 4, 2017 The ILI9481 display controller has a set of pins that control which interface is used. These are called IM0 and IM1 if I remember correctly. You have to set them correctly to select the 8-bit parallel interface. Link to comment Share on other sites More sharing options...
nimaltd Posted March 5, 2017 Author Report Share Posted March 5, 2017 its true. I use lcd module. its work fine with example. i drive now. but have a problem. my color is wrong.my display size is wrong. this is my calibration window. i change initlize register. but no diftrent. Link to comment Share on other sites More sharing options...
nimaltd Posted March 5, 2017 Author Report Share Posted March 5, 2017 FSMC_NORSRAM_TimingTypeDef Timing; /** Perform the SRAM1 memory initialization sequence */ hsram1.Instance = FSMC_NORSRAM_DEVICE; hsram1.Extended = FSMC_NORSRAM_EXTENDED_DEVICE; /* hsram1.Init */ hsram1.Init.NSBank = FSMC_NORSRAM_BANK1; hsram1.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE; hsram1.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM; hsram1.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_16; <<<< not work in 8 bit.. I dont know why. hsram1.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE; hsram1.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW; hsram1.Init.WrapMode = FSMC_WRAP_MODE_DISABLE; hsram1.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS; hsram1.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE; hsram1.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE; hsram1.Init.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE; hsram1.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE; hsram1.Init.WriteBurst = FSMC_WRITE_BURST_DISABLE; /* Timing */ Timing.AddressSetupTime = 2; Timing.AddressHoldTime = 2; Timing.DataSetupTime = 5; Timing.BusTurnAroundDuration = 0; Timing.CLKDivision = 2; Timing.DataLatency = 2; Timing.AccessMode = FSMC_ACCESS_MODE_B; ///////////////////////////// LLDSPEC void gdisp_lld_write_color(GDisplay *g) { write_data(g, gdispColor2Native(g->p.color)>>8); write_data(g, gdispColor2Native(g->p.color)); } ///////////////////////////// static GFXINLINE void write_index(GDisplay *g, uint16_t index) { (void) g; GDISP_REG = index; } static GFXINLINE void write_data(GDisplay *g, uint16_t data) { (void) g; GDISP_RAM = data; } Link to comment Share on other sites More sharing options...
inmarket Posted March 5, 2017 Report Share Posted March 5, 2017 In gdisp_lld_write_color() try reversing the two lines that write data. I suspect you are writing them in the wrong order. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted March 5, 2017 Report Share Posted March 5, 2017 9 hours ago, nimaltd said: static GFXINLINE void write_index(GDisplay *g, uint16_t index) { (void) g; GDISP_REG = index; } static GFXINLINE void write_data(GDisplay *g, uint16_t data) { (void) g; GDISP_RAM = data; } You have to write (and read) two bytes here. Currently you're missing out on half of the data. 9 hours ago, nimaltd said: FSMC_NORSRAM_MEM_BUS_WIDTH_16 And yes, that is definitely wrong too if you want to use the 8-bit bus. Link to comment Share on other sites More sharing options...
nimaltd Posted March 6, 2017 Author Report Share Posted March 6, 2017 I try all of them. but my color is wrong . Link to comment Share on other sites More sharing options...
nimaltd Posted March 6, 2017 Author Report Share Posted March 6, 2017 #define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_BGR565 its work . Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now