Connect ESP32-S3 to the graphics chip BT815Q via SPI

FTDI/Bridgetek EVE2 & EVE3 & EVE4 SPI TFT Series by Matrix Orbital

Moderator: Mods

Post Reply
RobertWood
LCD?
Posts: 5
Joined: Mon Oct 23, 2023 8:52 am

Connect ESP32-S3 to the graphics chip BT815Q via SPI

Post by RobertWood »

Hello there,

I'd like to connect the ESP32-S3 to the BT815Q graphics chip from Bridgetek.

For this, I'm following the instructions in the manual: https://brtchip.com/wp-content/uploads/ ... -Guide.pdf

I'm also referring to the code example for Arduino: https://github.com/MatrixOrbital/EVE3-B ... Eve2_81x.c

I've connected the chip and the monitor via SPI, and I can read the Chip ID. This suggests that the hardware is working correctly.

However, I'm not getting anything more from the display. It doesn't display my image or provide any backlight.

Here's my main:

Code: Select all

void app_main() {
    esp_err_t ret;

    ret = spi_bus_initialize(HSPI_HOST, &buscfg, SPI_DMA_CH_AUTO);
    if (ret != ESP_OK) {
        printf("Fehler bei der Initialisierung des SPI-Busses: %s (Fehlercode: 0x%x)\n", esp_err_to_name(ret), ret);
    }

    spi_device_handle_t spi;
    ret = spi_bus_add_device(HSPI_HOST, &devcfg, &spi);
    if (ret != ESP_OK) {
        printf("Fehler beim Hinzufügen der SPI Geräte: %s\n", esp_err_to_name(ret));
    }

    uint32_t chipID = readChipID(spi);
    printf("Chip ID: 0x%08lx\n", (unsigned long)chipID);

    host_command(spi, HCMD_CLKEXT);  // Host-Befehl "CLKEXT" Alle 5 Registerwerte nicht im DB gefunden
    host_command(spi, CMD_CLKSEL);  // Host-Befehl "CLKSEL"
    host_command(spi, HCMD_ACTIVE);  // Host-Befehl "ACTIVE"
    host_command(spi, CMD_RST_PULSE);  // Host-Befehl "RST_PULSE"
    while (0x0 != rd16(spi, REG_CPURESET));  //Check if EVE is in working status.

   // wr32(REG_FREQUENCY, 0x3938700, spi); //aus beispielcode
    wr32(REG_FREQUENCY + RAM_REG, 0x3938700, spi); // Configure the system clock to 60MHz - aus arduiinocode

    wr16(REG_HCYCLE, 928, spi); //Alle Registerwerte im Datenblatt nachgewiesen
    wr16(REG_HOFFSET, 88, spi);
    wr16(REG_HSYNC0,   0, spi);
    wr16(REG_HSYNC1,  48, spi);
    wr16(REG_VCYCLE, 525, spi);
    wr16(REG_VOFFSET, 32, spi);
    wr16(REG_VSYNC0,   0, spi);
    wr16(REG_VSYNC1,   3, spi);
    wr8(REG_SWIZZLE,   0, spi);
    wr8(REG_PCLK_POL,  1, spi);
    wr8(REG_CSPREAD,   0, spi);
    wr16(REG_HSIZE,  480, spi);
    wr16(REG_VSIZE,  272, spi);

    /* Write first display list to display list memory RAM_DL*/
    wr32(RAM_DL+0,CLEAR_COLOR_RGB(0,0,0), spi);
    wr32(RAM_DL+4,CLEAR(1,1,1), spi);
    wr32(RAM_DL+8,DISPLAY(), spi);
    wr8(REG_DLSWAP,0x02, spi);//display list swap

    wr8(REG_DLSWAP,0x02, spi);//display list swap
    /* Enable backlight of display panel */
    wr16(REG_GPIOX_DIR, 0xffff, spi);
    wr16(REG_GPIOX, 0xffff, spi);

    wr8(REG_PCLK,2, spi);    

    wr32(RAM_DL + 0, CLEAR(1, 1, 1), spi); // clear screen
    wr32(RAM_DL + 4, BEGIN(BITMAPS), spi); // start drawing bitmaps
    wr32(RAM_DL + 8,  VERTEX2II(220, 110, 31, 'T'), spi); // ASCII T in font 31
    wr32(RAM_DL + 12, VERTEX2II(244, 110, 31, 'E'), spi); // ASCII E in font 31
    wr32(RAM_DL + 16, VERTEX2II(270, 110, 31, 'X'), spi); // ASCII X in font 31
    wr32(RAM_DL + 20, VERTEX2II(299, 110, 31, 'T'), spi); // ASCII T in font 31
    wr32(RAM_DL + 24, END(), spi);
    wr32(RAM_DL + 28, COLOR_RGB(160, 22, 22), spi); // change colour to red
    wr32(RAM_DL + 32, POINT_SIZE(320), spi); // set point size to 20 pixels in radius
    wr32(RAM_DL + 36, BEGIN(POINTS), spi); // start drawing points
    wr32(RAM_DL + 40, VERTEX2II(192, 133, 0, 0), spi); // red point
    wr32(RAM_DL + 44, END(), spi);
    wr32(RAM_DL + 48, DISPLAY(), spi); // display the image

    spi_bus_remove_device(spi);
    spi_bus_free(HSPI_HOST);
}

I'm attaching the complete file and the header file for reference.
Attachments
EVE81X.h
(19.73 KiB) Downloaded 2412 times
spi_master_example_main.c
(9.87 KiB) Downloaded 2437 times

Henry
OMNIPRESENT
OMNIPRESENT
Posts: 3002
Joined: Tue Aug 14, 2001 6:00 pm
Contact:

Re: Connect ESP32-S3 to the graphics chip BT815Q via SPI

Post by Henry »

Hello,

Please provide the EVE display you are trying to interface.

Thank you!
Henry J.
President
Matrix Orbital

RobertWood
LCD?
Posts: 5
Joined: Mon Oct 23, 2023 8:52 am

Re: Connect ESP32-S3 to the graphics chip BT815Q via SPI

Post by RobertWood »

Hey,
Thanks for the quick reply.

I would like to operate the following display:

https://riverdi.com/product/ritft43capux

RobertWood
LCD?
Posts: 5
Joined: Mon Oct 23, 2023 8:52 am

Re: Connect ESP32-S3 to the graphics chip BT815Q via SPI

Post by RobertWood »

I have another question related to the topic:

I couldn't find any information in the datasheet about how to interpret the data from the MISO line.

I'm sending the following command to the chip:

wr32(REG_FREQUENCY + RAM_REG, 0x3938700, spi); // Configure the system clock to 60MHz

When I check this on the digital oscilloscope, I get the following data on the lines:

MOSI: 0x00 0x20 0x30 0x02 0x19

MISO: 0x00 0x4a 0x4d 0x08 0x00

I would greatly appreciate it if someone could tell me where to find out what the response means.

Raquel
Matrix Orbital
Matrix Orbital
Posts: 805
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Re: Connect ESP32-S3 to the graphics chip BT815Q via SPI

Post by Raquel »

Hello Robert,

Unfortunately the data you shared do not seem to make sense.
wr32 (REG_FREQUENCY + RAM_REG) I am expecting 0x30 0x20 0x0C 0x00 on MISO
and if you are not actually trying to read, I do not think you should be interpreting the MISO line.
You might want to check with EVE forum.

I see that you were able to read the Chip ID, are the MOSI and MISO data showing up properly for you?

Thank you,
Raquel Malinis
Design and Development
Matrix Orbital

RobertWood
LCD?
Posts: 5
Joined: Mon Oct 23, 2023 8:52 am

Re: Connect ESP32-S3 to the graphics chip BT815Q via SPI

Post by RobertWood »

Hey,

Thank you, Raquel, for your response.

I've since resolved my issues and made significant revisions to the code provided.

My assumption that I could read the Chip ID was incorrect. The BT815Q writes some data to the MISO line during the write process from the master, and this data can be discarded.

Additionally, my code was missing consideration for the prefixes for write, read, and host commands. Once you take that into account, you can control the display.

RobertWood
LCD?
Posts: 5
Joined: Mon Oct 23, 2023 8:52 am

Re: Connect ESP32-S3 to the graphics chip BT815Q via SPI

Post by RobertWood »

Hey guys, I have the problem that the BT815 has stopped "talking" to me.

If I want to query the ChipID after restarting the system, there is no longer an answer on the MISO line.

Previously I connected an Arduino Mega to the monitor using this library:

https://github.com/MatrixOrbital/EVE3-B ... Eve2_81x.c

Most likely I set the PIN configuration incorrectly, so that the BT815 did not receive a definable SPI signal and thus ended up in some unknown state. Is this possible?

When I connect the Arduino, the background lighting on the display still comes on. I cannot evaluate the transmitted data.

When I connect my ESP32, I no longer get a response on the MISO line.

I would be very grateful for quick troubleshooting ideas.

Post Reply