Hi Nordic,
1.I am running (C:\ncs\v2.1.0-rc2\zephyr\samples\drivers\uart\echo_bot) but i need to change baud rate within program
2. I Can Change my baud rate using overlay file
3. But I dont want overlay file i need to make changes within program
Hi Nordic,
1.I am running (C:\ncs\v2.1.0-rc2\zephyr\samples\drivers\uart\echo_bot) but i need to change baud rate within program
2. I Can Change my baud rate using overlay file
3. But I dont want overlay file i need to make changes within program
Hi,
You can try the API uart_configure() to change the baudrate. You can get the current config using uart_config_get(), store this in a uart_config struct, change the baud rate in this struct, and set the config again.
Best regards,
Jørgen
Hi Jorgen,
1.Sorry for telling i am little bit confused about api uart_configure and all
2. My Suggestion is could you provide a example with example code if possible
Hi Jorgen,
Thank you for this code
1. When i paste this code in echo bot as you say at starting point
2. I got so many errors please check from your side and rectify the errors
Tharak said:1. When i paste this code in echo bot as you say at starting point
I did not say that I pasted the code at the starting point of the sample, I said I used the sample as a starting point for adding this code.
Tharak said:2. I got so many errors please check from your side and rectify the errors
I did run the code at my end, and it is working properly (I used nRF Connect SDK v2.0.0). Put the code after this line.
If you get any errors, you need to post the errors here if you want me to help you resolve them.
Hi Jorgen,
1. I tried the code after print_uart statement
2. I didnt got anny errors thats fine
3. But my ulitimate goal is i need to print the statement in 19200 baud rate
4. When i use your code and changed baud rate from 1000000 to 19200 its wont work
5. i think my problem you understood and i checked in build/zephyr/zephyr.dts file its showing 115200 baud rate
Hi Jorgen,
1. I tried the code after print_uart statement
2. I didnt got anny errors thats fine
3. But my ulitimate goal is i need to print the statement in 19200 baud rate
4. When i use your code and changed baud rate from 1000000 to 19200 its wont work
5. i think my problem you understood and i checked in build/zephyr/zephyr.dts file its showing 115200 baud rate
Tharak said:4. When i use your code and changed baud rate from 1000000 to 19200 its wont work
What is not working? I tested it on my end and it works fine here.
Tharak said:5. i think my problem you understood and i checked in build/zephyr/zephyr.dts file its showing 115200 baud rate
This is expected, as the config from the devicetree will be used for initializing the UART. The updated baud rate will first take effect after you have run the code I provided.
Hi Jorgen,
1. Still i tried 100 of time its only taking default 115200 only
2. I changed 9600 38400 57600 but its taking default
3. i am wondering its working for you its not working for me
4. i am using bl653_dvk board ncs v2.0.0 and west command and for flashing using tera term
5. I attaching build/zephyr/zephyr.dts screenshot