You lose the USB connection, you gain a perfectly good hardware serial port. ESP's hardware serial port ought to be full duplex, though I'll admit I haven't played with it much.
The SoftwareSerial on the Uno, however, definitely is only half-duplex. Most software serial implementations can only send OR receive; attempting to do both at once will result in one or both sides seeing garbage characters.
It's not entirely clear to me how you're testing this, but if this could explain the issue, well, there's your problem. If that's the issue: Use a board with a second hardware serial port Mega, or third party board based on 'pb or 'p - or a non-AVR board like zero, mkr, etc , or use the hardware serial port and disconnect the ESP while uploading sketches, or adapt the code on the ESP to wait until one character period after the last received character before sending a response and the code on the Uno to not send a second command if it just sent one and is expecting a response.
Note that I don't see an obvious reason that the code you've written would have the uno trying to send and receive at the same time. As an aside, I would probably kick up the baud rate on the software serial port to or ; those are fine for software serial, and reducing the time it takes for a message to be sent, all else being equal, will reduce the length of time during which a collision would occur.
I just had the time to test the swap which seems to be promising, thanks again! But since the week-end I've fighting with my board to make it works, it's very frustrating NB: I also had the time to realize that I absolutely did not use the FEC library in my code above because I placed the end of packet marker before the guardian bytes AND never call the repair function xD.
I used the Serial. Swap on the ESP and I get rid of the serial software which has very unstable results. I also change the logic of the code to always give the initiative of the communication to the ESP. So it's not really a bidirectional communication as I imagined it not synchronous but it's working! Thanks you again for your answers. Hello First of all first of all thank you for all the help I have been able to find here so far in looking for answers.
I spare you my many attempts but finally I tried to used EspSoftwareSerial to replace the hardware Serial because its seems to be able to manage that : Except at high bitrates, depending on other ongoing activity, interrupts in particular, this software serial adapter supports full duplex receive and send.
And it is much more easier when using Python on the raspberry pi. Just connected via USB cable. Here is the link for a very similar requirement on YouTube. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?
Learn more. Ask Question. Asked 5 years, 6 months ago. Active 5 years ago. Viewed 2k times. Improve this question. Yannik Pieper Yannik Pieper 63 4 4 bronze badges.
Other than with the normal serial object? IgnacioVazquez-Abrams can you explain what you mean? Sorry I'm pretty new to this — Yannik Pieper. Add a comment. Active Oldest Votes. To be clear, Rasbian is a derivative of Linux. Improve this answer.
0コメント