SSD1306 --> Core
CS ---> SS (A2)
CLK ---> SCK (A3)
MOSI --> MOSI (A5)
DC --> Any pin you defined (eg. D3)
CS ---> A2 (can be changed but we use the default chip select pin)
Reset ---> Any pin you defined (eg. D5)
Just to make things even clearer than @kennethlimcp has already done:
The DC or D/C pin is needed by some devices to distinguish between commands or data for the controler.
Since SPI only pushes out anonymous bitsreams the user code has to “tell” the controler if this will be a command (e.g. D/C LOW) or a data (e.g. D/C HIGH) bitstream. And so D/C is not actually an SPI pin, but this gives you freedom which Core pin to choose.
Similarly the Reset pin can be chosen freely or even pulled high or left open if it’s pulled high on the board already, if you don’t need to reset the device via user code.
The CS pin is a kind of hybrid here. While SPI brings its own version of it (SS) you might want to use any other free digital pin if you’d like to attach multiple SPI devices, selecting each individual one via its own designated chip select pin.
For each SPI stream only one CS should be active to ensure that only the meant device listens to it.
And since only user code “knows” who is meant at a given time you have to decide which Core pin to use as CS for which device.
Moved Reset to D0 as initialized accordingly and it worked.
I have a question more though. The Adafruit_1306 lib has the frequency for HW SPI set at 9mhz:
That might be possible but checking the data sheet will give us the best answer.
Or maybe the arduino they interfaced to cannot handle too high a freq and 72Mhz seems like a stm32f103 thing on the core and divided to get the same freq used in the original library.
I tried measuring the FPS, and it doesn’t seem like its the SPI that limits a good FPS.
If I draw 1 frame per loop then before wifi is connected I get a good 210FPS. After WIFI connects I get 100FPS. If I draw 4 frames per loop it jumps to 170FPS after WIFI connects.
And all I need really is 60FPS. Im gonna measure I2C now. If that gives me 60FPS I might as well use that to have more pins available.