Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

SSD1305 128x32 OLED Hardware SPI
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

SSD1305 128x32 OLED Hardware SPI

by cjohnson on Mon Aug 17, 2020 10:34 pm

I'm using the 128x32 OLED (https://www.adafruit.com/product/2675)

I've got it connected to an Arduino compatible OESPP Uno R3 Plus using SPI (final version will use metro mini)

Software SPI works just fine but hardware SPI is not displaying anything.

I tried out the SSD1305 example using all default values but updating display height to 32.
Software SPI works but hardware SPI does not.

I'm using the default SPI pins from the example (which happen to use the hardware SPI pins)

#define OLED_CLK 13
#define OLED_MOSI 11

The only other changes to the library code is that mentioned in https://github.com/adafruit/Adafruit_SS ... -633691399
This was to address a buffer misalignment (shifted by 4)

Any suggestions?

I would like to be able to use hardware SPI since I plan on sharing the bus with an octal 10bit DAC

Thank you
cjohnson
 
Posts: 5
Joined: Thu Feb 14, 2013 11:00 am

Re: SSD1305 128x32 OLED Hardware SPI

by adafruit_support_carter on Wed Aug 19, 2020 11:12 am

Did you also make the code change mentioned here:
https://learn.adafruit.com/2-3-monochro ... 2788109-22
which has you comment out one line and uncomment another?

adafruit_support_carter
 
Posts: 17135
Joined: Tue Nov 29, 2016 2:45 pm

Re: SSD1305 128x32 OLED Hardware SPI

by cjohnson on Wed Aug 19, 2020 11:26 am

Yes, I have been swapping the comments on those two lines to attempt software vs. hardware SPI.

I rewired the sample circuit using the metro mini last night and I'm getting the same results so it's not an issue with my old arduino board.

As before, the software SPI is working fine but switching over to hardware does not display anything on the screen.
The serial messages (with both versions) show the expected status message and then the sprite info.

I even tried using the code as-is (fresh pull) without the column fix. I get the same results software (working) vs. hardware (not), but with the noted rightmost 4 columns of garbage.

I'm also digging through the library code to see if something isn't getting setup properly but I'm kind of stumped why software SPI is working.

Thank you
Chris
cjohnson
 
Posts: 5
Joined: Thu Feb 14, 2013 11:00 am

Re: SSD1305 128x32 OLED Hardware SPI

by cjohnson on Wed Aug 19, 2020 11:34 am

For reference, here is the current circuit layout on the breadboard.

Could the data lines be too long and introducing noise?
I'll try lowering the speed of hardware SPI to see if that helps.

ssd1305.jpg
ssd1305.jpg (722.83 KiB) Viewed 26 times
cjohnson
 
Posts: 5
Joined: Thu Feb 14, 2013 11:00 am

Re: SSD1305 128x32 OLED Hardware SPI

by adafruit_support_carter on Wed Aug 19, 2020 11:45 am

Those lines are short enough that I doubt it's a wire length / noise issue. Try the idea of slowing down the SPI clock and see what happens.

adafruit_support_carter
 
Posts: 17135
Joined: Tue Nov 29, 2016 2:45 pm

Re: SSD1305 128x32 OLED Hardware SPI

by cjohnson on Wed Aug 19, 2020 12:04 pm

Success!

I lowered the hardware SPI clock from the default 8MHz to 7MHz and it's working now.
Very noticeable update speed increase.

I just added the "7000000UL" to override the default value on the SPI clock.

Code: Select all | TOGGLE FULL SIZE
Adafruit_SSD1305 display(128, 32, &SPI, OLED_DC, OLED_RESET, OLED_CS, 7000000UL);


Thank you
cjohnson
 
Posts: 5
Joined: Thu Feb 14, 2013 11:00 am

Re: SSD1305 128x32 OLED Hardware SPI

by adafruit_support_carter on Wed Aug 19, 2020 12:23 pm

Cool. That sounds like it's probably the issue then. Looking at the datasheet:
https://cdn-shop.adafruit.com/datasheets/SSD1305.pdf
I *think* table 13-4 on page 62 has the timing info for SPI, and tcycle essentially specifies the max clock rate, so 1/250ns = 4MHz. But you're getting it to work at 7MHz. Maybe if you still see some issues, knock it down even more?

adafruit_support_carter
 
Posts: 17135
Joined: Tue Nov 29, 2016 2:45 pm

Re: SSD1305 128x32 OLED Hardware SPI

by cjohnson on Wed Aug 19, 2020 12:53 pm

You're right, the specs do list the max cycle time as 250ns.
Not sure how I missed that while looking through that doc last night.
Thank you for mentioning that. I'm still (re)learning all of this and that was a good pointer.

Thank you again.
Chris
cjohnson
 
Posts: 5
Joined: Thu Feb 14, 2013 11:00 am

Please be positive and constructive with your questions and comments.