B4R Question ESP to ESP Serial and Astream


Active Member
Licensed User
I am having trouble with a simple ESP to ESP serial comms. The enclosed is a cut down from a larger project passing 200 int values (MV) from one ESP to another.. To demonstrate the problem I am passing these one at a time. At a high baud rate the best I can do is 27 reads of 200 sends. (Serail2.zip is the sender and Serial1.zip the receiver programs)

Each send is via a SendArray(20) with SendArray(0) being a key (3 in this case) to the type of data being sent

Played with changes to the #StackBufferSize, MaxBufferSize and baud rate with little effect.

Of note in Capture 1 the buffer length changes from 23 to 24 and then fails on the be(60) call

Any help appreciated.. I've been on this simple thing for ages.

(As a footnote the reason I am using two ESP is one to transmit WIFI and one as a straight processor with I2C involved.. If I use WIFI and I2C in one ESP I get continuous crashes!)

Two other clarifications please.

a) Is there another way of coding ser.ConvertArraytoBytes) for say SendArray(20) rather than


) I realize I can pack more variables into SendArray(20) to reduce the number of sends for 200 variables but is there a more efficient way of sending 200 variables


  • Capture.JPG
    27.2 KB · Views: 201
  • Capture1.JPG
    22.4 KB · Views: 194
  • Serial1.zip
    1.3 KB · Views: 211
  • Serial2.zip
    1.4 KB · Views: 208


Active Member
Licensed User
Thanks for that
The problem turned out to be the size of the serial buffer, changed as per attached

    #if C
//HardwareSerial Serial1(1); // Second Hardware Port        ' Pins i/o 25 (RXD2) and i/o 26 (TXD2)
void SerialNative1(B4R::Object* unused)
HardwareSerial Serial1(1);  // Nextion Port
#define SERIAL1_RXPIN 25
#define SERIAL1_TXPIN 26

  ::Serial1.begin(57600, SERIAL_8N1, SERIAL1_RXPIN, SERIAL1_TXPIN);
b4r_main::_serialnative1->wrappedStream = &::Serial1;
#End If
Upvote 0