This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf connect sdk: dts parameter verification for uart baudrate?

Hello,

I stumbled over the following problem in configuring an nrf connect sdk project: Somehow I must have dreamt that the Nrf52 UARTs support also baud rates beyond 1mbps (which they do not), so I put into an overlay file the corresponding setting :

&uart0 {
current-speed = <2000000>;
};

Everything compiles without complaining, but when deploying ... nothing! I might have found the wrong settings with the debugger, but since there is a tendency to rely on the serial output to debug Zephyr applications, "nothing" is not very helpful. That is the catch with the serial output in Zephyr. You have to get that working correctly before doing anything else.

Moreover, currently it does not seem possible to change uart speed at runtime, it all depends on the dts settings.

However, I figured the permissible settings could be put into the peripheral binding files, in this case:

zephyr/dts/bindings/serial/nordic,nrf-uart-common.yaml

Indeed, if I modify the current-speed settings here as indicated below, badly configuring the speed in an overlay file causes a device tree error even before compiling, like this:

-- Found devicetree overlay: faster.overlay
devicetree error: value of property 'current-speed' on /soc/uart@40002000 in nrf52840dk_nrf52840.dts.pre.tmp (2000000) is not in 'enum' list in /home/peter/ncs/zephyr/dts/bindings/serial/nordic,nrf-uarte.yaml ([1200, 2400, 4800, 9600, 14400, 19200, 28800, 31250, 38400, 56000, 57600, 76800, 115200, 230400, 250000, 460800, 921600, 1000000])

The patch in zephyr/dts/bindings/serial/nordic,nrf-uart-common.yaml would look something like this:

    current-speed:
      type: int
      required: true
      description: Initial baud rate setting for UART
      enum:
        - 1200 # actual 1205
        - 2400 # actual 2396
        - 4800 # actual 4808
        - 9600 # actual 9598
        - 14400 # actual 14401
        - 19200 # actual 19208
        - 28800 # actual 28777
        - 31250
        - 38400 # actual 38369
        - 56000 # actual 55944
        - 57600 # actual 57554 
        - 76800 # actual 76923, 1.6% error, use with caution
        - 115200 # actual 115108
        - 230400 # actual 231884
        - 250000
        - 460800 # actual 457143
        - 921600 # actual 941176, > 2% error, use with caution
        - 1000000

I feel to new to this topic to file a pull request, I would like an opinion. Also, since this file is in the zephyr tree, should a pull request be addressed to the zephyr project or to NCS?

Thanks for your opinion.

Parents Reply Children
No Data
Related