EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Software UART.

Started by David Collier January 3, 2006
I would like to use a pin on an MSP430F169/1611 to receive GPS data at 
4800 baud.

I have timer A ticking away at 32KHz, but that's a bit low to be useful 
I think. Though maybe it would be good enough?

I have Timer B running off the DCO, at about 7MHz, but at present I'm 
not trimming it. I could add that if required.

What sort of pin is best to connect the serial in to???

I could use a port 2 bit and spot both edges, reading TimerA or B for a 
timing reference.

I could use a CCI input bit on timer B and capture timer B I suppose...

Maybe someone else has a better idea?

Does anyone have any recommendations?

David


Beginning Microcontrollers with the MSP430

Maybe the UART RX pin? 

-Micah 


On Tuesday 03 January 2006 10:56 am, David Collier
wrote:
> I would like to use a pin on an MSP430F169/1611 to receive GPS data at
> 4800 baud.
>
> I have timer A ticking away at 32KHz, but that's a bit low to be
useful
> I think. Though maybe it would be good enough?
>
> I have Timer B running off the DCO, at about 7MHz, but at present I'm
> not trimming it. I could add that if required.
>
> What sort of pin is best to connect the serial in to???
>
> I could use a port 2 bit and spot both edges, reading TimerA or B for a
> timing reference.
>
> I could use a CCI input bit on timer B and capture timer B I suppose...
>
> Maybe someone else has a better idea?
>
> Does anyone have any recommendations?
>
> David
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>

More specifically: that's pin 33, or Port 3.5. Why aren't you running
the 
chip's UART for this? 

-Micah 

On Tuesday 03 January 2006 11:02 am, Micah Stevens
wrote:
> Maybe the UART RX pin?
>
> -Micah
>
> On Tuesday 03 January 2006 10:56 am, David Collier wrote:
> > I would like to use a pin on an MSP430F169/1611 to receive GPS data at
> > 4800 baud.
> >
> > I have timer A ticking away at 32KHz, but that's a bit low to be
useful
> > I think. Though maybe it would be good enough?
> >
> > I have Timer B running off the DCO, at about 7MHz, but at present
I'm
> > not trimming it. I could add that if required.
> >
> > What sort of pin is best to connect the serial in to???
> >
> > I could use a port 2 bit and spot both edges, reading TimerA or B for
a
> > timing reference.
> >
> > I could use a CCI input bit on timer B and capture timer B I
suppose...
> >
> > Maybe someone else has a better idea?
> >
> > Does anyone have any recommendations?
> >
> > David
> >
> >
> >
> > .
> >
> >
> > Yahoo! Groups Links
>
> .
>
>
> Yahoo! Groups Links
>
>
>

On Tue, Jan 03, 2006 at 06:56:00PM +0000, David Collier wrote:
> I would like to use a pin on an MSP430F169/1611 to
receive GPS data at 
> 4800 baud.
> 
> What sort of pin is best to connect the serial in to???
> 
> I could use a CCI input bit on timer B and capture timer B I suppose...

There is a application note from TI describing this software uart using
timer capture...

        Matthias

Thanks Matthias

I guess if there's working code, I should go with it. CCIR it is then :-)

David

> > I would like to use a pin on an
MSP430F169/1611 to receive GPS data 
> > at 4800 baud.
> > 
> > What sort of pin is best to connect the serial in to???
> > 
> > I could use a CCI input bit on timer B and capture timer B I 
> > suppose...
> 
> There is a application note from TI describing this software uart 
> using
> timer capture...
> 
>         Matthias


duh....

if I wanted to use a real UART I wouldn't be wasting my time posting 
here... I'm not a complete idiot.

I have both real UARTs tied up talking to things...

sorry to snap :-)

David


Well, I don't know David, we've been posed some far dumber
questions 
than that!! The obvious answer is to use one of the Timer A capture 
pins, but, failing that any allocated timer function could run a 4800 bd 
receive only UART, using just about any pin as its source. Of course an 
interruptable pin (P1 or P2) would simplify things. Too many choices really.

Cheers

Al

David Collier wrote:

>duh....
>
>if I wanted to use a real UART I wouldn't be wasting my time posting 
>here... I'm not a complete idiot.
>
>I have both real UARTs tied up talking to things...
>
>sorry to snap :-)
>
>David
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>


Thanks to all who answered, but after perusing app notes over a coffee, 
I think I'm making this WAY more difficult than it really is.

I want only receive.
I want to receive at 4800 baud, the standard output from a GPS device.
I have a 32KHz interrupt running.

That's ~6 samples per bit. If I sample on the 3rd, 9th, 15th etc 
interrupts after I notice a mark condition. ( with minor adjustments for 
inexact 4800/32768 division ) , that will work perfectly well as a 
low-speed receive UART, surely.

The app notes are all about running at worthwhile baud rates, but, 
frankly 4800 is none of that.

So, to conclude, I can use any bit on any port I like.

TVM

David


> Well, I don't know David, we've been posed some far dumber
questions 
> than that!! 

I know, but I was hoping I was well enough known around here that my 
non-homework status would carry me through.

> The obvious answer is to use one of the Timer A
capture 
> pins, but, failing that any allocated timer function could run a 4800 
> bd receive only UART, using just about any pin as its source. Of 
> course an interruptable pin (P1 or P2) would simplify things. Too 
> many choices really.

As you can see from the crossed message, I came to the same conclusion 
eventually. Maybe my failure to grasp it immediately should see me 
relegated to the dumb division :-)

TVM

David


On Wed, Jan 04, 2006 at 05:02:00PM +0000, David Collier wrote:
> Thanks to all who answered, but after perusing app
notes over a coffee, 
> I think I'm making this WAY more difficult than it really is.
> 
> I want only receive.
> I want to receive at 4800 baud, the standard output from a GPS device.
> I have a 32KHz interrupt running.

TX is easier than RX if you have a timer to dedicate to the task. RX is
easier than TX if all you have is an approximate timer to piggyback off.

If by "32khz" you mean 32,768 Hz when you detect the leading edge of
the
start bit sample again 3 periods later to make sure its still a start
bit then sample the bits in approximate middle every 7 periods. Plenty
good enough in low noise environments.

If 32kHz is 32,000 Hz then first half step at 3, then step by 7 four
times, once by 6, and finish stepping by 7.

-- 
David Kelly N4HHE, dkelly@dkel...
=======================================================================Whom
computers would destroy, they must first drive mad.


The 2024 Embedded Online Conference