-
• #2
I'm not sure. I'd maybe try different pins on ESP32, also maybe disconnect the two boards, short RX and TX on each board, and see if you can receive what you sent on the same board - it's a good way of problem-finding.
It looks like you might be able to run an AT command firmware on ESP32, in which case this code might get you proper WiFi on the original Espruino.
Of course if you had an ESP8266 lying around that'd probably be preferable in this case!
-
• #3
Thanks Gordon - Sorry it was me being a N00b: GND need to connect between the 2 boards. Kept forgetting about that one :/
-
• #4
I thought UART2 on ESP32 was on 16 and 17?
-
• #6
Hmm. Per this page: http://www.espruino.com/ESP32 UART2 is on 16 and 17... (and it works beautifully on these pins)
So something isn't making sense here...
Another thing that's strange here is that - at least at 115200 baud - on ESP32 side, the on('data') callback is called only once, with the whole blob of data, rather than once per char...
-
• #7
For information only, there is an overlapping of GPIO16/17 on some boards
For WROVER boards, those with additional 4MB PSRAM, 16/17 are used for the PSRAM.
For WROOM boards like yours it should'nt be a problem. -
• #8
I switched board to another one (NODEMCU ESP32), switched to GPIO16/17, and did a simple test
ESP32:
Serial2.setup(115200,{rx:D17, tx:D16}); Serial.print("hello");
on Espruino
Serial2.setup(115200); Serial2.on('data', function (str) { console.log(str); }); //output: l ohel >
Strange. Can confirm that message sent from Espruino is received on ESP32 as entire blob instead of per character...
-
• #9
I switched the pins and did
ESP32
Serial2.setup(115200,{rx:D16,tx:D17}) Serial2.print("lorem ipsum dolor");
Got on Espruino:
l orem ips um d olor sit ame t >
-
• #10
How many characters you receive at a time depends on lots of things, so I wouldn't worry about it - for instance if Espruino is busy running some code then you'll get lots of characters at once.
It might be related to the fact that ESP32 will have to send out the data it received out of a UART that is the same speed as the UART it receives data on.
-
• #11
@Gordon for my purpose I have to get the entire message before deciding next step of actions. Does this mean it’s best practice to always buffer the data for the busy case you mentioned above even for Espruino boards? I’ve been wrapping the message from ESP32 board with a start and end chars (<,>)so Espruino can understand whole messages, is there a proper way to detect start and end of transmission?
Thanks!
-
• #12
Yes, I'd always buffer it. I think it's pretty common practice to just use the newline character:
function handleLine(l) {...} function setup() { Serial2.setup(115200); var line=""; Serial2.on('data', function (str) { var l = (line+str).split("\n"); line = l.pop(); l.forEach(handleLine); }); };
Hi,
I need to use WIFI and have an original espruino and an esp32 lying board around. Eventually will just get an espruino WIFI, but seems like fun to tinker using the esp32 as the wifi 'board' so I did :)
So the strategy I have in mind is connecting the two via serial have them communicate that way. Tried the simple loopback test and seemed to work fine. With the actual connection I'm getting garbage character most of the time.
on ESP32:
On Espruino:
Result:
Is there anything different I need to do? Thanks!