SPI communication with 3 wire display
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-20 1:36 PM
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:
zoom in, single byte write:
what could be the reason? Thanks in advance.
Solved! Go to Solution.
- Labels:
-
SPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-22 1:32 PM - edited ‎2024-02-22 2:15 PM
Hi @tjaekel @Tesla DeLorean ,
thanks again for your reply, very appreciate it.
- 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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-22 1:44 PM - edited ‎2024-02-22 1:47 PM
@Danny0007 wrote:
- 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?
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-22 1:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-22 2:22 PM
Yes, so that "SCS" is active high! :flushed_face:
So you really should not be calling it "NSS":
The 'N' in "NSS" is literally there to indicate an active-low signal!
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-22 2:31 PM
actually I do not understand the name NSS pin very well, for me I simply just need a normal CS pin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-22 2:41 PM
"SS" = "Slave Select" - it's a synonym for "CS" = "Chip Select"
Again, the 'n' just indicates "negative logic" - ie, active-low
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-22 4:40 PM
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-22 5:08 PM
@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"...)
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-23 12:45 PM
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:
the CS pin during the write cycle unexpect goes down and it causes wrong transformation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-23 12:49 PM
the IEEE should unify this, even the TI and Motorala mode... it will be much easier for us as developer:grinning_face:
