ESP8266 UART question #6396
Replies: 1 comment
-
Posted at 2020-06-17 by @MaBecker do you like to share your serial code section so others cant test and recommend some optimisation if needeed. have you tried to connect over tcp/ip and use the hardware serial for communication? Posted at 2020-06-17 by user106712 I am using two soft serials, taking input from one UART and passing it to the USB UART.
d0() is essentially console.log over port 23. The PIN assignment cannot be changed hence the use of soft serial. I think the issue is that .on('data',..) is coming back 1 or 2 bytes at a time. I will experiment using .available(). Posted at 2020-06-17 by user106712 Using hubSerial.available() - rather than hubSerial.data('on') - to chunk the input stream seems to make some difference (fewer errors) at 4800 baud. But no difference at 2400 (mostly good) or 9600 (bad transmission). See code below (both .available and .on('data') fragments are included:
Posted at 2020-06-19 by @MaBecker If you like you can run some tests with removing TX if you just reading and RX if just sending. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2020-06-16 by user106712
From http://www.espruino.com/USART
"As software serial doesn't use dedicated hardware there are some compromises:
Baud rates significantly above 9600 baud are unlikely to be reliable
Sending more than one or two characters will block execution of other JavaScript code until completion (hardware serial ports have a ~100 byte transmit buffer)
Software serial reception will become increasingly unreliable the higher the CPU load."
In my application, I use soft serial (rx=D5, tx=D6). I get bursts of 60+ bytes (5x a second) from an external source. I find that anything beyond 2400 baud increases errors in the data received. What's the experience of others?
Using an Amica 8266 board.
Beta Was this translation helpful? Give feedback.
All reactions