cancel
Showing results for 
Search instead for 
Did you mean: 

Help with STM32VL_Discovery and a TFT display

jonathanurbina92
Associate II
Posted on August 23, 2012 at 21:43

The original post was too long to process during our migration. Please click on the attachment to read the original post.
13 REPLIES 13
Posted on August 23, 2012 at 21:55

You'll need to start by initializing the GPIO pins.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jonathanurbina92
Associate II
Posted on August 23, 2012 at 23:26

oh sure...

GPIO_InitTypeDef GPIO_InitStructure;

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOC, ENABLE);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15; // Initialization of Data pins

    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;

    GPIO_Init(GPIOB, &GPIO_InitStructure);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7;

    GPIO_Init(GPIOC, &GPIO_InitStructure);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12;

    GPIO_Init(GPIOC, &GPIO_InitStructure);

    GPIO_InitStructure.GPIO_Pin =GPIO_Pin_13;

    GPIO_Init(GPIOC, &GPIO_InitStructure);

when i debug the display screen is white =(

serggorsky
Associate II
Posted on September 08, 2012 at 23:00

You'd better use FSMC rather than GPIO for LCD interfacing.

It is much faster and easy to program.

If you need, I can share the initialization and simple graphics code and pinout for STM32F4Discovery + SSD1963.

It should be easily adaptable for your board.

Posted on September 09, 2012 at 00:01

You'd better use FSMC rather than GPIO for LCD interfacing. It is much faster and easy to program. If you need, I can share the initialization and simple graphics code and pinout for STM32F4Discovery + SSD1963. It should be easily adaptable for your board.

 

While this may be the case, the STM32 VL-Discovery board uses a STM32F100 series part, which as I recall does not support FSMC

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
frankmeyer9
Associate II
Posted on September 09, 2012 at 12:46

If you want to understand (and modify) this could, you might need to understand the LCD controller. I suggest to download the datasheet of the SSD1963, and use it for understanding the code.

First check which kind of interface your hardware uses.

From the code, it looks like 6800 bus interface in 8 bit mode.

Using this hardware interface, the controller is parametrized using a register based interface. This is described in more detail in the datasheet of the LCD controller.

Albeit the initialization and certain access/graphics routines already exist, it won't do any harm trying to comprehend this.

jonathanurbina92
Associate II
Posted on September 12, 2012 at 22:17

i've never programmed a microcontroller and i need to do this =( i have the routines and the ''initialization code'' but doesn't work. can anybody help me? can anybody give me the code? i will be so happy if i can do a circle in the screen.

i'm using the stm32 value line discovery board :(
Posted on September 13, 2012 at 03:14

You need to provide details of how this controller is wired, and how constants are defined. You should provide enough code that the example is free standing and can be compiled by others. Assume others know absolutely nothing about your hardware and configuration beyond the data you have conveyed in your post.

I'm not sure what bits represent the data register, and if it is high order bits PB.[8..15] you have the fact that SSD1963_DATAPORT->ODR writes low order bits, and trashes high order ones.

That the sequence CS=0 WR=0 CS=1 WR=1 should be CS=0 WR=0 WR=1 CS=1
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
serggorsky
Associate II
Posted on September 13, 2012 at 04:12

clive1> While this may be the case, the STM32 VL-Discovery board uses a STM32F100 series part, which as I recall does not support FSMC

No fsmc.. Oh, sorry then.

Anyway, there are some checkpoints:

1) does writing to registers work? Even if your initialization code is wrong, you should see the display changing while sending commands to it. (insert delays between initialization commands and watch the display.

2) is your initialization code right? You should carefully check it step-by-step with both SSD1963 and the TFT panel datasheet. The code for similar controllers/tft will not work.

If your screen is white, either your code is right (1+2+) or you didn't sent even a single command (1-).

BTW, your SSD1963_WriteCommand/WriteData code seems to be wrong (you have the 1st case ;)

First, the data should be 16 bit. 'int' is 32 bits.

Second, the SSD1963_DATAPORT->ODR  =  ... probably should be in the place of asm('nop')

Third, afaik you should set the CS to high to write data, then pulse the WR pin (set it high then low) write the data and reset CS to low. Are you sure you are doing this?

Forth, some pin (LCD_RD_PIN ? ) should be set low for a command and high for data, but your WriteCommand/WriteData are identical.

and.. where do you call SSD1963_Init() from ?

PS: It may be difficult to set up a tft display for the first time, but once you get a point, it is very simple.

frankmeyer9
Associate II
Posted on September 13, 2012 at 09:52

> No fsmc.. Oh, sorry then.

Of couse, no. But apart from being painfully slow, the bit-banging method has the great advantage of being to debug. With single-stepping, you just need a voltmeter.

First of all, you might need to supply the VL_Discovery + TFT display with an external power supply. I had a similiar project with a F4 discovery, which overstressed the USB port.

It behaved rather strange, until I supplied power externally.

Then, check the IM0..IMx pins of the TFT. These pins define the bus interface. There are usually 2..4 of those pins, depending on the number of bus modes supported. And then check that the wiring of your setup does match the selected bus mode.

Once you checked everthing is correct, and you have a working (compilable) project, you can examine if your read-command and write-command code provides the right signal/ transition sequences to the correct pins. As said, with single-stepping, a voltmeter is sufficient. I usually do this twice. The first time without TFT, at the GPIOs. The second time I attach the TFT, and measure at the TFT pins.

Once this all passed, I suggest to test the communication.

This TFT driver chips usually have an ID register at register offset 0. Reading from this address should return the value as given in the driver's datasheet.

However, a study of the SSD1963 datasheet and the schematics is mandatory.