Another thing I started to notice.
When I clear the display with the current speed which is 1000000UL there are some pixels left over because the speed is still a bit fast than enough.
I used 500000 is problem is solved.
void glcd_cmd(uint8_t cmd) {
SPI.beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE3));
digitalWrite(CS_PIN, HIGH);
SPI.transfer(0xF8);
SPI.transfer(cmd & 0xF0);
SPI.transfer(cmd << 4);
digitalWrite(CS_PIN, LOW);
SPI.endTransaction();
}
void glcd_data(uint8_t data){
SPI.beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE3));
digitalWrite(CS_PIN, HIGH);
SPI.transfer(0xFA);
SPI.transfer(data & 0xF0);
SPI.transfer(data << 4);
digitalWrite(CS_PIN, LOW);
SPI.endTransaction();
}
My question, how to balance the best SPI speed for this glcd ?
If I put any speed in the setting function, would the Arduino adapt that exact speed ?
Like:
- This causes some left pixels on the display, so it's still too fast for the glcd
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));
- I used this speed and it worked fine:
SPI.beginTransaction(SPISettings(950000, MSBFIRST, SPI_MODE3));
Does it really run at 950k ?