LCD Driver - OLD

mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

LCD Driver - OLD

Post by mobyfab »

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: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: PAL HAL

Post by Giovanni »

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: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: PAL HAL

Post by mobyfab »

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: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: PAL HAL

Post by Giovanni »

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

Giovanni
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: PAL HAL

Post by mobyfab »

It's alive :)

Image

I will look into it, thanks.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: PAL HAL

Post by Giovanni »

Nice, now details :-)

Giovanni
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: PAL HAL

Post by mobyfab »

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: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: PAL HAL

Post by mobyfab »

mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: PAL HAL

Post by mobyfab »

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: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: LCD Driver

Post by mobyfab »

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.
Locked