LCD Driver - OLD

mobyfab
Posts: 483
Joined: Sat Nov 19, 2011 6:47 pm
Location: Le Mans, France
Has thanked: 21 times
Been thanked: 30 times

LCD Driver - OLD

Postby mobyfab » Sat Dec 24, 2011 6:46 pm

Hey,

I'm trying to convert this to the PAL library for a lcd controller library:

Code: Select all

SSD1963_DATAPORT->ODR  = commandToWrite;
SSD1963_CTRLPORT->BSRR = SSD1963_PIN_RD;
SSD1963_CTRLPORT->BRR  = SSD1963_PIN_A0 | SSD1963_PIN_CS | SSD1963_PIN_WR;
sleep(10);
SSD1963_CTRLPORT->BSRR = SSD1963_PIN_A0 | SSD1963_PIN_CS | SSD1963_PIN_WR;


I wrote this:

Code: Select all

   palSetPort(SSD1963_DATAPORT, commandToWrite);
   palClearPort(SSD1963_DATAPORT, SSD1963_PIN_RD);
   palSetPort(SSD1963_CTRLPORT, SSD1963_PIN_A0 | SSD1963_PIN_CS | SSD1963_PIN_WR);   
   chThdSleepMilliseconds(10);
   palClearPort(SSD1963_CTRLPORT, SSD1963_PIN_A0 | SSD1963_PIN_CS | SSD1963_PIN_WR);   


port init:

Code: Select all

   
palSetGroupMode(SSD1963_DATAPORT, 0xFFFF, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
palSetGroupMode(SSD1963_CTRLPORT, SSD1963_PIN_RD | SSD1963_PIN_WR | SSD1963_PIN_CS | SSD1963_PIN_A0 | SSD1963_PIN_RST, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
   


is this correct ? it does not seem to work. :(
Last edited by mobyfab on Wed Dec 28, 2011 2:20 pm, edited 1 time in total.

User avatar
Giovanni
Site Admin
Posts: 14458
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: PAL HAL

Postby Giovanni » Sat Dec 24, 2011 8:27 pm

Hi,

I think it is because you got it reversed:

SSD1963_CTRLPORT->BSRR = SSD1963_PIN_RD <- This sets the specified mask.

SSD1963_CTRLPORT->BRR = SSD1963_PIN_A0 | SSD1963_PIN_CS | SSD1963_PIN_WR <- This one clears the specified mask

Giovanni

mobyfab
Posts: 483
Joined: Sat Nov 19, 2011 6:47 pm
Location: Le Mans, France
Has thanked: 21 times
Been thanked: 30 times

Re: PAL HAL

Postby mobyfab » Mon Dec 26, 2011 1:28 pm

haha you were right, beginner mistake :)

here it is fixed:

Code: Select all

void SSD1963_WriteCommand(uint16_t commandToWrite)
{   
   palWritePort(SSD1963_CTRLPORT, SSD1963_PIN_RD | SSD1963_PIN_RST); // All pins low but READ and RST
   palWritePort(SSD1963_DATAPORT, commandToWrite);
   static uint16_t dly;
   for(dly = 0; dly < 50; dly++)
      asm("nop");
   palWritePort(SSD1963_CTRLPORT, SSD1963_PIN_RS | SSD1963_PIN_CS | SSD1963_PIN_WR | SSD1963_PIN_RST); // All pins up but READ and RST
}


Couldn't use the chthdsleep functions since they last way too long.
Also I'm using one writeport call since it's faster than a set then a clear.

User avatar
Giovanni
Site Admin
Posts: 14458
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: PAL HAL

Postby Giovanni » Mon Dec 26, 2011 3:07 pm

You could use the GPT driver for small delays, it has a specific function.

Giovanni

mobyfab
Posts: 483
Joined: Sat Nov 19, 2011 6:47 pm
Location: Le Mans, France
Has thanked: 21 times
Been thanked: 30 times

Re: PAL HAL

Postby mobyfab » Mon Dec 26, 2011 3:38 pm

It's alive :)

Image

I will look into it, thanks.

User avatar
Giovanni
Site Admin
Posts: 14458
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: PAL HAL

Postby Giovanni » Mon Dec 26, 2011 4:48 pm

Nice, now details :-)

Giovanni

mobyfab
Posts: 483
Joined: Sat Nov 19, 2011 6:47 pm
Location: Le Mans, France
Has thanked: 21 times
Been thanked: 30 times

Re: PAL HAL

Postby mobyfab » Mon Dec 26, 2011 5:00 pm

I will post the library as soon as I'm done.

Currently implementing a way to write strings to the LCD to replace the console.
It would be fun to display the test results on it. :mrgreen:

mobyfab
Posts: 483
Joined: Sat Nov 19, 2011 6:47 pm
Location: Le Mans, France
Has thanked: 21 times
Been thanked: 30 times

Re: PAL HAL

Postby mobyfab » Mon Dec 26, 2011 7:45 pm


mobyfab
Posts: 483
Joined: Sat Nov 19, 2011 6:47 pm
Location: Le Mans, France
Has thanked: 21 times
Been thanked: 30 times

Re: PAL HAL

Postby mobyfab » Wed Dec 28, 2011 1:57 pm

I'm currently facing an annoying problem: The onboard 3.3v regulator doesn't provide enough power to the module so that it can print full white... :lol:
Basically at some point the lcd controller crashes. (I'm using the STlink via USB as power source)

I need to get a power supply since mine is at my parent's place :(

Else I've just done the function to draw bitmaps :)
I'm converting bitmaps to RGB565 arrays using the tool provided by ST. (the GUI designer thing)

Image

for those wondering the refresh speed (MCU->controller) is about 53 FPS.

Edit: I think my LCD controller is busted... :(
I ordered a couple new SSD1963 ICs, will swap it as soon as I get them.

mobyfab
Posts: 483
Joined: Sat Nov 19, 2011 6:47 pm
Location: Le Mans, France
Has thanked: 21 times
Been thanked: 30 times

Re: LCD Driver

Postby mobyfab » Wed Jan 04, 2012 11:43 am

Just found that in the datasheet: (page 48)

PC13, PC14, PC15 and PI8 are supplied through the power switch. Since the switch only sinks a limited amount of current
(3 mA), the use of GPIOs PC13 to PC15 and PI8 in output mode is limited: the speed should not exceed 2 MHz with a
maximum load of 30 pF and these I/Os must not be used as a current source (e.g. to drive an LED).


I'm using port C to drive the data lines... at around 6Mhz :)

Hopefully that's the cause of my problems, I will find out pretty soon.
Anyways I have ordered 2 new ICs for other projects, so if this one's really busted I'll replace it.

Once I get it to work as intended, I'll start to use the FSMC which is much faster.

Giovanni, can you move this thread to the dev area?
Last edited by mobyfab on Wed Jan 04, 2012 12:09 pm, edited 1 time in total.


Return to “LCD Driver and Graphic Framework”

Who is online

Users browsing this forum: No registered users and 4 guests