EmbeddedRelated.com
Forums

Please debug Timer_A UART on MSP430F1232 P1.2 RX P1.3 TX

Started by andrei_lucec February 7, 2005
  I removed the P1SEL. Sorry for that. An older version.

Our teacher sais that we should leave P1.2 / 3 on I/O.

We should also enable interrupts on port 1.2 (RX from PC), falling 
edge (1 to 0). Set the port on 1 (high) and if a 1 -> 0 transition 
occurs, this will trigger the P1IFG.

When  P1IFG is set we have to start counting with the Timer
208 pulses (208 pulses @ 4 MHz) to "sit" on the middle of the bit.

If the value is 0 (start bit) we can:

start a loop with 

Timer 416 pulses (416 pulses @ 4MHz  - 104 s)
save the P1IN into a RXTXBuffer
shift RXTXBuffer to receive all bits in the byte

Is this theory valid ?!




Beginning Microcontrollers with the MSP430

Yes, Andrei, this theory is valid. But as you configure P1.2 as input, 
you can't write on it. So, I would add a pull-up resistor at this pin, 
to guarantee that it is always in a high level when the PC is not 
connected to the MSP. Have you tried to write on the P2IN register? This 
is not allowed and increase current consumption.

You also have to check if the stop bit is 1, to check the validity of 
the received byte. You're using the timer in compare mode, right? If you 
have configured timer registers correctly, it should work. But as Micah 
said, I would scope the Rx/Tx pins to check if the byte is really being 
received by the MSP.

Regards,
Adriano.


andrei_lucec wrote:
> 
>   I removed the P1SEL. Sorry for that. An older version.
> 
> Our teacher sais that we should leave P1.2 / 3 on I/O.
> 
> We should also enable interrupts on port 1.2 (RX from PC), falling 
> edge (1 to 0). Set the port on 1 (high) and if a 1 -> 0 transition 
> occurs, this will trigger the P1IFG.
> 
> When  P1IFG is set we have to start counting with the Timer
> 208 pulses (208 pulses @ 4 MHz) to "sit" on the middle of the
bit.
> 
> If the value is 0 (start bit) we can:
> 
> start a loop with 
> 
> Timer 416 pulses (416 pulses @ 4MHz  - 104 s)
> save the P1IN into a RXTXBuffer
> shift RXTXBuffer to receive all bits in the byte
> 
> Is this theory valid ?!
> 
> 
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 

yeap, I configured the timer in compare mode.

do you guys have a sample of the proper configuration of Timer A?

smth simple, like select ACLK, Divided by 8, count to 50000 , turn on a LED 
?

The problem is that between me and the scope there are a couple of miles. 
good luck for the
signal analisys ...



To do that simple task, just take a look at the TACTL register in the 
user's guide. You have to configure timer in up mode and load 50000 in 
TACCR0 register. You can then enable interrupt on overflow (50000->0) by 
setting the TAIE bit on the same TACTL register. The clock source of the 
timer and the divider are also selected in this register. In the timer 
ISR, you can then turn on/off a led, and is necessary to reset the TAIFG 
flag.

Regards,
Adriano.

Andrei Lucec wrote:
> yeap, I configured the timer in compare mode.
> 
> do you guys have a sample of the proper configuration of Timer A?
> 
> smth simple, like select ACLK, Divided by 8, count to 50000 , turn on a LED

> ?
> 
> The problem is that between me and the scope there are a couple of miles. 
> good luck for the
> signal analisys ...
> 
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 

Many Thanks for the advise. I'll let you know the result.

>From: Adriano <adriano@adri...>
>Reply-To: msp430@msp4...
>To: msp430@msp4...
>Subject: Re: [msp430] Re: Please debug Timer_A UART on MSP430F1232 P1.2 RX 
>P1.3 TX
>Date: Wed, 09 Feb 2005 08:56:53 -0200
>
>
>To do that simple task, just take a look at the TACTL register in the
>user's guide. You have to configure timer in up mode and load 50000 in
>TACCR0 register. You can then enable interrupt on overflow (50000->0) by
>setting the TAIE bit on the same TACTL register. The clock source of the
>timer and the divider are also selected in this register. In the timer
>ISR, you can then turn on/off a led, and is necessary to reset the TAIFG
>flag.
>
>Regards,
>Adriano.
>
>Andrei Lucec wrote:
> > yeap, I configured the timer in compare mode.
> >
> > do you guys have a sample of the proper configuration of Timer A?
> >
> > smth simple, like select ACLK, Divided by 8, count to 50000 , turn on
a 
>LED
> > ?
> >
> > The problem is that between me and the scope there are a couple of 
>miles.
> > good luck for the
> > signal analisys ...
> >
> >
> >
> >
> > .
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >