Use P2 as generic port

6 views
Skip to first unread message

Anders

unread,
Mar 25, 2009, 10:26:43 AM3/25/09
to iFoundry Product Support
Hi,

I've configured MSP430 UCA1 as UART (UART1). I have also connected P2
at IFSYS-5651 to a PC using a null modem cable. My intention has been
to communicate with the MSP430 via i.e. HyperTerminal. This did not
work, and therefore I measured using an oscilloscope to see if I
received any signal at all from the PC, but I did'nt. Can the
IFSYS-5651 board handle the signal level a PC uses? I guess so, but
I'm not sure.

Thank you,
Anders

IFS-Support

unread,
Mar 27, 2009, 2:16:13 AM3/27/09
to iFoundry Product Support
Hi Anders,

Here are some guidelines:

- P2 supports RS232 level communication, and should be compatible
with your PC (unless your PC happens not tobe RS232 compliant),
- next verify your PC is capable of sending data without any
connection ie TXD line wiggles
- next check RTS (P2 pin 7) on IFSYS-5651 is high (RS232) at the PC
end when the cable between 5651 and PC is connected. This should
enable PC's CTS# even if you set it to hardware flow control. (You
should be setting it to no flow control)
- If CTS from above is high (RS232 level) at PC end, then set PC to
"no flow control", or set the U1-RTS# signal to logic low (low
voltage). Refer to schematics for this

Let us know how it goes.

Thanks,
IFS Support



On Mar 25, 10:26 pm, Anders <anders.johannes...@cybercomgroup.com>
wrote:

Anders

unread,
Mar 31, 2009, 8:00:03 AM3/31/09
to iFoundry Product Support
Thank you

I have set up UART0 at 9600 baud to speak with the BT module and this
works fine, no problem. I have used the code below and can communicate
using this interface:

void Init_UART0()
{
UCA0CTL0 &= ~(0x01); // Clear UCSYNC bit to
select UART
P3SEL = 0x30; // P3.4,5 = USCI_A0 TXD/
RXD
UCA0CTL1 |= UCSWRST; // **Put state machine in
reset**
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 6; // 1MHz 9600 (see User's
Guide)
UCA0BR1 = 0; // 1MHz 9600
UCA0MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0,
UCBRFx=0,
// over sampling

UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state
machine**
UCA0IE |= UCRXIE; // Enable USCI_A0 RX
interrupt

__bis_SR_register(GIE); // Enter LPM0, interrupts enabled
}

Since UART1 (Port 2 at the development board) was giving me problem I
continued to UART2 (Port 1) and tried to communicate with my PC. This
did not succeed either, I used the code below:

void Init_UART2()
{
UCA2CTL0 &= ~(0x01); // Clear UCSYNC bit to
select UART

P9SEL |= 0x30; // P9.4,5 = USCI_A0 TXD/
RXD

UCA2CTL1 |= UCSWRST; // **Put state machine in
reset**
UCA2CTL1 |= UCSSEL_2; // SMCLK
UCA2BR0 = 6; // 1MHz 9600 (see User's
Guide)
UCA2BR1 = 0; // 1MHz 9600
UCA2MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0,
UCBRFx=0,
// over sampling

UCA2CTL1 &= ~UCSWRST; // **Initialize USCI state
machine**
UCA2IE |= UCRXIE; // Enable USCI_A0 RX
interrupt

__bis_SR_register(GIE); // Enter LPM0, interrupts
enabled
}

Using UART2 and Port 1 you basically have the same kind of
cummunication as with the BT module? How about RTS and CTS using this
port, do you have to bother about these? At the PC I set up the
communication using no flow control.

When I tried using UART1 I used this code:

void Init_UART1()
{
UCA1CTL0 &= ~(0x01); // Clear UCSYNC bit to
select UART

P5SEL &= ~(0x30); // I/O function selected
for pins P5.5 and P5.4 (RTS and DTR)
P5SEL |= 0xc0; // P5.6,7 = USCI_A0 TXD/
RXD

UCA1CTL1 |= UCSWRST; // **Put state machine in
reset**
UCA1CTL1 |= UCSSEL_2; // SMCLK
UCA1BR0 = 6; // 1MHz 9600 (see User's
Guide)
UCA1BR1 = 0; // 1MHz 9600
UCA1MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0,
UCBRFx=0,
// over sampling

UCA1CTL1 &= ~UCSWRST; // **Initialize USCI state
machine**
UCA1IE |= UCRXIE; // Enable USCI_A0 RX
interrupt

__bis_SR_register(GIE); // Enter LPM0, interrupts
enabled
}

Using UART1 I don't know how to handle the RTS and CTS line using
GPIO. Do you have any code / examples that sets up this communication
or implements software based flow control schemes?

Best Regards,
Anders

Anders

unread,
Mar 31, 2009, 10:09:29 AM3/31/09
to iFoundry Product Support
I want to add the following to my previous post:
I'm using a null-modem cable between the PC and Port 1 and 2, and want
to make sure that's the correct setup?

Best Regards,
Anders

Reply all
Reply to author
Forward
0 new messages