Close

Do you speak SPI?

A project log for Cruise Control Preset

This project supplements the existing cruise control in a vehicle, allowing you to automatically set the cruise control to a selected speed.

scott-hammerschmidtScott Hammerschmidt 07/31/2015 at 19:320 Comments

I received the OLED displays with the SPI interface and I wanted to see how long the display update took with these.

First, I had to figure out how to connect these new displays. Mine have D0, D1, RST, and DC (in addition to supply and ground). For a complete SPI interface, I should also have a CS (chip select) line. I finally found this discussion that gave me some clues as to how to hook it up. The CS line on my display is always asserted (low?). D0 is the clock, D1 is MOSI, DC is a data/control line that has something to do with the hardware SPI controller on the AVR not being able to handle 9 bits (I think), and the RST line is the reset line. D0 (SCL) is connected to PB5 (Arduino pin 13), D1 (MOSI) is connected to PB3 (Arduino pin 11), and then I chose to connect DC to PB0 (Arduino pin 8) and RST to PB1 (Arduino pin 9).

After figuring out that the PN( x, x) macro for the u8glib uses 1 for port B (for some reason I was using 2), it worked. Looked pretty much the same as the IIC display. The timing value for the update was 2737, this was for the 2x page size. This works out to 43.8 ms. I need to see what the clock speed is, I don't know if there's something similar to the 'fast' option that I used for IIC.

The lack of a CS line would be detrimental if I try to use 2 displays. I may be able to connect to the board to control a CS line. If not, perhaps I can switch the clock signal (if that is sufficient?) between the two displays.

Discussions