Weird secondary UART read behaviour



  • I'm testing via usb tty and setting up uart = UART(1, pins=('G23', 'G24')) for use with a gps sensor (edit: or soil sensor).

    When I try to read from this second uart channel in a loop, it seems to buffer the last result until a UART(0) tx.
    I.e.: uart.read() continues to return None until after I hit any key in telnet at which time it reads the buffered result.

    What could be causing this?



  • It doesn't seem related to the actual peripheral device, I'm having exactly the same behaviour shown on a soil monitor over UART1 too...

    Yeah, the ESP8266 only has a single read/write UART as far as I understand but from the ESP32 spec sheet it has multiple full UART channels. It'd be nice if we had a full pin map.
    edit: not exactly related but it seems that using 'G23' pin also causes disables the rgb led and as I had this uart initialization in main.py it also stopped firmware updates from working too... :-|



  • Just for your information: I am seeing a similar thing happening on an ESP8266 (12E) on a Wemos D1 mini board.
    It might be totally unrelated, but the symptoms seem to be the same.

    I am trying to read GPS data from a SoftwareSerial using code like

    SoftwareSerial swSer(0, SW_SERIAL_UNUSED_PIN); // Only use the RX part for receiving GPS data, Note GPIO0 = D3 on Wemos
    
    void setup() 
    {
        Serial.begin(9600);
        swSer.begin(9600);
    }
    
    void loop()
    {
        while (swSer.available())
        {
          yield(); // To give time to the ESP stack
          ser_read = swSer.read();
          // Process received GPS data
        }
    }
    

    I only receive (valid) GPS data when I connect the "real" Serial port (via USB), which I would expect to be independent from the working of the Software Serial port on GPIO0 (D3 on Wemos). I know about the special function of GPIO0 on boot, but the sketch seems to run OK, it just doesn't receive any valid GPS data,

    Probably the ESP32 is quite another beast where the second UARY is a real UART and not a software Serial Port? But the behavior seems similar.

    To complicate matters: this only happens for a certain kind of GPS like this one. Another GPS like this one just always works. The first one only works on a softwareserial port when the real serial (UART) is connected.

    I first tried to use the regular Serial port for reading the GPS data, there thefirst one (red board) seems not be able to pull-down the signal on RX-port of the UART on ESP8266. Also it doesn't matter if I write in the real serial port or not, or leave it completely closed.

    I think Serial1 as mentioned here: https://github.com/esp8266/Arduino/blob/master/doc/reference.md#serial is not usable as it is TX only and thus can't receive GPS data?

    I don't want to hijack your topic, but if the 2 are somehow related this info might help recognize the symptoms.


Log in to reply
 

Pycom on Twitter