EmbeddedRelated.com
Forums
Memfault Beyond the Launch

UCARXBUF and UCBRXBUF

Started by xerafian April 7, 2009
Hi, as you know i'm working with a msp430F2272 making a datalogger for temperature...

My doubt today is that if i can use the UART module and the USCI (in I2C mode) to communicate 2 diferent things with the msp430, i will be sharing the interrupt service routine?

The msp has 2 pin to the UART module (pins 3.4 and 3.5) and another 2 pin for USCI (pins 3.1 and 3.2)... so i understand that is possible, but in the manual says that some flags are shared and the interrupt service routine is:

#pragma vector = USCIAB0RX_VECTOR

Can anyone tell me if there is possible use both modules or i'm wasting my time??

Beginning Microcontrollers with the MSP430

xerafian wrote:
> Hi, as you know i'm working with a msp430F2272 making a datalogger for
> temperature...
>
> My doubt today is that if i can use the UART module and the USCI (in I2C
> mode) to communicate 2 diferent things with the msp430, i will be
> sharing the interrupt service routine?
>
> The msp has 2 pin to the UART module (pins 3.4 and 3.5) and another 2
> pin for USCI (pins 3.1 and 3.2)... so i understand that is possible, but
> in the manual says that some flags are shared and the interrupt service
> routine is:
>
> #pragma vector = USCIAB0RX_VECTOR
>
> Can anyone tell me if there is possible use both modules or i'm wasting
> my time??

Hi!

From a purely syntactic point of view, you can allow a function to
service more than one interrupt by writing:

#pragma vector = FOO_VECTOR, BAR_VECTOR, ANOTHER_VECTOR

Others on the list are better than me to tell you if this is a good idea
with these particular modules.

-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.

Do you have to use the two modes at the same time, or could you switch
between UART and I2C? You could switch your interrupt handling based
on whether I2C (or the UART) is enabled if you use only one mode at a
time.

- Bart

On Tue, Apr 7, 2009 at 4:49 AM, xerafian wrote:
> Hi, as you know i'm working with a msp430F2272 making a datalogger for
> temperature...
>
> My doubt today is that if i can use the UART module and the USCI (in I2C
> mode) to communicate 2 diferent things with the msp430, i will be sharing
> the interrupt service routine?
>
> The msp has 2 pin to the UART module (pins 3.4 and 3.5) and another 2 pin
> for USCI (pins 3.1 and 3.2)... so i understand that is possible, but in the
> manual says that some flags are shared and the interrupt service routine is:
>
> #pragma vector = USCIAB0RX_VECTOR
>
> Can anyone tell me if there is possible use both modules or i'm wasting my
> time??
As far as I know, one can use both USCI_A0 (e.g., in UART mode) and USCI_B0 (e.g., in I2C mode) at the same.

The OP says: "..., but in the manual says that some flags are shared ..."

I did not see that. What part of what manual says that?

USCI_A0 and USCI_B0 do share IE2 and IFG2 special function registers. But they use separate and different bits of those registers.

They also share same interrupt vectors called: USCIAB0TX_VECTOR and USCIAB0RX_VECTOR. That means the routines pointed by them should test the different IFGs to determine whether it is USCI_A0 or USCI_B0 that needs service. I do not see any problem in doing so.

--OCY

--- In m..., Bart Oegema wrote:
>
> Do you have to use the two modes at the same time, or could you switch
> between UART and I2C? You could switch your interrupt handling based
> on whether I2C (or the UART) is enabled if you use only one mode at a
> time.
>
> - Bart
>
> On Tue, Apr 7, 2009 at 4:49 AM, xerafian wrote:
> > Hi, as you know i'm working with a msp430F2272 making a datalogger for
> > temperature...
> >
> > My doubt today is that if i can use the UART module and the USCI (in I2C
> > mode) to communicate 2 diferent things with the msp430, i will be sharing
> > the interrupt service routine?
> >
> > The msp has 2 pin to the UART module (pins 3.4 and 3.5) and another 2 pin
> > for USCI (pins 3.1 and 3.2)... so i understand that is possible, but in the
> > manual says that some flags are shared and the interrupt service routine is:
> >
> > #pragma vector = USCIAB0RX_VECTOR
> >
> > Can anyone tell me if there is possible use both modules or i'm wasting my
> > time??
> >
>

Thanks for your answer, now i know that both USCI modules shares the same byte but not the same bit.... so i have to be carefully when i set de GIE or when i need to recognize which module causes the interrupt

>
> As far as I know, one can use both USCI_A0 (e.g., in UART mode) and USCI_B0 (e.g., in I2C mode) at the same.
>
> The OP says: "..., but in the manual says that some flags are shared ..."
>
> I did not see that. What part of what manual says that?
>
> USCI_A0 and USCI_B0 do share IE2 and IFG2 special function registers. But they use separate and different bits of those registers.
>
> They also share same interrupt vectors called: USCIAB0TX_VECTOR and USCIAB0RX_VECTOR. That means the routines pointed by them should test the different IFGs to determine whether it is USCI_A0 or USCI_B0 that needs service. I do not see any problem in doing so.
>
> --OCY
>
> --- In m..., Bart Oegema wrote:
> >
> > Do you have to use the two modes at the same time, or could you switch
> > between UART and I2C? You could switch your interrupt handling based
> > on whether I2C (or the UART) is enabled if you use only one mode at a
> > time.
> >
> > - Bart
> >
> > On Tue, Apr 7, 2009 at 4:49 AM, xerafian wrote:
> > > Hi, as you know i'm working with a msp430F2272 making a datalogger for
> > > temperature...
> > >
> > > My doubt today is that if i can use the UART module and the USCI (in I2C
> > > mode) to communicate 2 diferent things with the msp430, i will be sharing
> > > the interrupt service routine?
> > >
> > > The msp has 2 pin to the UART module (pins 3.4 and 3.5) and another 2 pin
> > > for USCI (pins 3.1 and 3.2)... so i understand that is possible, but in the
> > > manual says that some flags are shared and the interrupt service routine is:
> > >
> > > #pragma vector = USCIAB0RX_VECTOR
> > >
> > > Can anyone tell me if there is possible use both modules or i'm wasting my
> > > time??
> > >
> > >
>


Memfault Beyond the Launch