PervasiveDisplays / EPD_Driver_GU_small

Hardware driver for small-sized screens, with built-in images for test
17 stars 5 forks source link

Support of SE2213JS0C1 #3

Open JKBert opened 1 year ago

JKBert commented 1 year ago

Hello,

I'm trying to write a driver for SE2213JS0C1 in pure C. I have downloaded ApplicationNote_Small_Size_Spectra_v06_220606.pdf from Pervasive Displays web pages. My driver doesn't run as expected (I'm sure that display receives data from CPU as BUSY line status changes). No image is displayed. Thus, I have downloaded this driver to verify mine.

I don't know if documentation is faulty or if this driver cannot work as expected. I cannot test this driver as I don't have required hardware.

For example:

What are true PSR values ? And is CS# pulse mandatory between data bytes ?

Best regards,

JB

PS: my code (that doesn't run) gpio_on/off switches gpio output. gpio_status reads gpio status.

static void
epaper_isbusy()
{
    uint32_t h;
    h = get_25Hz();

    while(gpio_status(&gpios[gpio_epaper_busy]) == 0);
    printf("%f s\n", (get_25Hz() - h) / 25.);

    return;
}

static void
epaper_send8(bool cmd, uint8_t octet)
{
    if (cmd == true)
    {
        gpio_off(&gpios[gpio_epaper_dc]);
    }
    else
    {
        gpio_on(&gpios[gpio_epaper_dc]);
    }

    spi_select_device(dev_epaper);
    spi_send8(octet);
    spi_select_device(dev_none);

    gpio_on(&gpios[gpio_epaper_dc]);
    return;
}

void
epaper_power(bool etat)
{
    mutex_lock(&mutex_spi);
    gpio_off(&gpios[gpio_epaper_bs]);

    if (etat == true)
    {
        spi_select_device(dev_epaper);

        gpio_on(&gpios[gpio_epaper_dc]);
        gpio_on(&gpios[gpio_epaper_powerswitch]);
        task_sleep(5);
        gpio_on(&gpios[gpio_epaper_reset]);
        task_sleep(5);
        gpio_off(&gpios[gpio_epaper_reset]);
        task_sleep(10);
        gpio_on(&gpios[gpio_epaper_reset]);
        task_sleep(5);

        spi_select_device(dev_none);

        // Soft reset : 0x0E dans le registre 0x00
        epaper_send8(true, 0x00);
        epaper_send8(false, 0x0E);
        epaper_isbusy();

        // Température
        epaper_send8(true, 0xE5);
        epaper_send8(false, 20);
        epaper_send8(true, 0xE0);
        epaper_send8(false, 0x02);

        // Configuration du panneau
        epaper_send8(true, 0x00);
        epaper_send8(false, 0xCF);
        // $89 dans la doc, $8D dans le driver !
        epaper_send8(false, 0x89);

        debug("ePaper on");
    }
    else
    {
        gpio_off(&gpios[gpio_epaper_powerswitch]);
        debug("ePaper off");
    }

    mutex_unlock(&mutex_spi);

    return;
}

// Longueur trame : 2756 octets
void
epaper_test()
{
    uint16_t    i;

    mutex_lock(&mutex_spi);

    debug("Sending frame 1");
    epaper_send8(true, 0x10);

    for(i = 0; i < 2756; i++)
    {
        epaper_send8(false, 0xBB);
    }

    debug("Sending frame 2");
    epaper_send8(true, 0x13);

    for(i = 0; i < 2756; i++)
    {
        epaper_send8(false, 0);
    }

    // Busy
    debug("frames sent: wait while busy");
    epaper_isbusy();

    // Power on command
    epaper_send8(true, (uint8_t) 0x04);
    epaper_send8(false, (uint8_t) 0x00);
    debug("power on command: wait while busy");
    epaper_isbusy();

    // Display refresh
    epaper_send8(true, (uint8_t) 0x12);
    epaper_send8(false, (uint8_t) 0x00);
    debug("refresh: wait while busy");
    epaper_isbusy();

    // Power off command
    epaper_send8(true, (uint8_t) 0x02);
    debug("power off command: wait while busy");
    epaper_isbusy();

    mutex_unlock(&mutex_spi);
    return;
}

Output on serial console:

[15407] ePaper on
[15407] Sending frame 1
[15412] Sending frame 2
[15417] frames sent: wait while busy
9.680000 s
[15659] power on command: wait while busy
0.000000 s
[15659] refresh: wait while busy
0.000000 s
[15659] power off command: wait while busy
0.000000 s
[15672] ePaper off
3.040000 s
[15748] ePaper on
[15748] Sending frame 1
[15753] Sending frame 2

Please note that returned values are identical from a run to another one (9,68 s and 3,04 s). But these values change with another display (7,68 s and 3,00 s).

JKBert commented 1 year ago

Same constatation. EPD_Driver::_displayRefresh() and EPD_Driver::_DCDC_powerOn() send null data after register. In documentation, there is no data.

rei-vilo commented 1 year ago

I would strongly suggest you to start with the PDLS_EXT3_Basic library and the EXT3 or EXT3-1 board on one of the many boards supported by the Arduino SDK and IDE.

Then you can migrate to your own library and finally to your own board, after validating each step.

Also, a logic analyser could help.

JKBert commented 1 year ago

Thanks for your answer, but even I use an Arduino or some other dev boards, that DOESN'T EXPLAIN the major differences between this driver and the official documentation. My initial question is : this driver and official documentation don't contain the same protocol. Which protocol is known to drive my display ?