Hello, I've been having issues getting my frist hello world code to run.
I am using the ESP32-S3-Mini-1 dev kit
with this display:
with the arduino GFX library :
my hello world code (modified from the examples included in the library)
#include <SPI.h>
#include <Arduino_GFX_Library.h>
#include <Adafruit_GFX.h>
#define GFX_BL 45 // default backlight pin, you may replace DF_GFX_BL to actual backlight pin
#if defined(DISPLAY_DEV_KIT)
Arduino_GFX *gfx = create_default_Arduino_GFX();
#else /* !defined(DISPLAY_DEV_KIT) */
/* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */
Arduino_ESP32RGBPanel *bus = new Arduino_ESP32RGBPanel(
40 /* CS */, 48 /* SCK */, 47 /* SDA */,
18 /* DE */, 17 /* VSYNC */, 42 /* HSYNC */, 21 /* PCLK */,
4 /* R0 */, 3 /* R1 */, 2 /* R2 */, 1 /* R3 */, 0 /* R4 */,
10 /* G0 */, 9 /* G1 */, 8 /* G2 */, 7 /* G3 */, 6 /* G4 */, 5 /* G5 */,
41 /* B0 */, 14 /* B1 */, 13 /* B2 */, 12 /* B3 */, 11 /* B4 */
);
/* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
Arduino_ST7701_RGBPanel *gfx = new Arduino_ST7701_RGBPanel(
bus, GFX_NOT_DEFINED, 480 /* width */, 480 /* height */);
#endif /* !defined(DISPLAY_DEV_KIT) */
/*******************************************************************************
* End of Arduino_GFX setting
******************************************************************************/
void setup(void)
{
gfx->begin();
gfx->fillScreen(BLACK);
#ifdef GFX_BL
pinMode(GFX_BL, OUTPUT);
digitalWrite(GFX_BL, HIGH);
#endif
gfx->setCursor(100, 100);
gfx->setTextColor(RED);
gfx->println("Hello World!");
delay(5000); // 5 seconds
}
void loop()
{
gfx->setCursor(random(gfx->width()), random(gfx->height()));
gfx->setTextColor(random(0xffff), random(0xffff));
gfx->setTextSize(random(6) /* x scale */, random(6) /* y scale */, random(2) /* pixel_margin */);
gfx->println("Hello World!");
delay(1000); // 1 second
}
the Init code the manufacture sent me
#define SET_LSDA_LOW HAL_GPIO_WritePin(GPIOC,GPIO_PIN_0,GPIO_PIN_RESET)
#define SET_LSDA_HIGH HAL_GPIO_WritePin(GPIOC,GPIO_PIN_0,GPIO_PIN_SET)
#define SET_LSCK_LOW HAL_GPIO_WritePin(GPIOC,GPIO_PIN_1,GPIO_PIN_RESET)
#define SET_LSCK_HIGH HAL_GPIO_WritePin(GPIOC,GPIO_PIN_1,GPIO_PIN_SET)
#define SET_LSCE_LOW HAL_GPIO_WritePin(GPIOC,GPIO_PIN_2,GPIO_PIN_RESET)
#define SET_LSCE_HIGH HAL_GPIO_WritePin(GPIOC,GPIO_PIN_2,GPIO_PIN_SET)
void _bus->sendCommand(unsigned char)
{
u8 i;
SET_LSCE_LOW;
delay(20);
SET_LSDA_HIGH;
delay(100);
SET_LSCK_LOW;
delay(100);
SET_LSCK_HIGH;
for(i=0;i<8;i++)
{
delay(100);
SET_LSCK_LOW;
if(DATA&0X80)
SET_LSDA_HIGH;
else
SET_LSDA_LOW;
DATA=DATA<<1;
delay(100);
SET_LSCK_HIGH;
}
delay(50);
SET_LSCK_LOW;
delay(50);
SET_LSCE_HIGH;
}
void _bus->sendData(unsigned char)
{
u8 i;
SET_LSCE_LOW;
delay(20);
SET_LSDA_LOW;
delay(100);
SET_LSCK_LOW;
delay(100);
SET_LSCK_HIGH;
for(i=0;i<8;i++)
{
delay(100);
SET_LSCK_LOW;
if(DATA&0X80)
SET_LSDA_HIGH;
else
SET_LSDA_LOW;
DATA=DATA<<1;
delay(100);
SET_LSCK_HIGH;
}
delay(50);
SET_LSCK_LOW;
delay(50);
SET_LSCE_HIGH;
}
void _bus->sendData_Int(void);
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
__HAL_RCC_GPIOC_CLK_ENABLE();
GPIO_InitStruct.Pin=GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3;
GPIO_InitStruct.Mode=GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull=GPIO_PULLUP;
GPIO_InitStruct.Speed=GPIO_SPEED_FREQ_VERY_HIGH;
HAL_GPIO_Init(GPIOC,&GPIO_InitStruct);
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_0,GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_1,GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_2,GPIO_PIN_SET);
delay(200);
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_3,GPIO_PIN_SET);
delay(10);
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_3,GPIO_PIN_RESET);
delay(200);
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_3,GPIO_PIN_SET);
delay(200);
_bus->sendCommand(0xFF);
_bus->sendData(0x77);
_bus->sendData(0x01);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x10);
_bus->sendCommand(0xC0);
_bus->sendData(0x3B);
_bus->sendData(0x00);
_bus->sendCommand(0xC1);
_bus->sendData(0x0B);
_bus->sendData(0x02);
_bus->sendCommand(0xC2);
_bus->sendData(0x07);
_bus->sendData(0x02);
_bus->sendCommand(0xCC);
_bus->sendData(0x10);
_bus->sendCommand(0xCD);
_bus->sendData(0x08);
_bus->sendCommand(0xB0);
_bus->sendData(0x00);
_bus->sendData(0x11);
_bus->sendData(0x16);
_bus->sendData(0x0E);
_bus->sendData(0x11);
_bus->sendData(0x06);
_bus->sendData(0x05);
_bus->sendData(0x09);
_bus->sendData(0x08);
_bus->sendData(0x21);
_bus->sendData(0x06);
_bus->sendData(0x13);
_bus->sendData(0x10);
_bus->sendData(0x29);
_bus->sendData(0x31);
_bus->sendData(0x18);
_bus->sendCommand(0xB1);
_bus->sendData(0x00);
_bus->sendData(0x11);
_bus->sendData(0x16);
_bus->sendData(0x0E);
_bus->sendData(0x11);
_bus->sendData(0x07);
_bus->sendData(0x05);
_bus->sendData(0x09);
_bus->sendData(0x09);
_bus->sendData(0x21);
_bus->sendData(0x05);
_bus->sendData(0x13);
_bus->sendData(0x11);
_bus->sendData(0x2A);
_bus->sendData(0x31);
_bus->sendData(0x18);
_bus->sendCommand(0xFF);
_bus->sendData(0x77);
_bus->sendData(0x01);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x11);
_bus->sendCommand(0xB0);
_bus->sendData(0x6D);
_bus->sendCommand(0xB1);
_bus->sendData(0x37);
_bus->sendCommand(0xB2);
_bus->sendData(0x81);
_bus->sendCommand(0xB3);
_bus->sendData(0x80);
_bus->sendCommand(0xB5);
_bus->sendData(0x43);
_bus->sendCommand(0xB7);
_bus->sendData(0x85);
_bus->sendCommand(0xB8);
_bus->sendData(0x20);
_bus->sendCommand(0xC1);
_bus->sendData(0x78);
_bus->sendCommand(0xC2);
_bus->sendData(0x78);
_bus->sendCommand(0xC3);
_bus->sendData(0x8C);
_bus->sendCommand(0xD0);
_bus->sendData(0x88);
_bus->sendCommand(0xE0);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x02);
_bus->sendCommand(0xE1);
_bus->sendData(0x03);
_bus->sendData(0xA0);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x04);
_bus->sendCommand(0xA0);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x20);
_bus->sendData(0x20);
_bus->sendCommand(0xE2);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendCommand(0xE3);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x11);
_bus->sendData(0x00);
_bus->sendCommand(0xE4);
_bus->sendData(0x22);
_bus->sendData(0x00);
_bus->sendCommand(0xE5);
_bus->sendData(0x05);
_bus->sendData(0xEC);
_bus->sendData(0xA0);
_bus->sendData(0xA0);
_bus->sendData(0x07);
_bus->sendData(0xEE);
_bus->sendData(0xA0);
_bus->sendData(0xA0);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendCommand(0xE6);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x11);
_bus->sendData(0x00);
_bus->sendCommand(0xE7);
_bus->sendData(0x22);
_bus->sendData(0x00);
_bus->sendCommand(0xE8);
_bus->sendData(0x06);
_bus->sendData(0xED);
_bus->sendData(0xA0);
_bus->sendData(0xA0);
_bus->sendData(0x08);
_bus->sendData(0xEF);
_bus->sendData(0xA0);
_bus->sendData(0xA0);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendCommand(0xEB);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x40);
_bus->sendData(0x40);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendCommand(0xED);
_bus->sendData(0xFF);
_bus->sendData(0xFF);
_bus->sendData(0xFF);
_bus->sendData(0xBA);
_bus->sendData(0x0A);
_bus->sendData(0xBF);
_bus->sendData(0x45);
_bus->sendData(0xFF);
_bus->sendData(0xFF);
_bus->sendData(0x54);
_bus->sendData(0xFB);
_bus->sendData(0xA0);
_bus->sendData(0xAB);
_bus->sendData(0xFF);
_bus->sendData(0xFF);
_bus->sendCommand(0xEF);
_bus->sendData(0x10);
_bus->sendData(0x0D);
_bus->sendData(0x04);
_bus->sendData(0x08);
_bus->sendData(0x3F);
_bus->sendData(0x1F);
_bus->sendCommand(0xFF);
_bus->sendData(0x77);
_bus->sendData(0x01);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x13);
_bus->sendCommand(0xEF);
_bus->sendData(0x08);
_bus->sendCommand(0xFF);
_bus->sendData(0x77);
_bus->sendData(0x01);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendData(0x00);
_bus->sendCommand(0x36);
_bus->sendData(0x00);
_bus->sendCommand(0x3A);
_bus->sendData(0x66);
delay(50);
_bus->sendCommand(0x11);
delay(50);
_bus->sendCommand(0x29);
}
I have double and triple checked my wiring while avoiding using UART pins.
I cant seem to get my display to do anything. When the backlight is connected to 3v3 it lights up but not if using pin 45 like stated in the code.
I have checked the board with other example sketches and have used two displays and still nothing.
I am not sure if i need to modify the library with my init code from the manufacture. im not sure if my rgb timing is off, or if theres something else im missing.
plz halp.
thanks in advance!