Pi4J SPI Connecting to ST7735S LCD (Pimoroni PIM436 Breakout Board)

115 views
Skip to first unread message

jchar...@gmail.com

unread,
Jan 31, 2021, 2:44:31 AM1/31/21
to Pi4J
Greetings to the group from Columbus, Ohio!

I am working on a Java driver to control the PIM436 breakout board for a ST7735S LCD display.

I have SPI working, or at least not giving errors, and GPIO pins are working, but I am getting strange behavior from the ST7735S. It basically shows a screen of random noise - even before I send any SPI data.

I am not sure if it is connected correctly to the RPi3B.

The pin-out on the LCD breakout is as follows:
  • 3-5V to any 5V or 3V pin
  • CS to BCM 7
  • SCK to BCM 11
  • MOSI to BCM 10
  • DC to BCM 9
  • BL to BCM 19
  • GND to any ground pin
This is straight from the Pimoroni cut sheet.

This works perfectly in Python with with spidev and RPi.GPIO and ST7735.

But I am trying to get it working with Java.

The above list shows the MOSI pin goes to BCM 10 (which is RPI pin 19, with the SPI pi name of MOSI, and wPi pin 12).  Does that sounds right??

The SCK goes to BCM 11 (which is RPi pin 23, with the SPI pin name of SCLK, and wPi pin 14).  Does that sounds right???

CS pin question:

The CS pin goes to BCM 7 (which is RPi pin 26, with the SPI pin name of CE1, and wPi pin 11).

I can not find any information in Pi4J about how to set a CE0 or a CE1 pin in an SPI interface.

DC pin question:

The DC pin on the breakout board is supposed to be set high when sending display data, and low when sending command data.

The above connection list from Pimoroni says it should be connected to BCM pin 9, (which is RPi pin 21, with the SPI pin name of MISO and wPi pin 13).

How do I change the level of the MISO pin in Pi4J? Doesn't it belongs to the SPI0 port?

How to set Port and Chip Select using Pi4J:

There is an spidev method in Python in the ST7735 class constructor that sets the port and cs line:  self._spi = spidev.SpiDev(port, cs) but I can not find a way to do this in Pi4J or WiringPi.

Successes:

I do have Pi4J I2C running on a Pi3B with a Honeywell MPRLS board, and a Bosch BME280, and also a DHT sensor using PWM - all using Pi4J. I am writing an app for a weather station that runs on a Pi that sits inside a 7" RPi foundation LCD case.

Thank you in advance for any assistance.

Kind regards,
John
ST7735.java
Reply all
Reply to author
Forward
0 new messages