pschatzmann/pico-arduino

HardwareSerial Baud rate problem

mentalfl0w opened this issue · 18 comments

I have meet a baud rate problem, even if I set rate to 115200, it wouldn't work on the exact rate, but work in a random rate.
Some times I can communicate with esp8266 successfully, but commonly it will failed with ERROR or simply no response(shows like timeout).
SoftwareSerial works well.
image

Hmm that's strange and I am not sure how to deal with this:

Maybe it is a Hardware issue

  • Did you check if the issue persists if you use other pins ?
  • You could also try to switch from UART0 to UART1 ?

If 115200 is not reliable you could also try to decrease the speed.
If you check in my PicoHardwareSerial class, I am setting the baud rate with uart_init. Maybe it make a difference to call
uart_set_baudrate (uart_inst_t *uart, uint baudrate) as well...

I looked at your sketch again and the following is confusing me:
blink.start(blink_callback, -1000);
reset.start(reset_callback, -20);
The negative numbers are confusing me. I would have expected a positive time and I have no clue what the impact is.
I would suggest to comment this out or at least use positive numbers and change them to e.g. 1000 and 500

I looked at your sketch again and the following is confusing me:
blink.start(blink_callback, -1000);
reset.start(reset_callback, -20);
The negative numbers are confusing me. I would have expected a positive time and I have no clue what the impact is.
I would suggest to comment this out or at least use positive numbers and change them to e.g. 1000 and 500

Hello,
I use negative number because the official pico timer periodic example says it means the exact delay, and I view your code about the TimerAlarmRepeating class's start func, found that it's a encapsulation of official api.
image

BTW, I used SoftwareSerial in the UART1 Pin and it works well, so weird.

Here is my code(use swSerial):

#include <stdio.h>
#include "pico/stdlib.h"
#include "pico/bootrom.h"
#include "Arduino.h"
#include "esp8266/WiFiEsp.h"
#include "SoftwareSerial.h"

bool active;
const uint RESET_PIN = 28;
TimerAlarmRepeating blink, reset;
WiFiEspClient net;
SoftwareSerial SwSerial; // RX, TX
unsigned long lastMillis = 0;
char ssid[] = "";    // your network SSID (name)
char pass[] = "";   // your network password
int status = WL_IDLE_STATUS; // the Wifi radio's status

char server[] = "arduino.cc";

bool blink_callback(repeating_timer_t *t)
{
  active = !active; // toggle state
  digitalWrite(LED_BUILTIN, active);
  //printf("Blinked!\n");
  return true;
}

bool reset_callback(repeating_timer_t *t)
{
  if (digitalRead(RESET_PIN) == 0)
  {
    reset_usb_boot(0, 0);
  }
  return true;
}

void printWifiStatus();

void setup()
{
  stdio_init_all();
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(RESET_PIN, INPUT_PULLUP);
  pinMode(GP2, OUTPUT);
  blink.start(blink_callback, -1000);
  reset.start(reset_callback, -20);
  sleep_ms(5000);
  digitalWrite(GP2, 0);
  sleep_ms(1000);
  digitalWrite(GP2, 1);
  sleep_ms(5000);
  SwSerial.begin(115200, GP0, GP1);
  WiFi.init(&SwSerial);
  // check for the presence of the shield
  if (WiFi.status() == WL_NO_SHIELD)
  {
    Serial.println("WiFi shield not present");
    // don't continue
    while (true)
      ;
  }

  // attempt to connect to WiFi network
  while (status != WL_CONNECTED)
  {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network
    status = WiFi.begin(ssid, pass);
  }

  // you're connected now, so print out the data
  Serial.println("You're connected to the network");

  printWifiStatus();

  Serial.println();
  Serial.println("Starting connection to server...");
  // if you get a connection, report back via serial
  if (net.connect(server, 80)) {
    Serial.println("Connected to server");
    // Make a HTTP request
    net.println("GET /asciilogo.txt HTTP/1.1");
    net.println("Host: arduino.cc");
    net.println("Connection: close");
    net.println();
  }
}

void loop()
{
}

void printWifiStatus()
{
  // print the SSID of the network you're attached to
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength
  long rssi = WiFi.RSSI();
  Serial.print("Signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

Due to the version of my esp8266 module software, I have to use this old WiFiEsp lib, but it works well for me.

I had the ESP01 on my TODO list as well and started to look into it.
I am totally confused: I connected it to a FTDI and it took me quite some time to figure out what's working. First I thought the Module is broken until I changed the Terminal Emulation. Only with the Arduino Serial Monitor it seems to be working.
Most other programs were failing.

I am still trying to figure out how to get it more reliable.

The issue with the HardwareSerial has been corrected: I just needed to overwrite the print and println method.
I also added an working example for the ESP01: https://github.com/pschatzmann/pico-arduino/tree/main/examples/esp01

Please note that the latest release contains the following Breaking Changes
- Changed signature of SoftwareSerial.begin() by switching the tx and rx sequence to be consistent with HardwareSerial
- Removed unnecessary subfolders in ArduinoCore-Pico

The issue with the HardwareSerial has been corrected: I just needed to overwrite the print and println method.
I also added an working example for the ESP01: https://github.com/pschatzmann/pico-arduino/tree/main/examples/esp01

Please note that the latest release contains the following Breaking Changes

  • Changed signature of SoftwareSerial.begin() by switching the tx and rx sequence to be consistent with HardwareSerial
  • Removed unnecessary subfolders in ArduinoCore-Pico

Great work!
I tested the Serial2, which works fine now, but Serial1 is as usual, maybe it also needs to be corrected.

The issue with the HardwareSerial has been corrected: I just needed to overwrite the print and println method.
I also added an working example for the ESP01: https://github.com/pschatzmann/pico-arduino/tree/main/examples/esp01
Please note that the latest release contains the following Breaking Changes

  • Changed signature of SoftwareSerial.begin() by switching the tx and rx sequence to be consistent with HardwareSerial
  • Removed unnecessary subfolders in ArduinoCore-Pico

Great work!
I tested the Serial2 is working fine now, but Serial1 is as usual, maybe it also needs to be corrected.

BTW, I find the Serial2.println() is not work, but print works well.

The issue with the HardwareSerial has been corrected: I just needed to overwrite the print and println method.
I also added an working example for the ESP01: https://github.com/pschatzmann/pico-arduino/tree/main/examples/esp01
Please note that the latest release contains the following Breaking Changes

  • Changed signature of SoftwareSerial.begin() by switching the tx and rx sequence to be consistent with HardwareSerial
  • Removed unnecessary subfolders in ArduinoCore-Pico

Great work!
I tested the Serial2 is working fine now, but Serial1 is as usual, maybe it also needs to be corrected.

BTW, I find the Serial2.println() is not work, but print works well.

There is a weird problem when I use Serial2 to connect ESP01, it will shows timeout even if it successfully connected to server :
image
Using SoftwareSerial wouldn't has this problem.

Serial1 and Serial2 are using the same class implementation:

PicoHardwareSerial Serial1(0);
PicoHardwareSerial Serial2(1);

The only difference is the uart_no and the pins, try to change the pins and it might start to work.
Let me overwrite the println() w/o arguments as well to get that performance hit out of the way as well....

Committed. If this does not help I am afraid you will need to play around with the timeout settings in the library...

Committed. If this does not help I am afraid you will need to play around with the timeout settings in the library...

I find it has an obvious delay on Serials, especially in Serial1.
The Serial2 has a bit delay, but SoftwareSerial uses the same pins doesn't has the delay.
Maybe it need to overwrite the read func like read() and etc. ?
Because the hardware uart works well in micropython.
Or it is a Pico C SDK bug?
I viewed the official uart example and the hardware/uart.h, didn't find any problems.
So weird.

Have you activated the logging ? I am printing the requested and the actually set baud rate in the log.
You can activate the logger with

  • Logger.begin(Serial,PicoLogger::Info);

Maybe you can review my implementation of HardwareSerial.
A second eye might catch something I am overseeing...

  • Logger.begin(Serial,PicoLogger::Info);

I activate it just now, it shows:

20:27:27.101 -> begin 115200
20:27:27.101 -> setupDefaultRxTxPins
20:27:27.101 -> Using UART:  0
20:27:27.101 -> txPin is  0
20:27:27.101 -> rxPin is  1
20:27:27.101 -> set_config
20:27:27.101 -> SERIAL_8N1 - UART_PARITY_NONE
20:27:27.101 -> baud_rate requested: 115200
20:27:27.101 -> baud_rate effective: 115207
20:27:27.101 -> [WiFiEsp] Initializing ESP module
20:27:30.552 -> [WiFiEsp] Initilization successful - 1.5.4
20:27:30.552 -> WiFi shield not present
20:27:30.552 -> 

When I open the WiFiEsp debug log, it shows:

20:30:01.405 -> begin 115200
20:30:01.405 -> setupDefaultRxTxPins
20:30:01.405 -> Using UART:  0
20:30:01.405 -> txPin is  0
20:30:01.405 -> rxPin is  1
20:30:01.405 -> set_config
20:30:01.405 -> SERIAL_8N1 - UART_PARITY_NONE
20:30:01.405 -> baud_rate requested: 115200
20:30:01.405 -> baud_rate effective: 115207
20:30:01.405 -> [WiFiEsp] Initializing ESP module
20:30:01.440 -> > wifiDriverInit
20:30:01.440 -> eg⸮⸮�W��⸮⸮⸮ձ⸮I⸮Q⸮A⸮⸮⸮5
20:30:01.440 -> ERROR
 1

20:30:01.440 -> ERROR
20:30:01.440 -> set_config

20:30:01.440 -> ERROR
20:30:01.440 -> SERIAL_8N1 - UART_PARITY_NONE

20:30:01.440 -> ERROR
20:30:01.440 -> baud_rate requested: 115200

20:30:01.440 -> baud_rate effective: 115207

20:30:01.440 -> busy p...
20:30:01.440 -> [WiFiEsp] Initializing ESP modul
20:30:01.440 -> ERROR
20:30:01.440 -> e

20:30:01.440 -> ERROR
20:30:01.440 -> > wifiDriverInit

20:30:01.440 -> ERROR
20:30:01.440 -> eg⸮⸮�W��⸮⸮⸮ձ⸮I⸮Q⸮A⸮⸮⸮5

20:30:01.440 -> ERROR
20:30:01.440 -> ERROR
 1


20:30:01.440 -> ERROR
20:30:01.440 -> ERROR

20:30:01.440 -> ERROR
20:30:01.440 -> set_config


20:30:01.440 -> ERROR
20:30:01.440 -> ERROR

20:30:01.440 -> ERROR
20:30:01.440 -> SERIAL_8N1 - UART_PARITY_NONE


20:30:01.474 -> ERROR
20:30:01.474 -> ERROR

20:30:01.474 -> ERROR
20:30:01.474 -> baud_rate requested: 115200


20:30:01.474 -> baud_rate effective: 115207


20:30:01.474 -> busy p...
20:30:01.474 -> busy p...

20:30:01.474 -> busy p...
20:30:01.474 -> [WiFiE
20:30:01.474 -> ERROR
20:30:01.474 -> sp] Initializing ESP modul

20:30:01.474 -> ERROR
20:30:01.474 -> ERROR

20:30:01.474 -> ERROR
20:30:01.474 -> e


20:30:01.474 -> ERROR
20:30:01.474 -> ERROR

20:30:01.474 -> ERROR
20:30:01.474 -> > wifiDriverInit


20:30:01.474 -> ERROR
20:30:01.474 -> ERROR

20:30:01.474 -> ERROR
20:30:01.474 -> eg⸮⸮�W��⸮⸮⸮ձ⸮I⸮Q⸮A⸮⸮⸮5


20:30:01.474 -> ERROR
20:30:01.474 -> ERROR

20:30:01.474 -> ERROR
20:30:01.474 -> ERROR
 1



20:30:01.474 -> ERROR
20:30:01.474 -> ERROR

20:30:01.474 -> ERROR
20:30:01.474 -> ERROR


20:30:01.474 -> ERROR
20:30:01.474 -> ERROR

20:30:01.474 -> ERROR
20:30:01.474 -> set_config



20:30:01.511 -> ERROR
20:30:01.511 -> ERROR

20:30:01.511 -> ERROR
20:30:01.511 -> ERROR


20:30:01.511 -> ERROR
20:30:01.511 -> ERROR

20:30:01.511 -> ERROR
20:30:01.511 -> SERIAL_8N1 - UART_PARITY_NONE



20:30:01.511 -> ERROR
20:30:01.511 -> ERROR

20:30:01.511 -> ERROR
20:30:01.511 -> ERROR


20:30:01.511 -> ERROR
20:30:01.511 -> ERROR

20:30:01.511 -> ERROR
20:30:01.511 -> baud_rate requested: 115200



20:30:01.511 -> baud_rate effective: 115207



20:30:01.511 -> busy p...
20:30:01.511 -> busy p..
20:30:01.511 -> ERROR
20:30:01.511 -> .

20:30:01.511 -> ERROR
20:30:01.511 -> busy p...


20:30:01.511 -> ERROR
20:30:01.511 -> busy p...

20:30:01.511 -> ERROR
20:30:01.511 -> [WiFiE

20:30:01.511 -> ERROR
20:30:01.511 -> ERROR

20:30:01.511 -> ERROR
20:30:01.511 -> sp] Initializing ESP modul


20:30:01.511 -> ERROR
20:30:01.511 -> ERROR

20:30:01.511 -> ERROR
20:30:01.511 -> ERROR


20:30:01.511 -> ERROR
20:30:01.511 -> ERROR

20:30:01.511 -> ERROR
20:30:01.511 -> e



20:30:01.511 -> ERROR
20:30:01.511 -> ERROR

20:30:01.511 -> ERROR
20:30:01.544 -> ERROR


20:30:01.544 -> ERROR
20:30:01.544 -> ERROR

20:30:01.544 -> ERROR
20:30:01.544 -> > wifiDriverInit



20:30:01.544 -> ERROR
20:30:01.544 -> ERROR

20:30:01.544 -> ERROR
20:30:01.544 -> ERROR


20:30:01.544 -> ERROR
20:30:01.544 -> ERROR

20:30:01.544 -> ERROR
20:30:01.544 -> eg⸮⸮�W��⸮⸮⸮ձ⸮I⸮Q⸮A⸮⸮⸮5



20:30:01.544 -> ERROR
20:30:01.544 -> ERROR

20:30:01.544 -> ERROR
20:30:01.544 -> ERROR


20:30:01.544 -> ERROR
20:30:01.544 -> ERROR

20:30:01.544 -> ERROR
20:30:01.544 -> ERROR
 1




20:30:01.544 -> ERROR
20:30:01.544 -> ERROR

20:30:01.544 -> ERROR
20:30:01.544 -> ERROR


20:30:01.544 -> ERROR
20:30:01.544 -> ERROR

20:30:01.544 -> ERROR
20:30:01.544 -> ERROR



20:30:01.544 -> ERROR
20:30:01.544 -> ERROR

20:30:01.544 -> ERROR
20:30:01.544 -> ERROR


20:30:01.544 -> ERROR
20:30:01.544 -> ERROR

20:30:01.544 -> ERROR
20:30:01.544 -> set_config




20:30:01.544 -> ERROR
20:30:01.544 -> ERROR

20:30:01.544 -> ERROR
20:30:01.544 -> ERROR


20:30:01.544 -> ERROR
20:30:01.581 -> ERROR

20:30:01.581 -> ERROR
20:30:01.581 -> ERROR



20:30:01.581 -> ERROR
20:30:01.581 -> ERROR

20:30:01.581 -> ERROR
20:30:01.581 -> ERROR


20:30:01.581 -> ERROR
20:30:01.581 -> ERROR

20:30:01.581 -> ERROR
20:30:01.581 -> SERIAL_8N1 - UART_PARITY_NONE




20:30:01.581 -> ERROR
20:30:01.581 -> ERROR

20:30:01.581 -> ERROR
20:30:01.581 -> ERROR


20:30:01.581 -> ERROR
20:30:01.581 -> ERROR

20:30:01.581 -> ERROR
20:30:01.581 -> ERROR



20:30:01.581 -> ERROR
20:30:01.581 -> ERROR

20:30:01.581 -> ERROR
20:30:01.581 -> ERROR


20:30:01.581 -> ERROR
20:30:01.581 -> ERROR

20:30:01.581 -> ERROR
20:30:01.581 -> baud_rate requested: 115200




20:30:01.581 -> baud_rate effective: 115207




20:30:01.581 -> busy p...
20:30:01.581 -> busy 
20:30:01.581 -> ERROR
20:30:01.581 -> p...

20:30:01.581 -> ERROR
20:30:01.581 -> busy p..

20:30:01.581 -> ERROR
20:30:01.581 -> ERROR

20:30:01.581 -> ERROR
20:30:01.581 -> .


20:30:01.581 -> ERROR
20:30:01.581 -> ERROR

20:30:01.581 -> ERROR
20:30:01.581 -> busy p...



20:30:01.581 -> ERROR
20:30:01.581 -> ERROR

20:30:01.581 -> ERROR
20:30:01.618 -> busy p...


20:30:01.618 -> ERROR
20:30:01.618 -> ERROR

20:30:01.618 -> ERROR
20:30:01.618 -> [WiFiE


20:30:01.618 -> ERROR
20:30:01.618 -> ERROR

20:30:01.618 -> ERROR
20:30:01.618 -> ERROR


20:30:01.618 -> ERROR
20:30:01.618 -> ERROR

20:30:01.618 -> ERROR
20:30:01.618 -> sp] Initializing ESP modul



20:30:01.618 -> ERROR
20:30:01.618 -> ERROR

20:30:01.618 -> ERROR
20:30:01.618 -> ERROR


20:30:01.618 -> ERROR
20:30:01.618 -> ERROR

20:30:01.618 -> ERROR
20:30:01.618 -> ERROR



20:30:01.618 -> ERROR
20:30:01.618 -> ERROR

20:30:01.618 -> ERROR
20:30:01.618 -> ERROR


20:30:01.618 -> ERROR
20:30:01.618 -> ERROR

20:30:01.618 -> ERROR
20:30:01.618 -> e




20:30:01.618 -> ERROR
20:30:01.618 -> ERROR

20:30:01.618 -> ERROR
20:30:01.618 -> ERROR


20:30:01.618 -> ERROR
20:30:01.618 -> ERROR

20:30:01.618 -> ERROR
20:30:01.618 -> ERROR



20:30:01.618 -> ERROR
20:30:01.618 -> ERROR

20:30:01.618 -> ERROR
20:30:01.618 -> ERROR


20:30:01.618 -> ERROR
20:30:01.618 -> ERROR

20:30:01.618 -> ERROR
20:30:01.618 -> > wifiDriverInit




20:30:01.618 -> ERROR
20:30:01.618 -> ERROR

20:30:01.618 -> ERROR
20:30:01.618 -> ERROR


20:30:01.618 -> ERROR
20:30:01.618 -> ERROR

20:30:01.618 -> ERROR
20:30:01.651 -> ERROR



20:30:01.651 -> ERROR
20:30:01.651 -> ERROR

20:30:01.651 -> ERROR
20:30:01.651 -> ERROR


20:30:01.651 -> ERROR
20:30:01.651 -> ERROR

20:30:01.651 -> ERROR
20:30:01.651 -> eg⸮⸮�W��⸮⸮⸮ձ⸮I⸮Q⸮A⸮⸮⸮5




20:30:01.651 -> ERROR
20:30:01.651 -> ERROR

20:30:01.651 -> ERROR
20:30:01.651 -> ERROR


20:30:01.651 -> ERROR
20:30:01.651 -> ERROR

20:30:01.651 -> ERROR
20:30:01.651 -> ERROR



20:30:01.651 -> ERROR
20:30:01.651 -> ERROR

20:30:01.651 -> ERROR
20:30:01.651 -> ERROR


20:30:01.651 -> ERROR
20:30:01.651 -> ERROR

20:30:01.651 -> ERROR
20:30:01.651 -> ERROR
 1





20:30:01.651 -> ERROR
20:30:01.651 -> ERROR

20:30:01.651 -> ERROR
20:30:01.651 -> ERROR


20:30:01.651 -> ERROR
20:30:01.651 -> ERROR

20:30:01.651 -> ERROR
20:30:01.651 -> ERROR



20:30:01.651 -> ERROR
20:30:01.651 -> ERROR

20:30:01.651 -> ERROR
20:30:01.651 -> ERROR


20:30:01.651 -> ERROR
20:30:01.651 -> ERROR

20:30:01.651 -> ERROR
20:30:01.651 -> ERROR




20:30:01.651 -> ERROR
20:30:01.651 -> ERROR

20:30:01.684 -> ERROR
20:30:01.684 -> ERROR


20:30:01.684 -> ERROR
20:30:01.684 -> ERROR

20:30:01.684 -> ERROR
20:30:01.684 -> ERROR



20:30:01.684 -> ERROR
20:30:01.684 -> ERROR

20:30:01.684 -> ERROR
20:30:01.684 -> ERROR


20:30:01.684 -> ERROR
20:30:01.684 -> ERROR

20:30:01.684 -> ERROR
20:30:01.684 -> set_config





20:30:01.684 -> ERROR
20:30:01.684 -> ERROR

20:30:01.684 -> ERROR
20:30:01.684 -> ERROR


20:30:01.684 -> ERROR
20:30:01.684 -> ERROR

20:30:01.684 -> ERROR
20:30:01.684 -> ERROR



20:30:01.684 -> ERROR
20:30:01.684 -> ERROR

20:30:01.684 -> ERROR
20:30:01.684 -> ERROR


20:30:01.684 -> ERROR
20:30:01.684 -> ERROR

20:30:01.684 -> ERROR
20:30:01.684 -> ERROR




20:30:01.684 -> ERROR
20:30:01.684 -> ERROR

20:30:01.684 -> ERROR
20:30:01.684 -> ERROR


20:30:01.684 -> ERROR
20:30:01.684 -> ERROR

20:30:01.684 -> ERROR
20:30:01.684 -> ERROR



20:30:01.684 -> ERROR
20:30:01.684 -> ERROR

20:30:01.684 -> ERROR
20:30:01.684 -> ERROR


20:30:01.684 -> ERROR
20:30:01.684 -> ERROR

20:30:01.684 -> ERROR
20:30:01.684 -> SERIAL_8N1 - UART_PARITY_NONE





20:30:01.718 -> ERROR
20:30:01.718 -> ERROR

20:30:01.718 -> ERROR
20:30:01.718 -> ERROR


20:30:01.718 -> ERROR
20:30:01.718 -> ERROR

20:30:01.718 -> ERROR
20:30:01.718 -> ERROR



20:30:01.718 -> ERROR
20:30:01.718 -> ERROR

20:30:01.718 -> ERROR
20:30:01.718 -> ERRR


20:30:01.718 -> ERROR
20:30:01.718 -> ERROR

20:30:01.718 -> ERROR
20:30:01.718 -> ERROR




20:30:01.718 -> ERROR
20:30:01.718 -> ERROR

20:30:01.718 -> ERROR
20:30:01.718 -> ERROR


20:30:01.718 -> ERROR
20:30:01.718 -> ERROR

20:30:01.718 -> ERROR
20:30:01.718 -> ERROR



20:30:01.718 -> ERROR
20:30:01.718 -> ERROR

20:30:01.718 -> ERROR
20:30:01.718 -> ERROR


20:30:01.718 -> ERROR
20:30:01.718 -> ERROR

20:30:01.718 -> ERROR
20:30:01.718 -> baud_rate requested: 115200





20:30:01.718 -> baud_rate effective: 115207





20:30:01.718 -> busy p...
20:30:01.718 -> busy p...

20:30:01.718 -> busy p...
20:30:01.718 -> busy 

20:30:01.718 -> busy p...
20:30:01.718 -> ER
20:30:01.751 -> ERROR
20:30:01.751 -> ROR

20:30:01.751 -> ERROR
20:30:01.751 -> p...


20:30:01.751 -> ERROR
20:30:01.751 -> ERROR

20:30:01.751 -> ERROR
20:30:01.751 -> busy p..


20:30:01.751 -> ERROR
20:30:01.751 -> ERROR

20:30:01.751 -> ERROR
20:30:01.751 -> ERROR


20:30:01.751 -> ERROR
20:30:01.751 -> ERROR

20:30:01.751 -> ERROR
20:30:01.751 -> .



20:30:01.751 -> ERROR
20:30:01.751 -> ERROR

20:30:01.751 -> ERROR
20:30:01.751 -> ERROR


20:30:01.751 -> ERROR
20:30:01.751 -> ERROR

20:30:01.751 -> ERROR
20:30:01.751 -> busy p...




20:30:01.751 -> ERROR
20:30:01.751 -> ERROR

20:30:01.751 -> ERROR
20:30:01.751 -> ERROR


20:30:01.751 -> ERROR
20:30:01.751 -> ERROR

20:30:01.751 -> ERROR
20:30:01.751 -> busy p...



20:30:01.751 -> ERROR
20:30:01.751 -> ERROR

20:30:01.751 -> ERROR
20:30:01.751 -> ERROR


20:30:01.751 -> ERROR
20:30:01.751 -> ERROR

20:30:01.751 -> ERROR
20:30:01.751 -> [WiFiE



20:30:01.751 -> ERROR
20:30:01.751 -> ERROR

20:30:01.751 -> ERROR
20:30:01.751 -> ERROR


20:30:01.751 -> ERROR
20:30:01.751 -> ERROR

20:30:01.751 -> ERROR
20:30:01.751 -> ERROR



20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.788 -> ERROR
20:30:01.788 -> ERROR


20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.788 -> ERROR
20:30:01.788 -> sp] Initializing ESP modul




20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.788 -> ERROR
20:30:01.788 -> ERROR


20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.788 -> ERROR
20:30:01.788 -> ERROR



20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.788 -> ERROR
20:30:01.788 -> ERROR


20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.788 -> ERROR
20:30:01.788 -> ERROR




20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.788 -> ERROR
20:30:01.788 -> ERROR


20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.788 -> ERROR
20:30:01.788 -> ERROR



20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.788 -> ERROR
20:30:01.788 -> ERROR


20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.788 -> ERROR
20:30:01.788 -> e





20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.788 -> ERROR
20:30:01.788 -> ERROR


20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.788 -> ERROR
20:30:01.788 -> ERROR



20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.788 -> ERROR
20:30:01.788 -> ERROR


20:30:01.788 -> ERROR
20:30:01.788 -> ERROR

20:30:01.821 -> ERROR
20:30:01.821 -> ERROR




20:30:01.821 -> ERROR
20:30:01.821 -> ERROR

20:30:01.821 -> ERROR
20:30:01.821 -> ERROR


20:30:01.821 -> ERROR
20:30:01.821 -> ERROR

20:30:01.821 -> ERROR
20:30:01.821 -> ERROR



20:30:01.821 -> ERROR
20:30:01.821 -> ERROR

20:30:01.821 -> ERROR
20:30:01.821 -> ERROR


20:30:01.821 -> ERROR
20:30:01.821 -> ERROR

20:30:01.821 -> ERROR
20:30:01.821 -> > wifiDriverInit





20:30:01.821 -> ERROR
20:30:01.821 -> ERROR

20:30:01.821 -> ERROR
20:30:01.821 -> ERROR


20:30:01.821 -> ERROR
20:30:01.821 -> ERROR

20:30:01.821 -> ERROR
20:30:01.821 -> ERROR



20:30:01.821 -> ERROR
20:30:01.821 -> ERROR

20:30:01.821 -> ERRR
20:30:01.821 -> ERROR


20:30:01.821 -> ERROR
20:30:01.821 -> ERROR

20:30:01.821 -> ERROR
20:30:01.821 -> ERROR




20:30:01.821 -> ERROR
20:30:01.821 -> ERROR

20:30:01.821 -> ERROR
20:30:01.821 -> ERROR


20:30:01.821 -> ERROR
20:30:01.821 -> ERROR

20:30:01.821 -> ERROR
20:30:01.821 -> ERROR



20:30:01.821 -> ERROR
20:30:01.821 -> ERROR

20:30:01.821 -> ERROR
20:30:01.821 -> ERROR


20:30:01.855 -> ERROR
20:30:01.855 -> ERROR

20:30:01.855 -> ERROR
20:30:01.855 -> eg⸮⸮�W��⸮⸮⸮ձ⸮I⸮Q⸮A⸮⸮⸮5





20:30:01.855 -> ERROR
20:30:01.855 -> ERROR

20:30:01.855 -> ERROR
20:30:01.855 -> ERROR


20:30:01.855 -> ERROR
20:30:01.855 -> ERROR

20:30:01.855 -> ERROR
20:30:01.855 -> ERROR



20:30:01.855 -> ERROR
20:30:01.855 -> ERROR

20:30:01.855 -> ERROR
20:30:01.855 -> ERROR


20:30:01.855 -> ERROR
20:30:01.855 -> ERROR

20:30:01.855 -> ERROR
20:30:01.855 -> ERROR




20:30:01.855 -> ERROR
20:30:01.855 -> ERROR

20:30:01.855 -> ERROR
20:30:01.855 -> ERROR


20:30:01.855 -> ERROR
20:30:01.855 -> ERROR

20:30:01.855 -> ERROR
20:30:01.855 -> ERROR



20:30:01.855 -> ERROR
20:30:01.855 -> ERROR

20:30:01.855 -> ERROR
20:30:01.855 -> ERROR


20:30:01.855 -> ERROR
20:30:01.855 -> ERROR

20:30:01.855 -> ERROR
20:30:01.855 -> ERROR
 1






20:30:01.855 -> ERROR
20:30:01.855 -> ERROR

20:30:01.855 -> ERROR
20:30:01.855 -> ERROR


20:30:01.855 -> ERROR
20:30:01.855 -> ERROR

20:30:01.855 -> ERROR
20:30:01.855 -> ERROR



20:30:01.855 -> ERROR
20:30:01.855 -> ERROR

20:30:01.888 -> ERROR
20:30:01.888 -> ERROR


20:30:01.888 -> ERROR
20:30:01.888 -> ERROR

20:30:01.888 -> ERROR
20:30:01.888 -> ERROR




20:30:01.888 -> ERROR
20:30:01.888 -> ERROR

20:30:01.888 -> ERROR
20:30:01.888 -> ERROR


20:30:01.888 -> ERROR
20:30:01.888 -> ERROR

20:30:01.888 -> ERROR
20:30:01.888 -> ERROR



20:30:01.888 -> ERROR
20:30:01.888 -> ERROR

20:30:01.888 -> ERROR
20:30:01.888 -> ERROR


20:30:01.888 -> ERROR
20:30:01.888 -> ERROR

20:30:01.888 -> ERROR
20:30:01.888 -> ERROR





20:30:01.888 -> ERROR
20:30:01.888 -> ERROR

20:30:01.888 -> ERROR
20:30:01.888 -> ERROR


20:30:01.888 -> ERROR
20:30:01.888 -> ERROR

20:30:01.888 -> ERROR
20:30:01.888 -> ERROR



20:30:01.888 -> ERROR
20:30:01.888 -> ERROR

20:30:01.888 -> ERROR
20:30:01.888 -> ERROR


20:30:01.888 -> ERROR
20:30:01.888 -> ERROR

20:30:01.888 -> ERROR
20:30:01.888 -> ERROR




20:30:01.888 -> ERROR
20:30:01.888 -> ERROR

20:30:01.888 -> ERROR
20:30:01.888 -> ERROR


20:30:01.888 -> ERROR
20:30:01.888 -> ERROR

20:30:01.888 -> ERROR
20:30:01.888 -> ERROR



20:30:01.888 -> ERROR
20:30:01.888 -> ERROR

20:30:01.922 -> ERROR
20:30:01.922 -> ERROR


20:30:01.922 -> ERROR
20:30:01.922 -> ERROR

20:30:01.922 -> ERROR
20:30:01.922 -> set_config


20:30:01.922 -> Dirty characters in the serial buffer! > 5593
20:30:01.922 -> ----------------------------------------------
20:30:01.922 -> >> AT
20:30:01.922 -> 




20:30:01.922 -> ERROR
20:30:01.922 -> ---------------------------------------------- > 1
20:30:01.922 -> 
20:30:02.915 -> RROR

20:30:02.915 -> ERROR
20:30:02.915 -> ERROERROR


20:30:02.915 -> ERROR
20:30:02.915 -> ERROR

20:30:02.915 -> ERROR
20:30:02.915 -> ER
20:30:02.915 -> Dirty characters in the serial buffer! > 52
20:30:02.915 -> ----------------------------------------------
20:30:02.951 -> >> AT
20:30:02.951 -> RROR


20:30:02.951 -> ERROR
20:30:02.951 -> ---------------------------------------------- > 1
20:30:02.951 -> 
20:30:03.932 -> RROR

20:30:03.932 -> ERROR
20:30:03.932 -> ERROERROR



20:30:03.932 -> ERROR
20:30:03.932 -> ERRO
20:30:03.932 -> Dirty characters in the serial buffer! > 40
20:30:03.932 -> ----------------------------------------------
20:30:03.970 -> >> AT
20:30:03.970 -> RROR


20:30:03.970 -> ERROR
20:30:03.970 -> ---------------------------------------------- > 1
20:30:03.970 -> 
20:30:04.962 -> RROR

20:30:04.962 -> ERROR
20:30:04.962 -> ERROERROR




20:30:04.962 -> ERROR
20:30:04.962 -> ERR
20:30:04.962 -> Dirty characters in the serial buffer! > 40
20:30:04.962 -> ----------------------------------------------
20:30:04.962 -> >> AT
20:30:04.962 -> RROR


20:30:04.962 -> ERROR
20:30:04.962 -> ---------------------------------------------- > 1
20:30:04.962 -> 
20:30:05.989 -> RROR

20:30:05.989 -> ERROR
20:30:05.989 -> ERROERROR





20:30:05.989 -> ERROR
20:30:05.989 -> ER
20:30:05.989 -> Dirty characters in the serial buffer! > 40
20:30:05.989 -> ----------------------------------------------
20:30:05.989 -> >> AT
20:30:05.989 -> RROR


20:30:05.989 -> ERROR
20:30:05.989 -> ---------------------------------------------- > 1
20:30:05.989 -> 
20:30:06.980 -> [WiFiEsp] Cannot initialize ESP module
20:30:11.976 -> > getConnectionStatus
20:30:11.976 -> RROR

20:30:11.976 -> ERROR
20:30:11.976 -> ERROERROR






20:30:12.010 -> ERROR
20:30:12.010 -> E
20:30:12.010 -> Dirty characters in the serial buffer! > 40
20:30:12.010 -> ----------------------------------------------
20:30:12.010 -> >> AT+CIPSTATUS
20:30:12.010 -> > getConnectionStatus

20:30:12.010 -> RROR


20:30:12.010 -> y p...
20:30:12.010 -> ERROERROR







20:30:12.010 -> busy p...
20:30:12.010 -> ERROR

20:30:12.010 -> busy p...
20:30:12.010 -> E

20:30:12.010 -> busy ...
20:30:12.010 -> Dirty characters in the serial buffe
20:30:12.010 -> ERROR
20:30:12.010 -> No start tag found: 1
20:30:12.010 -> ---------------------------------------------- > 
20:30:12.010 -> 
20:30:12.010 -> WiFi shield not present
20:30:12.046 -> 

The reason why I think it has delay is it will receive some messy code.

I doesn't find suspicious spot at the last time I review it because according to the official example, all the operation in the implementation is reasonable besides receive data in the irq way.Seems like Arduino has its own way to deal with receive process.
I will try to review the HardwareSerial again to find if there has something improper in Arduino receive process which doesn't fit Pico.

txPin is 0
rxPin is 1
did not work for me either - that's when I switched to Serial2. I did not try other pins on Serial1.

I tend to think that maybe pin 0 and 1 do not to work at all.

txPin is 0
rxPin is 1
did not work for me either - that's when I switched to Serial2. I did not try other pins on Serial1.

I tend to think that maybe pin 0 and 1 do not to work at all.

I also tried GP12 and GP13 as TX and RX, doesn't work either.
Seems like uart0 didn't work well whatever in the most pins.

I created a small test sketch and connected the Pico to a FTDI.
It seems that tx is working but rx is not working on uart0.
Strange!

I think I found it: in the class PicoDefaultSerial which is used by Serial, I was calling - stdio_init_all(); This must have reserved the uart0. I changed it to stdio_usb_init and reading data from Serial1 started to work....

ps. if you still have some timeout issues - this might be caused by the Standard Arduino functionality which has a flush timeout of 1000 milliseconds by default. You can decrease this by calling e.g.
Serial1.setTimeout(100);

I think I found it: in the class PicoDefaultSerial which is used by Serial, I was calling - stdio_init_all(); This must have reserved the uart0. I changed it to stdio_usb_init and reading data from Serial1 started to work....

ps. if you still have some timeout issues - this might be caused by the Standard Arduino functionality which has a flush timeout of 1000 milliseconds by default. You can decrease this by calling e.g.
Serial1.setTimeout(100);

Yes, it works!
Great work!
I find that I used stdio_init_all() in my beginning of setup() func, when I commented it, It works.
I think it's the same problem which cause the timeout bug.
Maybe the stdio_init_all() should only be execute at the beginning of system start.