Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Using Teensy 4 with E-paper Display

  1. #1
    Junior Member
    Join Date
    Dec 2021
    Posts
    12

    Using Teensy 4 with E-paper Display

    I am working on getting an e-paper display from waveshare (4.2 inch Black, White, Red) working with my teensy. This one: https://www.waveshare.com/4.2inch-e-Paper-Module-B.htm

    They support Arduino and they supply code in a gitub repo here: https://github.com/waveshare/e-Paper...uino/epd4in2bc

    I got the Arduino code and wired up the display to by teensy as defined in the code, but I can't seem to get the display to turn on/display anything.

    My wiring images: https://imgur.com/a/fyyBxGv

    I am not sure where to start with debugging.

    Should this work out of the box with Teensy, are there any changes I need to do to the Arduino code to make this work?

    Thanks!

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,811
    This webpage mentions a newer version of the display (V2) which requires an update to the driver. Do you have a V2 board (with V2 sticker on the back)?

    Also, can you provide a photo of the back of your epaper display, showing the wiring?

    Pete

  3. #3
    Junior Member
    Join Date
    Dec 2021
    Posts
    12
    Quote Originally Posted by el_supremo View Post
    This webpage mentions a newer version of the display (V2) which requires an update to the driver. Do you have a V2 board (with V2 sticker on the back)?
    No, I haven't tried the v2 one. I used this because I thought the C at the end was designated for the color version. I will try the other one and report back shortly.

    Quote Originally Posted by el_supremo View Post
    [url=https://www.waveshare.com/wiki/4.2inch_e-Paper_Module_(B)]Also, can you provide a photo of the back of your epaper display, showing the wiring
    Here: https://imgur.com/pocbYux

  4. #4
    Junior Member
    Join Date
    Dec 2021
    Posts
    12
    @el_supremo I tested the V2 code and there is more progress, I am getting stuff on the screen now, but it is still looking broken:
    Here are two pictures. Note, there was some flashing of the screen before it settles on these views. The first one occurred on the first upload and the second after I tried uploading a few more times ( I tried putting the other code one more time before).

    First View: https://imgur.com/KKPd3PC

    Second View: https://imgur.com/fYUqaAX

    Update: It does not seem to change at all from the second view.
    Last edited by lankanmon; 01-15-2022 at 12:12 AM.

  5. #5
    Junior Member
    Join Date
    Dec 2021
    Posts
    12
    Another update. I was not able to get that second view to change after some debugging, so as a sanity check to make sure the display was not broken, I plugged in an Arduino Uno that I had on hand and pushed the v2 code. It started working immediately.

    Here it is working with the Arduino Uno:
    https://imgur.com/A2mippA

    So, whatever is happening is occurring on the Teensy. Is there something in that code that is not supported by the Teensy 4.0, but is supported by the Arduino Uno?

  6. #6
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,811
    I think the problem may be that the T4.0 is much faster than the UNO and can, for example, set the DC pin high or low and send the first byte of command or data much faster than the epaper controller is expecting.

    Other than the horrible noise on the display, I think it is working. It shows a solid red circle, which is the last thing that the example draws. The circle is on top of a filled black rectangle which is drawn just before the circle but it is obviously noisy.

    I'll try to have a look at this sometime today. Meanwhile, which of the example sketches are you using? epd4in2b_V2.ino ?
    If so, in epd4in2b_V2.cpp there's this code:
    Code:
    void Epd::SendCommand(unsigned char command) {
        DigitalWrite(dc_pin, LOW);
        SpiTransfer(command);
    }
    
    /**
     *  @brief: basic function for sending data
     */
    void Epd::SendData(unsigned char data) {
        DigitalWrite(dc_pin, HIGH);
        SpiTransfer(data);
    }
    Add a delay immediately after the digitalWrite and see if that helps.
    Code:
    void Epd::SendCommand(unsigned char command) {
        DigitalWrite(dc_pin, LOW);
        delayMicroseconds(5);
        SpiTransfer(command);
    }
    
    /**
     *  @brief: basic function for sending data
     */
    void Epd::SendData(unsigned char data) {
        DigitalWrite(dc_pin, HIGH);
        delayMicroseconds(5);
        SpiTransfer(data);
    }
    Five microseconds is probably way too much but it's a starting point. If it does help, reduce it to one microsecond and try again.

    Pete

  7. #7
    Junior Member
    Join Date
    Dec 2021
    Posts
    12
    Yes, it was the v2 file that was able to produce a change at all in the above test. However, I just tried using your suggestion and I am still not seeing any changes on the screen when attached to the Teensy. The display does work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •