Dears, what is the minimum baud rate of nrf52832? Can I achieve 1200 or 600 bps? if so, how this can be set up?
Dears, what is the minimum baud rate of nrf52832? Can I achieve 1200 or 600 bps? if so, how this can be set up?
Hi Stanislav,
The minimum baud rate is 1200. See the infocenter.
You can set it by creating a devicetree overlay with a uart node, and then setting the "current-speed" parameter. See this, for example.
The options for that parameter are actually defined here: https://github.com/nrfconnect/sdk-zephyr/blob/main/dts/bindings/serial/nordic%2Cnrf-uart-common.yaml
If you don't know what a devicetree overlay is yet, I recommend this section of our Dev Academy: https://academy.nordicsemi.com/courses/nrf-connect-sdk-fundamentals/lessons/lesson-2-reading-buttons-and-controlling-leds/topic/devicetree/
Going through the entire nRF Connect Fundamentals course is highly recommended, by the way.
(I'm assuming you are using the nRF Connect SDK, based on your previous cases)
Best regards,
Raoul
So by playing with the clock speed or low-level counters, less than 1200 bps cannot be achieved?
So by playing with the clock speed or low-level counters, less than 1200 bps cannot be achieved?
The peripheral doesn't support it. But if you want to "bit-bang" UART by just toggling GPIOs in software, less than 1200 is surely possible :-)
If you really want to do that, I think there must be some library you could use somewhere on the internet. I doubt that you'll have to implement the UART logic from scratch.
Best regards,
Raoul
Thanks a lot, Raoul, SoftwareSerial from Arduino could be a good starting point. Your links about are really helpful!
Happy to help!
Best regards,
Raoul
I disagree; many baud rates are possible, try playing with this:
// Baudrate generator for the UART is the top 20 bits of a 32-bit field; add in rounding 0.5 ls bit uint32_t RequiredBaudRate = 600; // whatever .. uint32_t CalculatedRegisterValue; uint64_t SystemClock = 16000000ULL; // Typically 16MHz uint64_t MagicScaler = 32; // Preserves bits on divisions, shift 32 bits CalculatedRegisterValue = (uint32_t)(((((uint64_t)RequiredBaudRate << MagicScaler) + (SystemClock>>1)) / SystemClock) + 0x800) & 0xFFFFF000;
Did you know that with a screened twisted-pair cable using RS485 (easy on nRF52) it is possible to transmit a distance of 4 miles at 1200 baud or less? Don't ask, once I had to do just that ...
Hello, may I ask where you saw this calculation method? I couldn't find any relevant information in the data sheet of nRF52832.