Author Topic: C128128BZ-FSW-GBW and SPI 3-wire  (Read 2028 times)

LBMoelca

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
C128128BZ-FSW-GBW and SPI 3-wire
« on: October 14, 2015, 10:31:00 AM »
Good day,

we've purchased your C128128BZ-FSW-GBW display and we are trying to interface it with our SOM using the 3-wire SPI mode. We are facing some problems though.

The first thing we need to clarify is about a statement we found on your site (here):
Quote
SPI (3 wire) uses Serial Data Out, Serial Data In, and Serial Clock
SPI (4 wire) adds Chip Select
In the display datasheet is written that the only difference between 3 and 4 wire interface is the presence of the A0 pin, which is used to distinguish data bytes from command ones in 4-wire, without mentioning the CSB. We gave the datasheet priority, so we worked as if CSB was present in 3-wire mode, but since we can't make it work, we were wondering if that sentence may have some relevance to our case. Can you clarify on this?
Anyway, we tried implementing the 4-wire communication, checked that the A0 pin was set to high while sending display data, but still we got nothing on the display.

The second question regards the bytes sent through SPI communication: for display data, in 3-wire mode it seems pretty obvious that we can send more than one byte at a time, since we must specify how many bytes we are sending; for command data, that is pretty unclear. The code examples we found seem to send this data one byte at a time, but none of them covers the 3-wire interface: either way, we didn't find any confirmation that we can send more than one byte at a time, so we tried both ways. Still, no data shown on the display. Is it mandatory then to send one byte at a time, or is there a maximum number of bytes that can be sent?
Just to be clear, when I say "one byte at a time" I mean: "CSB down, one byte sent, CSB up, CSB down, one byte sent, etc", as opposed to "CSB down, N bytes sent, CSB up"



Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 10
    • View Profile
Re: C128128BZ-FSW-GBW and SPI 3-wire
« Reply #1 on: October 15, 2015, 04:40:37 PM »
Hi,

According to the controller datasheet:
Quote
In 3-Line mode, default message from MCU is command, the 2 bytes command of Set Data Direction & Display Data
Length must be set before display data send from MCU, after the display data is sent over, the next message is turned to
be command

I was wondering if you sent these 2 commands in the beginning?

If at all possible would you be able to share your schematic for how the display is setup along with your initialization to ensure you enable the internal regulator to generate the voltage required for the contrast.

You can see the controller datasheet here: http://www.newhavendisplay.com/app_notes/ST7528.pdf
Pages 22 and 23 go into more detail about how the 3/4 wire SPI will work for this device.

LBMoelca

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: C128128BZ-FSW-GBW and SPI 3-wire
« Reply #2 on: October 20, 2015, 04:30:45 AM »
Yes, we sent those two bytes when we worked in 3-wire mode.
We decided to switch to 4-wire mode, so now we have PS0 and PS2 low, and PS1 high. The software handles A0, putting it high when it sends display data, and keeping it low for command data.
For the initialization, with A0 low, we are currently sending the same bytes as shown here, and we also send the same grayscale initialization bytes.
At the end, we send the bytes to select page 0 and column 0, then we activate the reverse mode (command 0xA7), expecting to see the display all dark, then after 1 second we return to normal mode (command 0xA6), and finally we set A0 high and send some display data (taken from the driver datasheet, to display a capital 's').

We are still unsure if we can send more bytes at a time: the example I linked above sends them one at a time, we'd like to know if that is mandatory.

EDIT: I forgot, the very first byte we send to the display is the reset command (0xE2), right before the init sequence.
« Last Edit: October 20, 2015, 07:06:29 AM by LBMoelca »

 

NHD‐3.12‐25664UMB3 3 or 4 wire interface

Started by cliffgBoard OLEDs

Replies: 1
Views: 2387
Last post February 13, 2015, 04:43:21 PM
by Michael_L
NHD-1.27-12896UGC3, can't write data correctly, 4 wire spi

Started by dannyjBoard OLEDs

Replies: 1
Views: 2164
Last post November 14, 2014, 09:30:55 AM
by Michael_L