cancel
Showing results for 
Search instead for 
Did you mean: 

SPI communication with 3 wire display

Danny0007
Senior

Hi community,

I have a display, which has only CLK, DI and CS pin for SPI communication. It uses TI protocol.

The original driver is only working with raspberry pi, I try to import it into my custom STM32 MCU board, the CLK and CS signals seem okay,  Only the MOSI signal is always low. it seems no data is really sent to the display. 

here is the signal capture from logic analyzer. 

The whole write sequence: 

Danny0007_1-1708464524960.png

zoom in, single byte write:

Danny0007_2-1708464622941.png

what could be the reason? Thanks in advance.

 

 

32 REPLIES 32
Danny0007
Senior

Hi @tjaekel @Tesla DeLorean ,

thanks again for your reply, very appreciate it. 

  1. the slave part is a display, CS is high activ, pretty sure.

         the master part is BlueNRG-LP, these 3pins are used as SPI2 and PA6 is MOSI.

Danny0007_1-1708636036994.png

 2. without display, all these 3 pins are able to be toggled. 

 sorry for the confusion, I did something wrong. Now the question is only it´s not working properly in SPI mode.

 

 


@Danny0007 wrote:
  1. the slave part is a display, CS is high activ, pretty sure.

You need to be more than just "pretty sure" - do you not have a datasheet or specification which states this?

As the others have said, it would be extremely unusual - so it should be easy to find reference to it.

Do you have a part number?

Link to manufacturer's or seller's page for it?

Danny0007_0-1708638713301.png

 

Yes, so that "SCS" is active high! :flushed_face:

So you really should not be calling it "NSS":

AndrewNeil_0-1708640475668.png

The 'N' in "NSS" is literally there to indicate an active-low signal!

actually I do not understand the name NSS pin very well, for me I simply just need a normal CS pin.

"SS" = "Slave Select" - it's a synonym for "CS" = "Chip Select"

Again, the 'n' just indicates "negative logic" - ie, active-low

OK, I assume you use a SHARP LCD module, like this:
|LS013B7DH03_datasheet.pdf (sparkfun.com)

OK, it has an SCS signal (not an NCS or NSS signal, just to be "picky"). Yes, this is high active in this datasheet.
The call it "Chip Select Signal" but use SCS (maybe a typo and it should be CSS).

OK, you have checked:

  • PA6 is MOSI - OK
  • PA6 toggles (in GPIO mode or in SPI mode?)
    "2. without display, all these 3 pins are able to be toggled."
    What does it mean? You see MOSI toggling when you generate a SPI transaction? (w/o display connected)
  • Test, without display, if MOSI is there, generating SPI - without display.

If all this works, your external LCD display is causing the issue:

  • correct pins on LCD module used?
  • correct power for LCD display?
    I see in this SHARP datasheet: TYP. 3.0V, 3.3V is max. They mention also all signals with HI as 3.0V.
    Maybe, the LCD module behaves strange (e.g. shortens the SI input when exceeding the VDD, by just a little bit, e.g. you take it from MCU board and it is 3.3XV).
  • You can lower the VDD voltage for LCD module by placing a diode (e.g. Schottky type) in series in VDD wire (Schottky drops approx., 0.3V, otherwise 0.7V).
    BUT: you might drive all inputs on LCD module still with 3V3 levels but VDD is 3.0V - this would be out of the spec.!
    Use series resistors in signal wires, e.g. 33R...100R. When you have "ringing" on signals - maybe the display module does not like it (and causes a "CMOS latch-up").

BTW: please confirm:
Can you toggle PA6 as MOSI as a regular GPIO, when you drive/keep the SCS signal low (not selecting the module)?
Does it work?
Or: generate a SPI transaction but leave the SCS signal low (not selecting module). Do you see MOSI signal toggling?

If not - your LCD module causes the issue (and nothing you can do on MCU side).


@tjaekel wrote:

They call it "Chip Select Signal" but use SCS (maybe a typo and it should be CSS).


Or maybe whoever wrote it was French ... ?

:thinking_face:

(see also: "UTC"...)

Hi @tjaekel 

I just tested the PA6(MOSI) again, it can be toggled both as GPIO and as SPI MOSI, with and without Display.

So the pin works in terms of hardware no problem. 

regardless of the complex display data format, now I just try to write some simple data on SPI like this:

  uint8_t data[5] = {0x11,0x22,0x33,0x44,0x55};
  BSP_SPI2_Init();
  LL_mDelay(10);
  while(1){
    BSP_SPI2_Write(data, 5);
    LL_mDelay(1);
  }

 even without display:

Danny0007_0-1708720934682.png

the CS pin during the write cycle unexpect goes down and it causes wrong transformation.

 

 

the IEEE should unify this, even the TI and Motorala mode... it will be much easier for us as developer:grinning_face: