I am trying to use an SSD1331 with a PIC18F47Q43 (also tried a 18F25Q43) and cannot get anything on the display. I have checked the wiring several times, even belled through between the solder connections on the SSD1331 and the legs on the chip to prove no fault with breadboard, ZIF socket, wiring etc.
Could someone please check the code below to see if I am missing something please?
The code is from a December 2014 tutorial, I have just taken out bits to simplify it for myself, to add, the LED on portB.5 is flashing so it is going through the code, just the display is dead, I have tested the display with an Arduino and it works OK.
Regards
gradall
/*AdemonstrationprogramforGCBASIC.--------------------------------------------------------------------------------------------------------------------------------ThisprogramisasimpleGLCDdemonstrationoftheSPIcapabilitiesusinganGLCDSSD1331.ItisanicegraphicalLCD,suitableforalotofvariousprojects.Thisprogramdrawslines,boxes,circlesandprintsstringsandnumbers.TheGLCDisconnectedtothemicroprocessorasshowninthehardwaresectionofthiscode.:ThishasbeentestedusingthehardwareandsoftwareSPIoption.IfyouchangefromhardwareSPIwhenusingPPS,youwillneedtopowercyclethechip.::@authorEvanV@licenceGPL@version1.0@date10.12.2024********************************************************************************/#CHIP 18F47Q43, 64#OPTION Explicit//PICPPSToolversion:0.0.6.5#startup InitPPS, 85#define PPSToolPart 18F47Q43SubInitPPS#IFDEF SSD1331_HardwareSPI//Module:SPI1RC3PPS=0x0031//SCK1>RC3SPI1SCKPPS=0x0013//RC3>SCK1(bi-directional)RC4PPS=0x0032//SDO1>RC4#ELSERC4PPS=0x0000RC3PPS=0x0000SPI1SCKPPS=0x0000#ENDIFEndSub//*******************GLCDsetupandconfiguratio******************#INCLUDE <glcd.h>#define GLCD_TYPE GLCD_TYPE_SSD1331//ThisisaPPSchip,so,needstomakethePPSmatchtheseassignments#DEFINE GLCD_DO portC.4#DEFINE GLCD_SCK portC.3//PinmappingsforGLCD#DEFINE GLCD_DC portC.0#DEFINE GLCD_CS portC.1#DEFINE GLCD_RESET portC.2//!Uncommentoutthenextline...and,enableordisablethePPS!!!//#DEFINE SSD1331_HardwareSPI ' remove/comment out if you want to use software SPI//**********************DEMOREALLYSTARTSHERE************************************************//GLCDselectedOLEDfontset.#define GLCD_OLED_FONT#define GLCD_PROTECTOVERRUNGLCDfntDefaultsize=1DimCCOUNT,BYTENUMBER,OLDFONT,OLDFONTasByteGLCDSetContrast(0xFF)SetPowerMode_SSD1331(0x1A)//ExplicitcommmandsforthisdeviceSetBrightness_SSD1331(0xFF)//Explicitcommmandsforthisdevice-fullbrightnessGLCDCLSGLCDPrintStringLN"GCBASIC 2024"GLCDPrintStringLN""GLCDPrintStringLN"SSD1331 GLCD"GLCDPrintStringLN""GLCDPrintStringLN"by Anobium"wait5sDOforever'Lighten Arduinos onboard LED for 100 millisecondsPulseOutPortB.5,100ms'Then wait 900 milliseconds after LED goes offWait900msLoopEnd
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looking forward to your testing, I have been trying for a week now, tried again with a new PIC delivered this morning, still the same.
To add, when I test the display on Arduino and it works, this is using Arduino IDE (not gcbasic), I am very new to GCbasic so I may be doing something wrong with the GC IDE?
Regards
gradall
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, I haven't tried your hex yet, will do tomorrow, reason for tomorrow is, I have another SSD1331 coming from Amazon (should be here this evening) so want to try that also.
Many thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry my error, I was supposed to say MAGENTA, it is listed in the SSD1331 help page but it isn't actually declared in the glcd_ssd1331.h file so causing compile error.
Last edit: John Smith 2025-01-27
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Important Update: New Support for SPIMode in SSD1331 GLCD library
I have an essential update to share regarding the SSD1331 GLCD library. After years of oversight and valuable feedback from the community, a critical change has been made to enhance its flexibility and usability.
What's New?
Previously, the SPI mode was fixed to CPOL = 0 and CPHA = 0. This limitation wasn't ideal for everyone, and I'm now pleased to inform you that I've added support for SPIMode HWSPIClockMode. This means that users can set the SPI mode in their source programs to best suit their needs.
How to Use It?
You can set the mode by using #define HWSPIClockMode 0 to 3. This allows you to configure the CPOL (Clock Polarity) and CPHA (Clock Phase) values as follows:
0: CPOL = 0, CPHA = 0
1: CPOL = 0, CPHA = 1
2: CPOL = 1, CPHA = 0
3: CPOL = 1, CPHA = 1
There is a a library script, that uses the HWSPIClockMode constant in the SSD1331 library to set the operating mode for the GLCD.
Release Information
This change was made in December 2024 and is due for release with GCSTUDIO build 1460. The updated library is also downloadable from SourceForge and will be included in the next release of GCSTUDIO.
Why This Update?
This update corrects an oversight that persisted for many years. Through my experience with the PIC18F27Q24 tutorials, it was evident that the fixed SPI mode was not suitable for all users. This change provides more control over the SPI communication settings, allowing you to tailor the library to better fit your specific requirements and hardware configurations.
I hope this update improves your experience with the SSD1331 GLCD library. Thank you for your continued support and feedback. Your contributions are invaluable and help me make these improvements.
Feel free to reach out if you have any questions, suggestions, or just want to share your experiences!
Last edit: Anobium 2025-01-27
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
I am trying to use an SSD1331 with a PIC18F47Q43 (also tried a 18F25Q43) and cannot get anything on the display. I have checked the wiring several times, even belled through between the solder connections on the SSD1331 and the legs on the chip to prove no fault with breadboard, ZIF socket, wiring etc.
Could someone please check the code below to see if I am missing something please?
The code is from a December 2014 tutorial, I have just taken out bits to simplify it for myself, to add, the LED on portB.5 is flashing so it is going through the code, just the display is dead, I have tested the display with an Arduino and it works OK.
Regards
gradall
The code looks good.
I will test on the test rig but it will be Sunday.
Evan
Many thanks
Looking forward to your testing, I have been trying for a week now, tried again with a new PIC delivered this morning, still the same.
To add, when I test the display on Arduino and it works, this is using Arduino IDE (not gcbasic), I am very new to GCbasic so I may be doing something wrong with the GC IDE?
Regards
gradall
I got to it today. All good.
I took your code from the post and tested as-as. Worked.
I tested as-is using software SPI and then I enabled PPS - that worked.
Post the top few lines of the ASM file. It will look like this.
Then, try my HEX, and test.
Sorry, as I say, I am very new to GCbasic.
Are you saying the code I posted works without changing anything?
Today, I took delivery of a PIC16F17126 (as used in one of your youtube video's) and copied and pasted your code from github as below.
16F17126_chiprange_demonstrations/260_spi_glcd_using_SSD1331.gcb
Still the same for me, display is dead?
Did you try the HEX above on the Q43 ? This the latest build with the library fix discussed below.
And, post the ASM header please. It will tell me your build details.
I am not saying the display is dead. You have not tried the Hex or the new library.
No, I haven't tried your hex yet, will do tomorrow, reason for tomorrow is, I have another SSD1331 coming from Amazon (should be here this evening) so want to try that also.
Many thanks.
New SSD1331 has just turned up (via Amazon, a very late delivery).
This one is actually working, although the display is "strobing", but this is using your code from a few years ago on the PIC16F17126 .
I am very confused why this one is (semi) working, the old one was dead but worked using an Arduino.
Will look more into it tomorrow with the other PIC chips and your hex.
Regards
Just flashed your hex onto my 18F47Q43 and it works fine.
Thanks for help, so I need to update my glcd_ssd1331.h with a new one from SourceForge?
Will the other SSD displays also get updated?
Regards
Just to add as below, small error in help file.
https://gcbasic.sourceforge.io/help/_ssd1331_controllers.html
Colour "Cyan" isn't valid.
Also your post below gives reference to December 2025, a typo I guess?
Cracking work you are doing though, many thanks.
Last edit: John Smith 2025-01-27
Thanks!
Can you help me with the CYAN error? Not sure I understand what to resolve.
Do you mean SSD1331_CYAN is not CYAN colour? Or there is some error.
Try using TFT_Cyan.
Evan
Sorry my error, I was supposed to say MAGENTA, it is listed in the SSD1331 help page but it isn't actually declared in the glcd_ssd1331.h file so causing compile error.
Last edit: John Smith 2025-01-27
Here is an improved Help page.
It would be best to use TFT colours.
This is related.... https://ko-fi.com/post/Important-Update-New-Support-for-SPIMode-in-SSD13-E1E819KGZB
Important Update: New Support for SPIMode in SSD1331 GLCD library
I have an essential update to share regarding the SSD1331 GLCD library. After years of oversight and valuable feedback from the community, a critical change has been made to enhance its flexibility and usability.
What's New?
Previously, the SPI mode was fixed to CPOL = 0 and CPHA = 0. This limitation wasn't ideal for everyone, and I'm now pleased to inform you that I've added support for SPIMode HWSPIClockMode. This means that users can set the SPI mode in their source programs to best suit their needs.
How to Use It?
You can set the mode by using
#define HWSPIClockMode 0
to3
. This allows you to configure the CPOL (Clock Polarity) and CPHA (Clock Phase) values as follows:0
: CPOL = 0, CPHA = 01
: CPOL = 0, CPHA = 12
: CPOL = 1, CPHA = 03
: CPOL = 1, CPHA = 1There is a a library script, that uses the
HWSPIClockMode
constant in the SSD1331 library to set the operating mode for the GLCD.Release Information
This change was made in December 2024 and is due for release with GCSTUDIO build 1460. The updated library is also downloadable from SourceForge and will be included in the next release of GCSTUDIO.
Why This Update?
This update corrects an oversight that persisted for many years. Through my experience with the PIC18F27Q24 tutorials, it was evident that the fixed SPI mode was not suitable for all users. This change provides more control over the SPI communication settings, allowing you to tailor the library to better fit your specific requirements and hardware configurations.
I hope this update improves your experience with the SSD1331 GLCD library. Thank you for your continued support and feedback. Your contributions are invaluable and help me make these improvements.
Feel free to reach out if you have any questions, suggestions, or just want to share your experiences!
Last edit: Anobium 2025-01-27
The latest update, Feb 19th 2025, corrects underlying Hardware SPI issue.
So,
HWSPIClockMode
may no longer be required for this library.