Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Urgent help required: PC to MSP430 over serial port

Status
Not open for further replies.

anand_navale

Junior Member level 2
Joined
Mar 13, 2003
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
53
I am working on a project that involves serial communication between MSP430f1232 and PC at the baud rate of 38400 b/s. I am able to receive data at the PC end from the MSP430 but have no success in receiving data at the microcontroller end from the PC.

The microcontroller has a crystal frequency of 4.00 MHz. I am using IAR Embedded Workbench for development.

The initialization of USART0 is done using the following code:

/*
Initialization values for UxBR and UxMCTL registers
to set the baud rate to 38.4 KHz assuming BRCLK = 4 MHz.
These values are calculated using the formulae given in MSP430 userguide.
*/
#define UART_BAUD 0x0068
#define MODULATION_VAL 0x08

/*
Initialize USART0 as UART
*/
UCTL0 = SWRST; // Reset USART
UCTL0 |= CHAR; // 8-bit character
UTCTL0 |= SSEL0; // UCLK = ACLK
UBR00 = UART_BAUD & 0xff; // Configure baud rate
UBR10 = (UART_BAUD >> 8) & 0xff;
UMCTL0 = MODULATION_VAL; // Enable modulation
ME2 |= UTXE0 | URXE0; // Enable UART TXD/RXD
UCTL0 &= ~SWRST; // Release USART
IE2 |= URXIE0; // Enable USART RX interrupt


The ISR to for reception of data is as below:

#pragma vector=USART0RX_VECTOR
__interrupt void UART0_recv_handler(void)
{
unsigned char rx_data;

// Read the UART receive buffer
rx_data = RXBUF0;
}

Help is urgently required. Thanx in advance,
Anand
 

The code looks good. Supposing you didn´t forget to set GIE or something, you may read the following link (silicon errata about USART ISR service).
**broken link removed**
 

It has turned out that the device board hardware does not support 38.4 K Baud rate. The code works satisfactorily at 19.2 K Baud rate after changing the values of UART_BAUD and MODULATION_VAL.

Thanx anyways for the help.
Anand.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top