EmbeddedRelated.com
Forums

Switching between UART/I2C causes Tx line to pulse low

Started by merapcb March 24, 2011
I am using the UART on the 1612 for both UART/serial as well as I2C, and configure/reconfigure it frequently. I have found that when ever I exit the I2C mode (i.e. reconfigure to UART), there is a high to low pulse generated on the Tx line (P3.4). Is there any way to cause this not to happen? Is it a fluke of the MSP? Here is my code:

void I2C_Exit(void)
{
U0CTL &= ~I2CEN;
U0CTL &= ~SYNC;
P3SEL |= (BIT4);
InitUart0_Msp430(M_BAUD0_19200);
}

Beginning Microcontrollers with the MSP430

I don't know if this is the solution but I found this link with reference to a "proper" procedure to switch between I2C and UART. I will be trying it out, but comments still welcome...

http://www-k.ext.ti.com/srvs/cgi-bin/webcgi.exe?Company={5761bcd8-11f5-4e08-84e0-8167176a4ed9},kb=dsp,caseQ341,new

--- In m..., "merapcb" wrote:
> Anyone on this?
>
> --- In m..., "merapcb" wrote:
> >
> >
> > I am using the UART on the 1612 for both UART/serial as well as I2C, and configure/reconfigure it frequently. I have found that when ever I exit the I2C mode (i.e. reconfigure to UART), there is a high to low pulse generated on the Tx line (P3.4). Is there any way to cause this not to happen? Is it a fluke of the MSP? Here is my code:
> >
> > void I2C_Exit(void)
> > {
> > U0CTL &= ~I2CEN;
> > U0CTL &= ~SYNC;
> > P3SEL |= (BIT4);
> > InitUart0_Msp430(M_BAUD0_19200);
> > }
>

You mean the the initialization (re-initialization) of the UART?
--- In m..., "Baylan R&D Dept." wrote:
>
> In your initialization subroutine,
> add:
> P3OUT |= BIT4;
> P3DIR |= BIT4;
>
> before using P3SEL register.
>
> Bahadir
>
> ----- Original Message -----
> From: merapcb
> To: m...
> Sent: Friday, March 25, 2011 3:41 AM
> Subject: [msp430] Re: Switching between UART/I2C causes Tx line to pulse low
>
>
> Anyone on this?
>
> --- In m..., "merapcb" wrote:
> >
> >
> > I am using the UART on the 1612 for both UART/serial as well as I2C, and configure/reconfigure it frequently. I have found that when ever I exit the I2C mode (i.e. reconfigure to UART), there is a high to low pulse generated on the Tx line (P3.4). Is there any way to cause this not to happen? Is it a fluke of the MSP? Here is my code:
> >
> > void I2C_Exit(void)
> > {
> > U0CTL &= ~I2CEN;
> > U0CTL &= ~SYNC;
> > P3SEL |= (BIT4);
> > InitUart0_Msp430(M_BAUD0_19200);
> > }
> >
>
>
>

No, once only in start-up of your code, during the initialization of system parameters (IO ports, Timers etc).
It means that, when the port is not selected for a special purpose, it will not be switched to Low. ( It will stay in High - Output).
----- Original Message -----
From: merapcb
To: m...
Sent: Friday, March 25, 2011 8:54 AM
Subject: [msp430] Re: Switching between UART/I2C causes Tx line to pulse low

You mean the the initialization (re-initialization) of the UART?

--- In m..., "Baylan R&D Dept." wrote:
>
> In your initialization subroutine,
> add:
> P3OUT |= BIT4;
> P3DIR |= BIT4;
>
> before using P3SEL register.
>
> Bahadir
>
> ----- Original Message -----
> From: merapcb
> To: m...
> Sent: Friday, March 25, 2011 3:41 AM
> Subject: [msp430] Re: Switching between UART/I2C causes Tx line to pulse low
>
>
>
>
> Anyone on this?
>
> --- In m..., "merapcb" wrote:
> >
> >
> > I am using the UART on the 1612 for both UART/serial as well as I2C, and configure/reconfigure it frequently. I have found that when ever I exit the I2C mode (i.e. reconfigure to UART), there is a high to low pulse generated on the Tx line (P3.4). Is there any way to cause this not to happen? Is it a fluke of the MSP? Here is my code:
> >
> > void I2C_Exit(void)
> > {
> > U0CTL &= ~I2CEN;
> > U0CTL &= ~SYNC;
> > P3SEL |= (BIT4);
> > InitUart0_Msp430(M_BAUD0_19200);
> > }
> >
>
>
>
>
>
>
>



In your initialization subroutine,
add:
P3OUT |= BIT4;
P3DIR |= BIT4;

before using P3SEL register.

Bahadir

----- Original Message -----
From: merapcb
To: m...
Sent: Friday, March 25, 2011 3:41 AM
Subject: [msp430] Re: Switching between UART/I2C causes Tx line to pulse low

Anyone on this?

--- In m..., "merapcb" wrote:
>
>
> I am using the UART on the 1612 for both UART/serial as well as I2C, and configure/reconfigure it frequently. I have found that when ever I exit the I2C mode (i.e. reconfigure to UART), there is a high to low pulse generated on the Tx line (P3.4). Is there any way to cause this not to happen? Is it a fluke of the MSP? Here is my code:
>
> void I2C_Exit(void)
> {
> U0CTL &= ~I2CEN;
> U0CTL &= ~SYNC;
> P3SEL |= (BIT4);
> InitUart0_Msp430(M_BAUD0_19200);
> }
>



Anyone on this?

--- In m..., "merapcb" wrote:
> I am using the UART on the 1612 for both UART/serial as well as I2C, and configure/reconfigure it frequently. I have found that when ever I exit the I2C mode (i.e. reconfigure to UART), there is a high to low pulse generated on the Tx line (P3.4). Is there any way to cause this not to happen? Is it a fluke of the MSP? Here is my code:
>
> void I2C_Exit(void)
> {
> U0CTL &= ~I2CEN;
> U0CTL &= ~SYNC;
> P3SEL |= (BIT4);
> InitUart0_Msp430(M_BAUD0_19200);
> }
>

Did that, but it does not help. The glitches on the Tx keep coming. I have added SWRST but also not helping. Presently my code looks like this:

void I2C_Exit(void)
{
UCTL0 |= SWRST;

/* Port3 re-configuration is not needed as it is dedicated for the I2C */
U0CTL &= ~I2CEN; // Disable the I2C module
U0CTL &= ~SYNC; // Reset to default, which is UART0
P3SEL |= (BIT4);
InitUart0_Msp430(M_BAUD0_19200);
}
--- In m..., "Baylan R&D Dept." wrote:
>
> No, once only in start-up of your code, during the initialization of system parameters (IO ports, Timers etc).
> It means that, when the port is not selected for a special purpose, it will not be switched to Low. ( It will stay in High - Output).

Did that, but it does not help. The glitches on the Tx keep coming. I have added SWRST but also not helping. Presently my code looks like this:

void I2C_Exit(void)
{
UCTL0 |= SWRST;

/* Port3 re-configuration is not needed as it is dedicated for the I2C */
U0CTL &= ~I2CEN; // Disable the I2C module
U0CTL &= ~SYNC; // Reset to default, which is UART0
P3SEL |= (BIT4);
InitUart0_Msp430(M_BAUD0_19200);
}

--- In m..., "Baylan R&D Dept." wrote:
>
> No, once only in start-up of your code, during the initialization of system parameters (IO ports, Timers etc).
> It means that, when the port is not selected for a special purpose, it will not be switched to Low. ( It will stay in High - Output).
> ----- Original Message -----
> From: merapcb
> To: m...
> Sent: Friday, March 25, 2011 8:54 AM
> Subject: [msp430] Re: Switching between UART/I2C causes Tx line to pulse low
>
>
> You mean the the initialization (re-initialization) of the UART?
>
> --- In m..., "Baylan R&D Dept." wrote:
> >
> > In your initialization subroutine,
> > add:
> > P3OUT |= BIT4;
> > P3DIR |= BIT4;
> >
> > before using P3SEL register.
> >
> > Bahadir
> >
> > ----- Original Message -----
> > From: merapcb
> > To: m...
> > Sent: Friday, March 25, 2011 3:41 AM
> > Subject: [msp430] Re: Switching between UART/I2C causes Tx line to pulse low
> >
> >
> >
> >
> > Anyone on this?
> >
> > --- In m..., "merapcb" wrote:
> > >
> > >
> > > I am using the UART on the 1612 for both UART/serial as well as I2C, and configure/reconfigure it frequently. I have found that when ever I exit the I2C mode (i.e. reconfigure to UART), there is a high to low pulse generated on the Tx line (P3.4). Is there any way to cause this not to happen? Is it a fluke of the MSP? Here is my code:
> > >
> > > void I2C_Exit(void)
> > > {
> > > U0CTL &= ~I2CEN;
> > > U0CTL &= ~SYNC;
> > > P3SEL |= (BIT4);
> > > InitUart0_Msp430(M_BAUD0_19200);
> > > }
> > >
> >
> >
> >
> >
> >
> >
> >
>
>
>

Did you check to see if there might be some Crosstalk between adjacent PCB
traces?

From: m... [mailto:m...] On Behalf Of
merapcb
Sent: Tuesday, March 29, 2011 3:05 AM
To: m...
Subject: [msp430] Re: Switching between UART/I2C causes Tx line to pulse low

Did that, but it does not help. The glitches on the Tx keep coming. I have
added SWRST but also not helping. Presently my code looks like this:

void I2C_Exit(void)
{
UCTL0 |= SWRST;

/* Port3 re-configuration is not needed as it is dedicated for the I2C */
U0CTL &= ~I2CEN; // Disable the I2C module
U0CTL &= ~SYNC; // Reset to default, which is UART0
P3SEL |= (BIT4);
InitUart0_Msp430(M_BAUD0_19200);
}

--- In m... , "Baylan
R&D Dept." wrote:
>
> No, once only in start-up of your code, during the initialization of
system parameters (IO ports, Timers etc).
> It means that, when the port is not selected for a special purpose, it
will not be switched to Low. ( It will stay in High - Output).



No, no crosstalk. What I have found is that somehow this line is causing it: U0CTL &= ~SYNC
But this does not make sense to me

--- In m..., "Edward O'Reilly" wrote:
>
> Did you check to see if there might be some Crosstalk between adjacent PCB
> traces?
>
>