cancel
Showing results for 
Search instead for 
Did you mean: 

My LCD works ok on SPI2 Discovery F407, the same LCD does not work on SPI1 on a F405 custom pcb

TombrownBottom
Associate III

So as the subject says, my LCD works correctly when attached to my F407 Discovery board and using SPI2.

I am now using a F405 and SPI1 on a custom PCB. I have configured the SPI1 the same as SPI2, basically copied the settings.

However I need some advice on the clock speeds and settings. When I use the LCD on the discovery board it will run at low speeds - 10MHz.

For SPI1 ton the F405, the maximum speed is lower at 42MHz. Which clocks do I need to set and what speeds do I need for each clock?

Using an oscilloscope reveals that I am gettting signals from the MCU on all the relevent pins. My guess is a timing issue of some sort......

I know that the MCU is functioning correctly, flashing programs and debug work as normal.

Any suggestions or help much appreciated. Thanks in advance

15 REPLIES 15

I have set HCLK to 5MHz. Now all clocks are running at 5MHz. This has not delivered the result we were looking for.

As an aside I take it that the clocks that are used for SPI1 are:

1) HCLK to AHB bus core memory and DMA

2) APB1 peripheral clocks

3) APB1 Timer Clocks

These all need to be running at the same speed?

The AHB clock can be that of the MCU, and high

The SPI clock on the SPI bus (the wires) is going to be a fraction of the APB bus clock, the prescaler makes it at least half the speed right off the bat.

If nothing is working properly is more likely to be a wiring/power issue than a SPI1/SPI2  APB2/APB1 related issue.

The speed on-the-wire being 5-6 MHz should be viable. Look elsewhere.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I have checked all the connections to the LCD for signals. They are all present.

Power and GND is ok. The wiring proves ok. If I decouple the LCD from the custom board and hook it up to the Discovery board the LCD works right off the bat.

Maybe it's time to look at all the signals at once (and directly at the display) using logic analyzer, and compare the waveforms with the working case and/or display's controller's datasheet.

At the end of the day, you can also bit-bang the interface, and such software should be easily transferrable from the Disco to your hardware.

And you don't need to be focused solely on the SPI-related software. Things like ground/signal-return arrangement (i.e. separate return for each signal, signal wires mutually isolated by the ground/returns, short cables); power supply stability and sequencing; reset - these all matter, too.

JW

A good suggestion. I will have a go at this tomorrow. Thanks

So after some use of the oscilloscope I could see that the SPI clock and MOSI were writing the correct byte values for initilisation of the LCD. When it came to writing a buffer I noticed that my DC pin was not going high. When I reviewed the code I could see that the wrong port was specified. I changed it to the correct port and bingo, we are working!

Learning for me:

1) Never assume that a library you found off the net is coded properly.

2) Always look at the obvious things first.

3) Dont come on here wasting time before checking all the above.

All said and done this little saga will no doubt be of use in terms of learning for somone else, hopefully!