Hi,
I need to change the speed of my serial port driver, i.e. at 57600bps, after the serial driver has already been started, i.e. at 9600bps.
In order to do so, I have to start at 9600bps, send the AT command "AT+IPR=57600", wait for OK answer and then switch to 57600.
This is what I think to do:
1) send sdStop()
2) change speed parameter to 57600bps
3) send sdStart()
Could this be working for me?
Thanks.
-g
Serial Device: usart speed change "on the fly"
Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: Serial Device: usart speed change "on the fly"
Hi,
You don't need to stop, just call sdStart() again to set new parameters, of course you need multiple configuration structures.
Giovanni
You don't need to stop, just call sdStart() again to set new parameters, of course you need multiple configuration structures.
Giovanni
Re: Serial Device: usart speed change "on the fly"
Giovanni wrote:Hi,
You don't need to stop, just call sdStart() again to set new parameters, of course you need multiple configuration structures.
Giovanni
You must be kidding
If i make user selectable communication parameters (with dip switch), lets say 1200-115200 and 1/2 stop bit, i must wrote 16 configuration structure?
kalevik
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: Serial Device: usart speed change "on the fly"
You can have one structure and change it or multiple constant structures.
Giovanni
Giovanni
Re: Serial Device: usart speed change "on the fly"
Giovanni wrote:You can have one structure and change it or multiple constant structures.
Giovanni
Okay, i understand wrong your answer to ucasano, "of course you need multiple configuration structures".
kalevik
Re: Serial Device: usart speed change "on the fly"
This is inconsistent with lots of other stuff in Chibios: Many things in Chibios don't tolerate being restarted by "just call start again", because they are not in the right "state".Giovanni wrote:You don't need to stop, just call sdStart() again to set new parameters, of course you need multiple configuration structures.
i
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: Serial Device: usart speed change "on the fly"
Start is meant to be call-able when the device is in "started" state, not when it is in "active" state, you cannot call start when there is an operation in progress.
Serial does not have a defined "active" state and can be always restarted. Look at the assertions in the driver to see the valid states (or the HAL documentation, there are state diagrams there).
Giovanni
Serial does not have a defined "active" state and can be always restarted. Look at the assertions in the driver to see the valid states (or the HAL documentation, there are state diagrams there).
Giovanni
Who is online
Users browsing this forum: No registered users and 28 guests