Page 1 of 6

LCD Driver - OLD

Posted: Sat Dec 24, 2011 6:46 pm
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. :(

Re: PAL HAL

Posted: Sat Dec 24, 2011 8:27 pm
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

Re: PAL HAL

Posted: Mon Dec 26, 2011 1:28 pm
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.

Re: PAL HAL

Posted: Mon Dec 26, 2011 3:07 pm
by Giovanni
You could use the GPT driver for small delays, it has a specific function.

Giovanni

Re: PAL HAL

Posted: Mon Dec 26, 2011 3:38 pm
by mobyfab
It's alive :)

Image

I will look into it, thanks.

Re: PAL HAL

Posted: Mon Dec 26, 2011 4:48 pm
by Giovanni
Nice, now details :-)

Giovanni

Re: PAL HAL

Posted: Mon Dec 26, 2011 5:00 pm
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:

Re: PAL HAL

Posted: Mon Dec 26, 2011 7:45 pm
by mobyfab

Re: PAL HAL

Posted: Wed Dec 28, 2011 1:57 pm
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.

Re: LCD Driver

Posted: Wed Jan 04, 2012 11:43 am
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?