Software SPI working Hardware SPI isn't

Hi everyone, I am working with an aliexpress ssd1283a based 1.6inch oled display connected to a UNO

The software spi works, however the hardware one does not. Libraries and defines are listed below. (I am setting the software SPI to the same pins as the hardware SPI, just for ease of not having to reconnect anything)

Is this to be expected? Or am I missing something?

regards

#include <LCDWIKI_GUI.h> //Core graphics library
#include <LCDWIKI_SPI.h> //Hardware-specific library

//parameters define
#define MODEL SSD1283A
#define CS 10
#define CD 9
#define SDA 11
#define MOSI SDA
#define SCK 13
#define RST 8
#define LED A3

LCDWIKI_SPI mylcd (MODEL,CS,CD, MISO, MOSI, RST, SCK, LED); //works
//LCDWIKI_SPI mylcd(SSD1283A, 10, 9, 8, A3); // does not work.

I think that the hardware SPI should have a much simpler constructor because all pin numbers, except CS, are defined by the hardware.

here is how the hardware spi is defined in the header

LCDWIKI_SPI(uint16_t model,int8_t cs, int8_t cd, int8_t reset,int8_t led);

I think I have got that correct

The badly spelled library has the following constructors:


 LCDWIKI_SPI(uint16_t model,int8_t cs, int8_t cd, int8_t miso, int8_t mosi, int8_t reset, int8_t clk, int8_t led);
 LCDWIKI_SPI(uint16_t model,int8_t cs, int8_t cd, int8_t reset,int8_t led);
 LCDWIKI_SPI(int16_t wid,int16_t heg,int8_t cs, int8_t cd, int8_t miso, int8_t mosi, int8_t reset, int8_t clk,int8_t led);
 LCDWIKI_SPI(int16_t wid,int16_t heg,int8_t cs, int8_t cd, int8_t reset,int8_t led);

You want to use this HW constructor

LCDWIKI_SPI(uint16_t model,int8_t cs, int8_t cd, int8_t reset,int8_t led);

i.e. connect "SDA" pin to 11, "SCK" pin to 13

LCDWIKI_SPI mylcd(SSD1283A, 10, 9, 8, A3); //should work fine

especially since you have verified your wiring with the SW constructor.

I note that you have no define for "miso". The 1.6 inch display has no "SDO" pin. What argument did you use for "miso" in the SW constructor?

Untested. Everything in this library is "badly spelled" but will probably "work".
If not, I will dig out a 1.6 inch and see for myself.

David.

**LCDWIKI_SPI(uint16_t model,int8_t cs, int8_t cd, int8_t reset,int8_t led);

yes that is the constructor that i thought I was using with the line below
LCDWIKI_SPI mylcd(SSD1283A, 10, 9, 8, A3);  Which did not work, I used the same pins for the sw constructor, which verifies that my wiring is good.

i didn not define miso, so i guess it just gets a random value. something I should tidy up later.

Still seems strange that the software spi works, and the hardware spi does not, only difference seems to be that the hw spi calls routines from the spi library, whereas the sw spi just does the job at a bit level on the output lines itself.

Can you suggest a better library for the SSD1283A?

thanks for the reply
Shaun

I think there are several other SSD1283A libraries e.g. ZinggJM

I tried my copy of the badly spelled library. And it worked with the HW constructor on a Uno. Obviously with some graphics errors but I did not expect them to be 100%.

Since LCDWIKI is not supported by the IDE Library Manager I have no idea where you got your library from.

Post a link to your library repository / installation.
Quote the example sketch that gives a problem.
i.e. quote example by name. copy-paste your constructor line.

This means that I know exactly what sketch you are using and what edits you have made.

David.

SSD1283A for Arduino

This library supports SSD1283A to use with Adafruit_GFX and/or LCDWIKI_GUI.

The code is extracted from LCDWIKI_SPI and adapted for single controller use and Adafruit_GFX.

Only HW SPI is supported.

SSD1283A_SPITFT for Arduino

This library supports SSD1283A to use with Adafruit_SPITFT

The code is extracted from LCDWIKI_SPI and adapted for single controller use and Adafruit_SPITFT.

GFX_TFT TFT Display Classes based on GFX_ROOT and GFX_Extensions

This library supports some TFTs using GFX_IO (my Adafruit_SPITFT clone)

These libraries are not (yet) known to Library Manager; download and install as ZIP-files.

Jean-Marc

Hi David,
I downloaded the libraries from github lcdwiki/lcdwiki_spi and gui they currently have a -master on the end, so unzipped to library and renamed them back to just _gui and _spi.

libraries

grabbed the defines from above and tried the example file in the _spi library called display_string

again the software mylcd worked, the hardware did not.
This one worked
LCDWIKI_SPI mylcd(SSD1283A,CS,CD,-1,SDA,RST,SCK,LED);//software spi,model,cs,cd,miso,mosi,reset,clk,led

This one did not
LCDWIKI_SPI mylcd(SSD1283A,CS,CD,RST,LED); //hardware spi,cs,cd,reset

regards
Shaun

I changed my GUI and SPI Forks to "lcdwiki/master" and ran this example :
C:\Users\David Prentice\Documents\Arduino\libraries\LCDWIKI_SPI\Example\Example_03_display_string\display_string\display_string.ino

I edited line #40 to say :

LCDWIKI_SPI mylcd(SSD1283A,10,9,8,A3); //hardware spi,cs,cd,reset

The example built and ran on a Uno.

Please note that that GitHub repository is about 3 years old. They have never responded to any Issues or Pull Requests.

Many people seem to "find" LCDWIKI on the Internet. But never say exactly where.
In your case, you have specified the exact URL and the example name.

I can only report that it "works" for me.

LCDWIKI do an excellent job of documentation. But their code is crap and their spelling is appalling.

If LCDWIKI were to respond to Pull Requests they would have 100% working code and the whole Arduino community would benefit.

David.

Thanks for the effort David. I have just thrown the oscilloscope at it and it appears that the bitbashed version is quite a lot slower than the hw version. I will look at slowing down the spi clock later when I have time, to see if that helps.
Shaun

Seriously. Just double-check your wires.

I can only try to replicate your problem. Incidentally, I built the SW version :

//LCDWIKI_SPI mylcd (MODEL,CS,CD, MISO, MOSI, RST, SCK, LED); 
LCDWIKI_SPI mylcd (SSD1283A,10,9,   -1,   11,   8,  13,  A3); //

And yes, it works too. Obviously slower than the HW version.

When debugging the wiring, you should try the SW constructor first. And then the HW constructor. Do not touch any wires between builds.

David.

2 posts were split to a new topic: Connect a UNO to a 4" LCD (420X380 ) with ILI9486 driver in SPI mode

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.