Two SPI devices SSD1351 and MCP2515, display not working

Dear reader,

I have used the forum in the past by reading the problems others face and the solutions given. This time I am facing a challenge where I need some help and would like to contribute.

Problem: Two SPI devices SSD1351 and MCP2515 with separate CS pins. Can communicate separately, but together the display doesn't show animations.

Hardware: My own custom PCB for Arduino Nano Every, MCP2515 and a Waveshare 1.5" OLED display. I have/will attach some pictures if the electrical schematic.
Software libraries: Adafruit SSD_1351 v1.3.0 and Milesfrankland edit of autowp CAN bus library. IDE 2.1.0
Communication: 4 wire SPI with separated CS for MCP2515 and display.

For explaining my problem, I will combine the "CAN_read" example in to the SSD3151 "test" example. Only things changed are the SPI pin defines and baudrate.
test.ino (8,7 KB)

I attached the test script in the attachments. Procedure for problem reproducing.

  1. Successfully SSD_1351 test example (vanilla) with my SPI pins.
  2. Successfully SSD_1351 test example with my SPI pins and only including the CAN-Bus library and “struct can_frame canMsg;” and “MCP2515 mcp2515(9); // CAN controller CS pin on D9”.
  3. Failed to run code when including (uncomment) all the MCP can_read example in setup.

When introducing the “mcp2515.begin()” the display is not functioning as it should. The display remains black or frozen from the last shown animation when it did work. But if I include Serial.Println(“ ”) pings in the code. The Arduino does go with the expected pace through the code. I say this specifically, because I used the SeedStudio MCP2515 library in the past and then it shows all the Serial.Println(“ ”) pings within a second. So I changed to the autowp library.

What I tried on HW level

  1. Double check Nano Every PCB footprint with the Nano Every pinout and script pin #DEFINE's.
  2. Solder 10k pullup resistors to both CS pins
  3. Cut the MISO trace and add a 5V tri state buffer SN74HCT125N. This also did not help (display showed white noise), but maybe because I was not able to get the SN74HC125N (2 V to 6 V) (non T version).

I was digging in both libraries .h and .cpp and I saw different SPI bus speeds being mentioned.
SSD_1351 .cpp:
#define SPI_DEFAULT_FREQ 8000000 ///< SPI default frequency
autoWP .h:
static const uint32_t SPI_CLOCK = 10000000; // 10MHz
But I was not able to successfully change the Milesfrankland library to 8 MHz.

CAN Somebody help me track down the cause and solution of this problem?

Is the circuit diagram complete?
Nothing is shown connected to the CAN controller pins 18, 9, 8 and 7.

1 Like

I included a snippet of the schematic.
Those pins attach to bypass capacitors, crystals, can transceiver and power supply.

Are you able to show a comprehensive circuit diagram that includes everything including decoupling caps?

The documentation for the display has a warning at the top in red that says, "Please ensure that the power supply voltage and logic voltage are consistent, otherwise it will not work properly". That is an unusual statement which suggests that other customers have experienced problems with this display.

Hi Mikb55,

Thx for helping me out. I was on holiday and did not have acces to my files, but now I am back.

Here you can see the full circuit diagram of Arduino, OLED and CAN controller.

Does this diagram give you enough information?

Coming weekend I will measure the SPI clock with a scope.

Hi all,

After measuring the SPI signals with the scope, I realized what i did wrong and how to solve it.

I was not paying enough attention to the difference in HW and SW SPI.
The CAN controller is using HW SPI, but I enabled SW SPI for the display.
My code now works, by enabling option 2 (HW SPI) of Adafruits example.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.