In our drone design we are using SBUS to communicate between the radio control receiver (FrSKY X8R) and a Nano 33 BLE. SBUS is serial comms which runs at a non standard baud rate (100000) and is inverted to make life more difficult.
However that isn't the problem. We are connecting via Serial1 on the Nano and can set the baud rate ok (at least it isn't crashing, although looking at this post, it probably isn't setting the correct baud rate). The problem is when you use the optional config parameter in Serial1.begin().
The default config is 8 data bits, no parity, and one stop bit (8N1). SBUS uses 8 data bits, even parity and two stop bits (i.e. SERIAL_8E2).
If you set Serial1 to the default config (Serial1.begin(100000, SERIAL_8N1)) there is no problem, but if you try to set it to 8E2 then Mbed OS crashes (orange LED SOS).
You only need one line in setup() to reproduce the problem:
Looking at the Serial class in the ArduinoCore, I can see that using this optional config parameter calls format() in the serial base class, but I can't see how this config data is passed in or handled. This is likely due to my unfamiliarity with c++.
Can anyone cast any light on this problem or how to fix it?
Unfortunately, I don't know anywhere near enough about the nRF52840, Mbed OS, or the Arduino Mbed OS Boards platform to be able to answer that question. Perhaps someone here on the forum with more knowledge than me will be able to help.
You might find some useful information at the bug report about this that was submitted to the Mbed OS repository by one of the Arduino developers:
For anyone else looking at this, the code above seems to work. This in conjuction with the code from the non-standard baud rate post allowed me to set a baud rate of 100000 with a config of 8E2 on Serial1, and be able to read SBUS packets (after inverting it with a transistor).