EmbeddedRelated.com
Forums

Swapping baud rate on hte UART on hte fly

Started by Steve February 2, 2005
HI all

In my code I swap the baud rate on my UART dependant on what sensor I
am sampling.  Usually from 38400 to 9600 and then reset it once
sampled.  The different sensors are connected to various drivers and
then routed through an addressable mux to UART1.  The logic is then
TTL but the baud rates match the sensor.  

However, I have noted that the UART sometimes hangs between changes
meaning I cannot get data in.  If I swap to a 485 sensor and then back
to the 232 it usually corrects itself. 

Something "odd" seems to be happening at the UART.

Anyone else experienced this or have any thoughts??

cheers
Steve




Beginning Microcontrollers with the MSP430

On Wed, Feb 02, 2005 at 08:15:21PM -0000, Steve wrote:

> However, I have noted that the UART sometimes
hangs between changes
> meaning I cannot get data in.  If I swap to a 485 sensor and then back
> to the 232 it usually corrects itself. 
> 
> Something "odd" seems to be happening at the UART.
> 
> Anyone else experienced this or have any thoughts??

To be sure that the Uart works reliable you have to set the SWRST Flag
before you do any changes in the UART registers. At the end you reset
this flag (and reinitialize the uart state machine).

        Matthias