I am having trouble with the SD1306 not displaying correctly.
Initial clear screen seems to give static, and can I get a messy 'hello world'.
The second clearscreen doesn't seem to do anything, the "hello world" remains
The second line of text 'Test 2' writes over top of the 'hello world'.
See attached image.
I have two of these SD1306 and get the same result, so doesn't appear to be a duff unit, but maybe it is not SD1306 compatable as claimed?
I have also tried the demo code "GLCD_Simple_Demonstration_Software_SPI_mega328p_for_SSD1306@16.gcb" modified for my pic and hardware etc, but with the same on screen 'static' result
Is there anything stupid I have missed?
Great Cow BASIC (0.98.06 2019-06-12 (Windows 32 bit))
James - I do not have a 4 wire SDD1306. I only have I2C devices. @kent_twt4 added the 4wire SPI and Kent is good.
So, let us assume the code is good, but, there could be a timing issue in the SPI. The code below revises to code to redirect the SPI write a subroutine in your program. This will enable you to play with the timing. See myS4Wire_SSD1306 - I have changed the loop method but I have changed the clock signal but rotating the variable SSD1306SendByte to create a timed delay on the clock. This method uses the time (four clock cycles) to rotate the byte to create an improved clock signal.
Anyway... I cannot test. Also, try NOT using the external OSC.
So I hooked up the UNO and fired up the demo, and there is something to this. I get lots of random pixels, although the general commands seem to execute OK. Still way back on 98.07_RC19, so something went astray, even before then.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Substituted @Anobium code, and no difference. Text commands work, line draws work, along with demo circle, filled circle, box, filled box of demo code.
This could be a CLS problem? Reduced program to just GLCDCLS and therein full screen of random dots.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have also tried S4Wire_SSD1306 with no improvement. Also tried the internal oscillator.
At kents suggestion of a problem with GLCDCLS I tried just text only with no GLCDCLS, just text only and still get the same as my photo above. Unless the code does a GLCDCLS unprompted by the user code when initializing?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The cause based on the facts that lines etc work (meaning the comms are all ok) is the Transaction code.
I can look at the transaction code but unless low memory mode is defined then the code generated should work... clearly adding transaction code has impact the SPI solution.
I can look this morning to see if I can see anything obvious. But, I dont want to do the same work as you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I thought I would be cunning and clear the screen with spaces.... no improvement. So does that mean text is a also a problem?
Even the white spaces to the right of "Test" still give 'static'
@Anobium could you replace the demo file for the M328 to revised pin placements? This is to reflect the defines to the 4wire SPI module pin order. Also, places the M328 hardware SCK, MOSI, and SS pins to their respective pins too. Tested. Thanks.
I am having trouble with the SD1306 not displaying correctly.
Initial clear screen seems to give static, and can I get a messy 'hello world'.
The second clearscreen doesn't seem to do anything, the "hello world" remains
The second line of text 'Test 2' writes over top of the 'hello world'.
See attached image.
I have two of these SD1306 and get the same result, so doesn't appear to be a duff unit, but maybe it is not SD1306 compatable as claimed?
I have also tried the demo code "GLCD_Simple_Demonstration_Software_SPI_mega328p_for_SSD1306@16.gcb" modified for my pic and hardware etc, but with the same on screen 'static' result
Is there anything stupid I have missed?
Great Cow BASIC (0.98.06 2019-06-12 (Windows 32 bit))
Last edit: James Whyte 2021-03-25
@kent_twt4
James - I do not have a 4 wire SDD1306. I only have I2C devices. @kent_twt4 added the 4wire SPI and Kent is good.
So, let us assume the code is good, but, there could be a timing issue in the SPI. The code below revises to code to redirect the SPI write a subroutine in your program. This will enable you to play with the timing. See
myS4Wire_SSD1306
- I have changed the loop method but I have changed the clock signal but rotating the variable SSD1306SendByte to create a timed delay on the clock. This method uses the time (four clock cycles) to rotate the byte to create an improved clock signal.Anyway... I cannot test. Also, try NOT using the external OSC.
Let us know what happens.
So I hooked up the UNO and fired up the demo, and there is something to this. I get lots of random pixels, although the general commands seem to execute OK. Still way back on 98.07_RC19, so something went astray, even before then.
@kent_twt4
Tried the adaptation to the S4Wire_SSD1306 send routine ?
If that does not work. Then, I need to look at the Transaction code.
@kent_twt4
Also, rule out all the Text code. Does a line draw ?
Substituted @Anobium code, and no difference. Text commands work, line draws work, along with demo circle, filled circle, box, filled box of demo code.
This could be a CLS problem? Reduced program to just GLCDCLS and therein full screen of random dots.
I have also tried S4Wire_SSD1306 with no improvement. Also tried the internal oscillator.
At kents suggestion of a problem with GLCDCLS I tried just text only with no GLCDCLS, just text only and still get the same as my photo above. Unless the code does a GLCDCLS unprompted by the user code when initializing?
OK. CLS looks like the issue.
Drawing lines etc tells us the comms protocol all work.
CLS is call automatically as part of init.
@kent_twt4
Are you working this issue?
The cause based on the facts that lines etc work (meaning the comms are all ok) is the Transaction code.
I can look at the transaction code but unless low memory mode is defined then the code generated should work... clearly adding transaction code has impact the SPI solution.
I can look this morning to see if I can see anything obvious. But, I dont want to do the same work as you.
I thought I would be cunning and clear the screen with spaces.... no improvement. So does that mean text is a also a problem?
Even the white spaces to the right of "Test" still give 'static'
@James - nice idea. What is your time zone? I have an idea.
Things we know work.
PSet_SSD1306
and thereforeCursor_Position_SSD1306
- these are all needed for LIne etc.But, I have found the error!!!!
`Write_Transaction_Data_SSD1306 ( in SSD1306SendByte as byte )
sends data to the GCLC as follows.but, this should be as follows:
Please test the attachment. Rename the existing file in your INCLUDE folder.
Bingo.... excellent and well done. Thanks Team :-)
Now CLCDCLS gives a clean screen and other functions text etc now working as expected.
PS. I am in New Zealand GMT+13
Excellent news. I did a code review and I thought that transaction code did not look correct!
GREAT!!
@kent_twt4 - sorted!!!!
Formal release of the revised .h is here https://sourceforge.net/p/gcbasic/code/HEAD/tree/GCBASIC/trunk/include/glcd_SSD1306.h?format=raw
Thanks to all. All good with the UNO now too.
@Anobium could you replace the demo file for the M328 to revised pin placements? This is to reflect the defines to the 4wire SPI module pin order. Also, places the M328 hardware SCK, MOSI, and SS pins to their respective pins too. Tested. Thanks.
I can replace the demo - what was it called?
Sorry,
glcd_simple_demonstration_software_spi_mega328p_for_ssd1306@16.gcb
Last edit: kent_twt4 2021-03-26
NP. Found it and updated in Github etc.