I am using MightyCore and platformio. My config file looks like this
My fuses are set as:
E:FD
H:D6
L:8F
I have controller running at 16 MHz and SCK frequency is 8 MHz. My display is showing white color and that is it. I know to make it function properly I have to use 1 MHz SPI clocking. If I program CKDIV8 fuse my controller doesn't start. I dunno why, kind of black magic going on there for me. My lack of knowledge is not helpful there.
I tried to use the following tricks:
Setting SPI speed using TFT library
// earlier in main.cpp
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
// later in setup()
tft.setSPISpeed(1000000); // has no effect on SCK
Trying to set it directly via SPI class instance:
// in setup()
SPI.setClockDivider(SPI_CLOCK_DIV128); // no effect
Or statically:
// in setup()
SPIClass::setClockDivider(SPI_CLOCK_DIV128); // still no effect
Also I tried to pass DEFAULT_SPI_FREQ
build flag with frequency preset.
I ran out of ideas.
Schematic is here: Schematic
1 Answer 1
Per this issue setSPISpeed has to be made after initR like this:
tft.initR(INITR_BLACKTAB);
tft.setSPISpeed(1000000);
-
init initializes SPI and of course sets the default value. you can change it only after that2020年12月21日 05:53:02 +00:00Commented Dec 21, 2020 at 5:53
-
@Juraj I have no idea what was going on in Adafruit engineers head. The display fails to init @ 8 MHz because SPI is too fast for it. It has to be initialized at 1 MHz then it supposed to function properly.zoonman– zoonman2020年12月23日 14:08:36 +00:00Commented Dec 23, 2020 at 14:08
setSPISpeed
afterinit
?