Hello people,
I have also a simple GUI Library for my 2.4" LCD (S6D1121 controller) in 16-bit bitbang and also a wavePlayer working on my STM32F4 Discovery board.
Please see my forum post in the User Projects Section.
viewtopic.php?f=8&t=468&p=4184@indigos,
There is a difference between the STM32F1 GPIO (Tectu's code is for STM32F1) and STM32F2 or STM32F4 GPIO cells, code is not intercompatible between the two.
I have found out that it is always better to use HAL functions (or even STM32_StdPeriph_Library functions if you really want to use them, ChibiOS HAL is great) to init GPIOs than direct GPIO access unless time-critical application is required.
You could use:
For Output, Highest Speed (All PE(0-15) pins configured as output):
palSetGroupMode(GPIOE, 0xFFFF, 0, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
For Input: (with pull-ups enabled)
palSetGroupMode(GPIOE, 0xFFFF, 0, PAL_MODE_INPUT_PULLUP);
0xFFFF = all pins = can make your code more readable.
STM32F4 GPIOs are very high speed, so LCD may not take it up that fast.
I was getting a few 'dead pixels' in screen fills initially, and inserting NOPs in between toggling WR pin fixed the issue.
I have inserted two NOPs in between toggling WR pin, and I guess reading should take more than two NOPs (according to datasheet). Try Doing that... and see if it works.
To insert a NOP use:
or
Also in the STM32F4 discovery, some PE pins are connected to the MEMS sensor: Precisely PE0, PE1 and PE3.
So I use PD0-PD3 to DB0-DB3 and PE4-PE15 to DB4-DB15 on the LCD.
Check out my working code in repo
https://github.com/abhishek-kakkar/STM3 ... overy_demo in the CLCD_QVGA Sub directory.
(replace the init sequence with the proper one, set window address commands for the SSD1289 with proper index). And my lcd_read function isn't working right now, I'll have to fix it.
Feel free to ask any question regarding it.
Regards
Abhishek