-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seeed Studio XIAO nRF52840 compatibility #62
Comments
Short answerNo. TL;DR
Long answerNot from what I can see in the source code of the NRF52 board support UART driver. It's a fork of Adafruit's implementation, which uses a set of 'else if' statements to set the physical baud rate of the NRF52's UART to the nearest value that the hardware is capable of, like so: uint32_t nrfBaudRate;
if (baudrate <= 1200) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud1200;
} else if (baudrate <= 2400) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud2400;
} else if (baudrate <= 4800) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud4800;
} else if (baudrate <= 9600) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud9600;
} else if (baudrate <= 14400) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud14400;
} else if (baudrate <= 19200) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud19200;
} else if (baudrate <= 28800) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud28800;
} else if (baudrate <= 31250) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud31250;
} else if (baudrate <= 38400) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud38400;
} else if (baudrate <= 56000) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud56000;
} else if (baudrate <= 57600) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud57600;
} else if (baudrate <= 76800) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud76800;
} else if (baudrate <= 115200) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud115200;
} else if (baudrate <= 230400) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud230400;
} else if (baudrate <= 250000) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud250000;
} else if (baudrate <= 460800) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud460800;
} else if (baudrate <= 921600) {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud921600;
} else {
nrfBaudRate = UARTE_BAUDRATE_BAUDRATE_Baud1M;
} When you set the baudrate on an NRF52, the number you pick is not a guarantee that it will be set to your specified value. What this means is you can't set custom granular baud rates in the NRF52 like you can with all of the other chipsets in the Compatibility Table. I understand that TBS Crossfire receivers use a fixed UART baudrate of 416600, of which would be impossible to set on the NRF52. If you tried, the closest you will have on your NRF52 is 250000 and you will have garbled data, and no matter what you do, it simply won't work. In ExpressLRS' case, you would need to go into ExpressLRS Configurator and flash your receiver with your custom baudrate to match the limited choice in baudrates that the NRF52 chipset has provided. In this case, it would have to be 250000 Even if people are made aware of it, the actual NRF52 support would look more like "NRF52 but... [here's a list of hidden caveats that render CRSF for Arduino unusable with all of TBS Crossfire's receivers and partially unusable with ExpressLRS receivers unless you do x, y, and z]" and I prefer to avoid that scenario. I disagree with approaches like this, because I view it as an unnecessary limitation from a developer's perspective. AdditionalI already tried to implement support for NRF52 chipsets as early as version 0.1.0, and that's how I found out about these limitations. It irritated me that much, that I basically hit "f-- it"; I never published the branch, I discarded the changes I made, deleted the branch, and declared that I avoid NRF52 support like the plague. If it's anything other than a definite "yes", it's a "no". |
Thanks for taking the time to give me such a comprehensive answer! That is super annoying though about the limited baudrates. I've had nothing but problems with this chip since I started this project! I just wanted a small format board with on board gyro, I didn't know I was getting myself into such a difficult chip. |
You're welcome. Generally, what I do is I look up the following:
All of this can be quite time consuming. However, it is so worth going the extra mile for. I can see why you picked the NRF52840, because of it's Bluetooth capabilities, and Cortex M4F (with hardware floating point unit). It does seem ideal to have an on-board IMU paired with a microcontroller of that calibre, and the board itself being a small form-factor, however it could have been paired with a better microcontroller. A better alternative would be boards along the lines of Arduino's Nano 33 IoT and Nano RP2040 Connect. If it's the tiny form factor you're after, I highly recommend Adafruit's QtPy ESP32-S3 and pair it with their ICM-20948 Breakout. |
I've decided to go for the Nano RP2040 connect! I'll be able to use your library and from what I can tell I'll be able to use Dshot for motor control which I also want to do for my project. |
Excellent! |
Minimum requirements
What development board would you like me to add?
Hi, I'm trying to use a Seeed Studio XIAO nRF52840 with this library.
As far as I can tell it conforms to the requirements (I think it uses a Cortex M4 though I'm not quite clear on the specifics).
Could you add this functionality?
The text was updated successfully, but these errors were encountered: