Announcement

Collapse
No announcement yet.

ESP8266 serial not receiving

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ESP8266 serial not receiving

    Hello all,

    I am trying to read in a serial line from an xbee using an ESP8266. The problem I'm having is that the ESP8266 is transmitting just fine but will not receive. I am proving this to myself by printing a debug message to the serial port. The confusing thing is that the debug message is showing up on the ESP8266 Rx line and nothing is happening on the Tx line. Guaranteed I'm doing something dumb but I've been staring at it too long now to find it. Thanks for providing fresh eyes!

    Code and pic of setup below

    Code:
    #include "ESP8266WiFi.h"
    #include "GFX4d.h"
    
    GFX4d gfx = GFX4d();
    
    #include "weathervane_serial_2Const.h" // Note. This file will not be created if there are no generated graphics
    
    #include "SoftwareSerial.h"
    
    int direction = 0;
    int speed = 0;
    
    void setup()
    {
    gfx.begin();
    gfx.Cls();
    gfx.ScrollEnable(false);
    gfx.BacklightOn(true);
    gfx.Orientation(LANDSCAPE); // Change manually if the orientation change
    gfx.SmoothScrollSpeed(5);
    gfx.TextColor(WHITE, BLACK); gfx.Font(2); gfx.TextSize(1);
    gfx.Open4dGFX("WEATHE~1"); // Opens DAT and GCI files for read using filename without extension.
    // Note! Workshop generates files with Short filenames
    gfx.UserImage(iLeddigits1); // Leddigits1 show all digits at 0, only do this once
    gfx.UserImage(iLeddigits2); // Leddigits2 show all digits at 0, only do this once
    
    Serial.begin(115200, SERIAL_8N1); // initialize serial:
    }
    
    void loop()
    {
    if (Serial.available() > 0) // did anything show up in the buffer?
    {
    speed = Serial.read() - 48; // read the data in the buffer and write it to variable "speed"
    gfx.LedDigitsDisplay(speed, iiLeddigits1, 3, 1, 92, 0); // Leddigits1
    gfx.LedDigitsDisplay(speed, iiLeddigits2, 2, 1, 76, 0); // Leddigits2
    Serial.println(speed);
    delay(1000);
    }
    
    // test section to put something on the serial transmit line. lets alos view it on the display
    speed = 14;
    gfx.LedDigitsDisplay(speed, iiLeddigits1, 3, 1, 92, 0); // Leddigits1
    gfx.LedDigitsDisplay(speed, iiLeddigits2, 2, 1, 76, 0); // Leddigits2
    Serial.println(speed);
    delay(1000);
    
    speed = 7;
    gfx.LedDigitsDisplay(speed, iiLeddigits1, 3, 1, 92, 0); // Leddigits1
    gfx.LedDigitsDisplay(speed, iiLeddigits2, 2, 1, 76, 0); // Leddigits2
    Serial.println(speed);
    delay(1000);
    
    yield(); // Required for ESP
    }
    Attached Files

  • #2
    Hi,

    The UPA when connected to the IoD has the USB to Serial IC connected to Rx & TX and can affect communications. Ideally when using the gen4-IoD with a serial connection it is better to use a 10 way FFC breakout board similar to this,

    https://www.amazon.co.uk/sourcing-ma.../dp/B07RS3KWZ3

    The code you posted above will work without the UPA being attached.

    I hope this helps

    Best regards

    Paul

    Comment


    • #3
      Awesome. Break board is on its way. Ill let you know how it works!

      Comment


      • #4
        This is the fix for anyone who finds this in the future. You cannot use the serial breakouts on the UPA if it is powered (which it usually is in in order to power the screen). When powered, the USB to TTL converter will be active and interfere with the lines. There are no notes anywhere in The UPA documentation about this conflict (looking at you 4D 🤨). In fact I’m a little confused as to why the UPA board exposes these pins at all? Making them available implies they should just work. Easy and cheap fix though. Buy the breakout board mentioned above, plug it in, and like magic, two weeks of frustration will disappear.

        Comment


        • #5
          Good day!

          In fact I’m a little confused as to why the UPA board exposes these pins at all? Making them available implies they should just work.
          Apologies if breaking out the pins in the 4D-UPA led you to assume you can use it to communicate with the gen4-IoD. But let me explain why the TX and RX pins were broken out.

          The UPA in 4D-UPA stands for 'Universal Programming Adaptor'. As quoted from the product page, it is described as "Universal Programming Adaptor for IoD-09, gen4 Display Modules and uLCD-Display Modules for connecting module to a computer using a microUSB Cable"

          As you might have realized from this, the intended purpose of the 4D-UPA is to program 4D displays. This takes priority in the product's design. If you've noticed, the 5-way interface is labeled uLCD/uOLED.which is meant to tell users that the pins are for programming the display under this category.

          However, in response to your comments, I decided to write a short article which you can find here: Can I use 4D-UPA/gen4-PA to connect another device to the display module?

          I hope this helps clear things up with you and other customers that might have the same thoughts about the product.

          Best Regards
          Juniel Cruz

          Comment


          • #6
            Hi Juniel,

            Much appreciated. This will certainly help clear things up for future users. Of course I completely understand that the primary purpose of the UPA is for programming the board, not for using it as a serial breakout. But Im still confused then why the RX and TX would be broken out at all if they shouldn't be used?

            Comment


            • #7
              Hi there,

              Originally posted by 89inerEcho View Post
              But Im still confused then why the RX and TX would be broken out at all if they shouldn't be used?
              I think I mentioned the reason it is broken out.

              Originally posted by Juniel Cruz View Post
              If you've noticed, the 5-way interface is labeled uLCD/uOLED which is meant to tell users that the pins are for programming the display under this category.
              Simply put, the product wont be a 4D Universal Programming Adaptor if it can't be used to program these product line.

              I hope that makes sense.

              Kind Regards
              Juniel Cruz

              Comment

              Working...
              X