0

I use an Arduino Nano with a ST7735 display and a CAN controller MCP2515. Via SPI bus I want to communicate with the display and the CAN controller. The communication via CAN controller works smoothly. With the display I have the problem that it only shows a white screen.

This is my current setup: CAN-Setup as picture

I use this kind of code to communicate with the CAN-Controller and with the display:

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <SPI.h>
#include <mcp2515.h>

#define MCP2515_CS 10     // Chip Select CAN-Controller
#define TFT_CS 7          // Chip Select TFT-Display
#define TFT_RST 8         // Reset
#define TFT_DC 9     
#define TFT_MOSI 11       // Data out
#define TFT_SCLK 13       // Clock out

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
struct can_frame canMsg;
MCP2515 mcp2515(MCP2515_CS);

Can anyone spot a bug?

DeThe92
  • 1
  • 1
  • and the display without the CAN controller? – Juraj Jul 29 '22 at 18:41
  • I would have to unsolder the display for testing, which I want to avoid for now. Measured with a voltage meter, everything could be ok. But you're right. I might have to do this... – DeThe92 Jul 29 '22 at 18:43

1 Answers1

0

In Adafruit libraries the constructors where you enter the SPI pins use software SPI (bit banged). It conflicts with hardware SPI for the CAN controller on the same pins. Use the constructor

Adafruit_ST7735(int8_t cs, int8_t dc, int8_t rst);

so

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
Juraj
  • 3,490
  • 4
  • 18
  • 25
  • Thank you, but unfortunately this does not solve my problem. – DeThe92 Jul 29 '22 at 18:51
  • Do you think my issues could be caused because my display is from Joy-It? I have a datasheet here: https://joy-it.net/files/files/Produkte/RB-TFT1.8/RB-TFT1.8_Manual_2021-12-22.pdf – DeThe92 Jul 29 '22 at 18:53