Reply by "Nirosh P. Wijayaratne"●March 30, 20072007-03-30
Leon/Baxter Codeworks,
Thanks for the help last weekend re. the s/w UART. Finally got everything to
work. Turns out it was the hardware guy's(me!) fault. My RS232 level
converter was not working properly even though the loopback worked ok.
Just as info for anyone else who might have been interested. The F2121 side
worked perfectly no crystal at 57600bps. The F4250 side needed a 32kHz crystal
and then that too worked perfectly!
Thanks
Nirosh
----- Original Message -----
From: baxtercodeworks
To: m...
Sent: Sunday, March 25, 2007 1:39 PM
Subject: [msp430] Re: S/W UART Implementation Question
I think you may need a 3.6864MHz (NOT KHz) crystal for 9600. I get
2400 baud with the 32.768KHz, and my 9600 design (which uses a
3.6864MHz crystal) handles one software UART and an interface to a
RS232 Transiever chip for another software UART. This is on a
MSP430F1121a. If you use MSP430 chips with hardware UARTS, you should
be able to go faster.
--- In m..., "Nirosh P. Wijayaratne"
wrote:
>
> Leon,
>
> Thanks for the reply. Is the 32.768KHz crystal a must to make the
UART work reliably?
>
> Maybe that's my problem, I do not have a crystal on my board.
>
>
--- In m..., "Leon" wrote: >
> It's counter-intuitive, but higher baud rates are less critical.
>
Certainly counter-intuitive for me. Could you please explain what you
mean?
Thanks.
Norm.
Reply by baxtercodeworks●March 25, 20072007-03-25
I think you may need a 3.6864MHz (NOT KHz) crystal for 9600. I get
2400 baud with the 32.768KHz, and my 9600 design (which uses a
3.6864MHz crystal) handles one software UART and an interface to a
RS232 Transiever chip for another software UART. This is on a
MSP430F1121a. If you use MSP430 chips with hardware UARTS, you should
be able to go faster.
--- In m..., "Nirosh P. Wijayaratne"
wrote: >
> Leon,
>
> Thanks for the reply. Is the 32.768KHz crystal a must to make the UART work reliably? >
> Maybe that's my problem, I do not have a crystal on my board.
Reply by Leon●March 25, 20072007-03-25
----- Original Message -----
From: "Nirosh P. Wijayaratne"
To:
Sent: Sunday, March 25, 2007 7:31 PM
Subject: Re: [msp430] S/W UART Implementation Question > Thanks Leon,
>
> I did try playing with the delays but it did not see to make it any
> better...worse...yes. I even tried going down to 2400bps to see if it
> worked any better but it was the same.
>
> Also on the same topic, any reason why I would not be able to run two
> UARTS on one MSP430 (assuming I get the one to work first)? :)
It's counter-intuitive, but higher baud rates are less critical.
Reply by "Nirosh P. Wijayaratne"●March 25, 20072007-03-25
Thanks Leon,
I did try playing with the delays but it did not see to make it any
better...worse...yes. I even tried going down to 2400bps to see if it worked any
better but it was the same.
Also on the same topic, any reason why I would not be able to run two UARTS on
one MSP430 (assuming I get the one to work first)? :)
Thanks
Nirosh
----- Original Message -----
From: Leon
To: m...
Sent: Sunday, March 25, 2007 8:35 AM
Subject: Re: [msp430] S/W UART Implementation Question
----- Original Message -----
From: "Nirosh P. Wijayaratne"
To:
Sent: Sunday, March 25, 2007 4:08 PM
Subject: Re: [msp430] S/W UART Implementation Question
> Leon,
>
> Thanks for the reply. Is the 32.768KHz crystal a must to make the UART
> work reliably?
>
> Maybe that's my problem, I do not have a crystal on my board.
I think it would be a good idea, although I have had a hardware UART running
reliably using the on-chip oscillator with a PIC.
You could try tweaking your delays, to get it to work. It can't be far
out,
if you can receive data OK.
Leon
Reply by Leon●March 25, 20072007-03-25
----- Original Message -----
From: "Nirosh P. Wijayaratne"
To:
Sent: Sunday, March 25, 2007 4:08 PM
Subject: Re: [msp430] S/W UART Implementation Question > Leon,
>
> Thanks for the reply. Is the 32.768KHz crystal a must to make the UART
> work reliably?
>
> Maybe that's my problem, I do not have a crystal on my board.
I think it would be a good idea, although I have had a hardware UART running
reliably using the on-chip oscillator with a PIC.
You could try tweaking your delays, to get it to work. It can't be far out,
if you can receive data OK.
Leon
Reply by "Nirosh P. Wijayaratne"●March 25, 20072007-03-25
Leon,
Thanks for the reply. Is the 32.768KHz crystal a must to make the UART work
reliably?
Maybe that's my problem, I do not have a crystal on my board.
Thanks
Nirosh
----- Original Message -----
From: Leon
To: m...
Sent: Sunday, March 25, 2007 2:03 AM
Subject: Re: [msp430] S/W UART Implementation Question
----- Original Message -----
From: "Nirosh P. Wijayaratne"
To:
Sent: Sunday, March 25, 2007 9:17 AM
Subject: [msp430] S/W UART Implementation Question
> Hello,
>
> I am trying to implement a s/w UART @ 9600bps. I am sending a keypress
> from hyperterminal and am expecting to see it echoed back. However, I am
> receiving random characters. Once in a while, I will receive the
> expectected character. Some characters seem to be better than others. For
> Example 'Q, O, W' is echoed 60% of the time whereas 'I'
will rarely
> appear. Whether any correct characters appear at all seem to be PC
> dependant.
>
> To me, the problem seems to be with what is going out of the MSP430 not
> being read properly by the PC. A breakpoint in the code indicats that the
> keypress is being received ok.
>
> A few facts:
>
> 1. I am not using a crystal. Depending soleley on the DCO
>
> 2. My RS232 level converter is tested by looping back the send and
> receive and known to be ok
>
> Any help would be appreciated. Also. any idea if I can run multiple s/w
> UARTS on one MSP430F2121 or on the MSP430F2121. Code attached below.
The baud rate is probably wrong. I've had a software UART working
reliably
with the DCO and a 32.768 kHz crystal, using TI code.
Leon
Reply by Leon●March 25, 20072007-03-25
----- Original Message -----
From: "Nirosh P. Wijayaratne"
To:
Sent: Sunday, March 25, 2007 9:17 AM
Subject: [msp430] S/W UART Implementation Question > Hello,
>
> I am trying to implement a s/w UART @ 9600bps. I am sending a keypress
> from hyperterminal and am expecting to see it echoed back. However, I am
> receiving random characters. Once in a while, I will receive the
> expectected character. Some characters seem to be better than others. For
> Example 'Q, O, W' is echoed 60% of the time whereas 'I'
will rarely
> appear. Whether any correct characters appear at all seem to be PC
> dependant.
>
> To me, the problem seems to be with what is going out of the MSP430 not
> being read properly by the PC. A breakpoint in the code indicats that the
> keypress is being received ok.
>
> A few facts:
>
> 1. I am not using a crystal. Depending soleley on the DCO
>
> 2. My RS232 level converter is tested by looping back the send and
> receive and known to be ok
>
> Any help would be appreciated. Also. any idea if I can run multiple s/w
> UARTS on one MSP430F2121 or on the MSP430F2121. Code attached below.
The baud rate is probably wrong. I've had a software UART working reliably
with the DCO and a 32.768 kHz crystal, using TI code.
Leon
Reply by "Nirosh P. Wijayaratne"●March 25, 20072007-03-25
Hello,
I am trying to implement a s/w UART @ 9600bps. I am sending a keypress from
hyperterminal and am expecting to see it echoed back. However, I am receiving
random characters. Once in a while, I will receive the expectected character.
Some characters seem to be better than others. For Example 'Q, O, W'
is echoed 60% of the time whereas 'I' will rarely appear. Whether any
correct characters appear at all seem to be PC dependant.
To me, the problem seems to be with what is going out of the MSP430 not being
read properly by the PC. A breakpoint in the code indicats that the keypress is
being received ok.
A few facts:
1. I am not using a crystal. Depending soleley on the DCO
2. My RS232 level converter is tested by looping back the send and receive
and known to be ok
Any help would be appreciated. Also. any idea if I can run multiple s/w UARTS
on one MSP430F2121 or on the MSP430F2121. Code attached below.
CCTL0 = OUT; // TXD Idle as Mark
P1SEL = TXD; // P1.1/TA0 for TXD function
P1DIR = TXD; // TXD output on P1
P2SEL = RXD; // P2.2/TA0 as RXD input
//P1DIR |= 0x08; // Power MAX3221
//P1OUT |= 0x08; //
// Enter LPM0 w/ interrupt
for (;;)
{
RX_Ready(); // UART ready to RX one Byte
_BIS_SR(LPM4_bits + GIE); // Enter LPM4 w/ interr until char
RXed
TX_Byte(); // TX Back RXed Byte Received
}
}
// Function Transmits Character from RXTXData Buffer
void TX_Byte (void)
{
BitCnt = 0xA; // Load Bit counter, 8data +
ST/SP
CCR0 = TAR; // Current state of TA counter
CCR0 += Bitime; // Some time till first bit
RXTXData |= 0x100; // Add mark stop bit to RXTXData
RXTXData = RXTXData << 1; // Add space start bit
CCTL0 = OUTMOD0 + CCIE; // TXD = mark = idle
while ( CCTL0 & CCIE ); // Wait for TX completion
}
// Function Readies UART to Receive Character into RXTXData Buffer
// Sync capture not possible as DCO=TACLK=SMCLK can be off !!
void RX_Ready (void)
{
BitCnt = 0x8; // Load Bit counter
CCTL0 = CM1 + CCIS0 + OUTMOD0 + CAP + CCIE; // Neg Edge, Cap
}