No announcement yet.

Serial Comm Problem with Arduino Due

  • Filter
  • Time
  • Show
Clear All
new posts

  • Serial Comm Problem with Arduino Due

    Serial Comm problem with Arduino Due

    I'm just beginning get to know the Gen4-43DCT-CLB connected to an Arduino Due and so far am unable to get any output at all on any of the hardware serial ports #1, #2 or #3.

    The O-scope shows no activity at all on the Rx or Tx pins for any of the hardware serial ports.

    The display is connected to pc usb using 4D-UPA. 5pin header on 4d_UPA goes to Due. I've been careful not to have usb and 5 pin header connected at the same time. I've also tried connecting the Due using the 4gen-IB board.

    The display starts up and shows the splash screen. I've successfully connected it to WS4 and uploaded the SPE to it. And it responded to commands from Serial Commander.

    I'm using Arduino IDE 1.8.5 and loading sketches Display_print and Big_Demo with only small changes for the reset pin and led. Reset code changed to give a 100ms High-Low-High to the display. Display.println for Flashstring commented out.

    I have the port define as #define DisplaySerial Serial1. (Also tried Serial2 and Serial3).
    Baud rate = 9600.

    Library sourced from Github. Last Commit Aug.2,2018.
    The libraries (Diablo_Serial_4DLib.h and cpp) copied to the IDE's librairies folder and the cpp modified by commenting out the _virtual_flush line.

    The example sketches compile and upload to the Due but with many compile messages. I copied/pasted compile messages into an attached text file. I do not know whether any of these are significant to stop program flow and prevent any serial communication.

    During sketch execution, after reset pin transitions and the 5 sec delay, the mycallback() led is flashing.

    I've loaded up a different sketch to test Rx and TX on the Due hardware ports and they do communicate correctly. Due and Display are being powered by 3A switching regulators.

    Any suggestions to resolve this are appreciated.

    Attached Files

  • #2
    Hello Marcal,

    I do not have an Arduino Due at the moment so I cannot test this.

    Here are a few tips that I could provide through:

    The display is connected to pc usb using 4D-UPA.
    In cases like this, it's best to use the gen4-IB since it's designed to interface the display module to other Host MCUs.

    ..small changes for the reset pin and led. Reset code changed to give a 100ms High-Low-High to the display. Display.println for Flashstring commented out.
    Would it be possible to post these parts of your code?

    Since you've mentioned that the error occurs after the 5-second delay, this could mean that the display and the Due goes out of sync after the reset.

    Best regards,


    • #3

      Thank you Michael,
      Here is my entire modified sketch for Display Serial. As for connection, I have been trying both the 4D-UPA and the gen4-IB in various combinations with a few different sample sketches. I have also tried using the example sketch for visi-genie genie-arduino-demo because it includes a different library.
      May I reiterate what stands out in my mind as a key factor is that my scope shows no activity whatsoever on the serial RX/TX lines. No matter which combination of interface board, example sketch or library used. I don't see even the smallest transition on the Rx/TX pins. As mentioned previously, I have loaded up a sketch which echoes a byte received on one serial port out to a different port and that works fine. That would seem to verify that it is not a hardware defect on the Due.

      It seems a bit far fetched but it's as if the code hangs up within some library function and never reaches a point where it should send out on the serial port. My coding skills are not good enough that I understand the compiler messages but I have to wonder if there isn't a clue within them. They mostly seemed to be about type conversions and redefinitions if that's the right terminology. My gut feel is that I have library problems yet I know there's lots of folks out there using them.

      At one point during testing I substituted the code for mycallback() with code from another user thread. It sent the error msg and # to serial monitor and it always said it was 'timeout'. No matter how long I set the Display.TimeLimit4D= 5000 to. Up to 20 secs.

      As a sidenote, I did briefly try the examples on an Adafruit Feather M0 express w/ RFM69 transceiver. (SAMD21 I think). No serial output on that either. But, that breadboard had a lot of other things connected so I abandoned it and went back to the Due.

      //Simple Demo that demonstrates 'print' and 'println' new functionality.
      #define DisplaySerial Serial1
      #define resetpin 5
      //-------Picaso DISPLAYS-------
      #include <Diablo_Const4D.h>
      #include <Diablo_Serial_4DLib.h>
      //use Serial0 to communicate with the display.
      Diablo_Serial_4DLib Display(&DisplaySerial);
      void setup() {
        //For handling errors
        Display.Callback4D = mycallback ;
        //5 second timeout on all commands  
        Display.TimeLimit4D   = 5000 ;
        DisplaySerial.begin(9600) ;
        //--------------------------------Optional reset routine-----------------------------------
        //Reset the Display using D4 of the Arduino (if using the new 4D Arduino Adaptor - Rev 2)
        //If using the old 4D Arduino Adaptor (Rev 1), change D4 to D2 below.
        //If using jumper wires, reverse the logic states below.
        //Refer to the accompanying application note for important information.
        pinMode(resetpin, OUTPUT);  // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
        digitalWrite(resetpin, 1);  // Reset the Display via D4
        digitalWrite(resetpin, 0);  // unReset the Display via D4
        digitalWrite(resetpin, 1);  // Reset the Display via D4
        delay (5000); //let the display start up  
        //Display.gfx_BGcolour(WHITE) ; //change background color to white
        Display.gfx_Cls();            //clear the screen
        char a = 'A';
        char a2 = 'B';
        int b = 1234;
        int b2 = -1234;
        long c = 123456;
        long c2 = -123456;
        String string = "This is string class";
        char charr[30] = "This is const char array";
        float d = 123.456789;
        float d2 = -123.456789;
        float nan = NAN;
        float inf = INFINITY;
        float ovf1 = 5294967040.0;
        float ovf2 = -5294967040.0;
        uint32_t e = 123 ;  
        unsigned long e2 = 123 ;
        Display.print(a); Display.print(' ');
        Display.print(b); Display.print(' ');
        Display.print(c); Display.print(' ');
        Display.println("This is String");
      //  Display.println(F("This is Flashstring"));  // COMMENT OUT FOR ARDUINO DUE, NOT SUPPORTED
        Display.println(d2, 3);  
      void loop()
      void mycallback(int ErrCode, unsigned char Errorbyte)
        // Pin 13 has an LED connected on most Arduino boards. Just give it a name
      //  int led = 13;
        pinMode(LED_BUILTIN, OUTPUT);
          digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
          delay(200);                // wait for 200 ms
          digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
          delay(200);                // wait for 200 ms


      • #4
        Hi Marcal,

        Can you please check if the Rx/Tx Lines have been swapped?

        At the moment, this is the only cause that I can think of.

        Please note that the Display's Rx pin should connect to the Due's Tx pin and vise versa.

        Best regards,