/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / LCD driver

Username:     
Password:     
             

Forum

# 1   2009-01-26 23:39:54 LCD driver

Kram
Member
Registered: 2008-01-22
Posts: 24

LCD driver

Hello,

I have been looking at the lcd driver, trying to get it to work outside of circleOS. Mostly I have copyed the lcd.c and lcd.h files.

Im really just trying to learn how to set up the hardware, so stuff like the backlight - which is on by default, display rotation etc.. I have commented out for now.
I am very new to arm coding, though I have used c before, I forget everything I learnt.


I have got it to compile, and it runs. Im calling LCD_Init then LCD_DisplayChar to test if it works, but the screen stays off :(


This is how I think the lcd is setup from circle, I think maybe I have missed something important:

main()   Main.c ->
DRAW_Init() Draw.c ->

LCD_Init() LCD.c

Code:

        GPIO_InitTypeDef GPIO_InitStructure;

        /* Enable GPIO clock for LCD */
 //       RCC_APB2PeriphClockCmd( GPIO_LCD_CTRL_PERIPH, ENABLE );
 //       RCC_APB2PeriphClockCmd( GPIO_LCD_D_PERIPH, ENABLE );
 //       RCC_APB2PeriphClockCmd( GPIO_LCD_CS_PERIPH, ENABLE );
       RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOC, ENABLE );
       RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOC, ENABLE );
       RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOD, ENABLE );

it would not use the definition from lcd.h so I copyed it here, though I dont understand what it does or why the clock is enabled on the same pin twice?, and then again below?!?!?

Code:

/* Enable GPIOC clock */
        RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOC, ENABLE );

        /* Init BackLight*/
      //  LCD_BackLightConfig();

        /* LCD Init */
#ifdef PRIMER1
        /* Configure control lines signals as output mode */
        LCD_CtrlLinesConfig();
        /* 7637 init */
        LCD_7637_Controller();



LCD_DataLinesConfig is called by LCD_7637_Controller()

Thanks

Last edited by Kram (2009-01-26 23:40:32)

Offline

 

# 2   2009-01-27 08:36:35 LCD driver

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: LCD driver

I assume you are working with a PRIMER1 (ST7637 controller) .
The backlight is tuned by a PWM. You need to configure the pin and the timer.
LCD_Init is the main function.
It could be that the clock that we initiliaze (useless, to be fixed) several times the clock for a port. It's the risk when we use macros for each pin without the naming of the port.

Offline

 

# 3   2009-01-28 00:21:06 LCD driver

Kram
Member
Registered: 2008-01-22
Posts: 24

Re: LCD driver

http://jellard.pwp.blueyonder.co.uk/arm/lcdinit.jpg

working smile

I found that my #define PRIMER1 line did not work, for some reson? so I took out the #ifdef statements (and primer2 code) .
Next I found that the toggle example which I was using for a template, the st firmware lib had the unused GPIOs (GPIOC) commented out = disabled.

Offline

 

# 4   2009-01-28 07:45:58 LCD driver

zwieblum
Member
Registered: 2008-12-19
Posts: 68

Re: LCD driver

can you post the code as an example?

Offline

 

# 5   2009-01-28 23:08:51 LCD driver

Kram
Member
Registered: 2008-01-22
Posts: 24

Offline

 

# 6   2009-01-29 21:05:00 LCD driver

zwieblum
Member
Registered: 2008-12-19
Posts: 68

Re: LCD driver

thank you!

Offline

 

# 7   2009-01-30 14:18:21 LCD driver

domen
Member
Registered: 2008-10-27
Posts: 10

Re: LCD driver

primer1 related:

Just a note, in case anyone will be optimising the driver for speed.
Functions like LCD_SendLCDData rely on fact that calls to GPIO functions take some time. When I optimised them, I had to insert some delays (<1us, LCD controller datasheet specifies exact timings) to make it work.

Offline

 

Board footer