I played a lot with UART on Espruino based on STm32. Very handy to communicate with various sensors or external systems.
On STM32 boards SERIAL is very efficient thanks to the use of hardware peripherals in background. However, now that I am very convinced with Espruino on nRF52 (especially MDBT42Q which gives a lot of flexibility to build projects around), I struggle sometimes with the SERIAL library because it is implemented in software. I would say that with baudrate greater than 2400 Baud the Serial interface is not reliable anymore.
Is anyone experiencing the same limitation? Is there any plans to provide a better Serial on nRF52 boards?
There should be hardware serial named Serial1 so you just Serial1.setup(...) it and it should work. It definitely works with 115200 speed.
Software only is new Serial(). It is exactly the same on STM32(?)
As @fanoush says - you get a hardware Serial1 which should work great at higher baud rates. You don't have to use software.
Also worth noting that you can move Serial1 between any pins, so potentially even if you need multiple Serial ports you may be able to get along with just the one bit of hardware, especially if there's RTS/CTS handshaking
Thanks for your useful answers.
I actually never used Serial1 because it seems to be the default console interface when BLE console is not available.
I will try forcing the console on BLE with E.setConsole("Bluetooth") in order to avoid problems between the console and the device plugged onto the Serial port.
Ahh - ok, yes, that's be the best bet. Maybe use E.setConsole("Bluetooth",true) to force it to always stay on BLE
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem