This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430G2553: RXBUF-serial connection

Part Number: MSP430G2553
Other Parts Discussed in Thread: MSP-EXP430G2ET, MSP430G2211, MSP430G2231

Hello all,

I'm trying to receive bytes on my msp430g2553 and insert this bytes into a variable 'd'. I use serial connection to receive this informations.

I saw a lot of forums who explained how can i do that, because i'm a beginner, but my program stop at 27th line before "#pragma vector", i don't know why.

Can anyone help me out on this issue ?  Thanks

#include <msp430g2553.h>

typedef unsigned char u_char;
typedef unsigned int u_int;

u_char d;

 unsigned int timerCount = 0;
void main(void) {

	WDTCTL = WDTPW + WDTHOLD; //stop watchdog
        DCOCTL = 0;
	BCSCTL1 = CALBC1_1MHZ;
	DCOCTL = CALDCO_1MHZ;

	// setup USIB, needed for the driver
	P1SEL |= BIT1 + BIT2; // P1.1 UCA0RXD input
	P1SEL2 |= BIT1 + BIT2; // P1.2 UCA0TXD output
	UCA0CTL1 |= UCSSEL_2 + UCSWRST; // SMCLK
	UCA0BR0 |= 104; 
	UCA0BR1 = 0;
        UCA0MCTL = UCBRS_1; 
	UCA0CTL1 &= ~UCSWRST;
        IE2 |= UCA0RXIE;
        _BIS_SR(GIE + LPM0_bits);         // Going to LPM0
}
   #pragma vector = USCIAB0RX_VECTOR
  __interrupt void ReceiveInterrupt(void)
{
d=UCA0RXBUF;			
  IFG2 &= ~UCA0RXIFG; //clear RX flag
}

  • Hello Marco,
    the fact that the PC stops at 27th line indicates the device being in LPM0 and waiting on the interrupt to wake up. It seems the interrupt never occurs, while the instructions for GIE and UCA0RXIE are there.
    Did you check the signals at the UCA0RXD? Is the UART signal visible at P1.1?
    When checking the status register in the described state, is the GIE still enabled? Also UCA0RXIE? Including all necessary settings for the UART module?
    What happens if you set the UCA0RXIFG by hand, and resume code execution? Does the CPU jump to the ISR?

    Best regards
    Peter
  • Hello Peter,
    Thanks for reply and your explanations.
    The UART is not visible at P1.1 because the signal is equal to 0.5V but if i use P1.6 the signal is equal to 2.2V. But the program is still stop. I use Putty to send bytes.
    I'm sorry, i'm a beginner, how can i check the status register ? How can i set the UCA0RXIFG by hand ?
    Regards
    Marco
  • Hello Marco,
    let's make one step after another. Why is the signal at your UART RX pin P1.1 0.5V? Please tell me more about the HW you are using. Many thanks in advance.

    Best regards
    Peter
  • Hello Peter,
    Thanks for reply.
    I use serial communication from my PC to the launchpad, i have moxa uport1110 that the reason why i connect a ttl-rs232 converter to the moxa port, the converter is directly connect to P1.1. I checked the voltage on the converter pin (3V) but on P1.1 it's still 0.5V. Jumpers are on hardware postion. Is there a problem of settings on the launchpad?
    Regards
    Marco

  • Marco,
    are you aware of the MSP-EXP430G2ET , I assume this is the LaunchPad you're using, supporting a virtual COM-Port connection via USB to the PC? For getting started on the UART communication, I'd recommend to use this, instead of debugging some other HW. Because definitely there is something wrong with your HW setup, if you sense 0.5V at a digital communication line, where the logic is supplied by 3V.

    Best regards
    Peter
  • Hello Peter,

    I'm using MSP-EXP430G2, i guess it supporting a virtual COM-port connection via USB the the PC, i saw a tutorial in that configuration. I tested P1.1 (still 0.5V) and P1.6( still 2V) with Putty and Realterm. It would seem P1.6 is more appropriate ? Is it possible to receive data with P1.6 in serial communication and then, transmit data on P1.7 with SPI ? Because finally this is my project : receive data in serial communication and transmit in SPI protocol. If it's not possible have i to buy MSP-430G2ET ?

    Thanks for your help.

    Regards

    Marco

  • Hello Marco,
    there is something wrong with the HW. Could you please load the "msp430g2553_uscia0_uart_01_115k.c" in the TI Resource Explorer of CCS into the device? This is a tested code example and if your HW works properly, you should see correct UART signals.
    Unless you've not managed getting that state, it does not make sense trying other things.

    The MSP430G2553 supports two communication channels in parallel. One is USCIA0 and the other is USCIB0. USCIA0 can support UART and USCIB0 includes the support of SPI. So it is possible to use the device for a UART to SPI conversion.

    Best regards
    Peter
  • Hello Peter,

    I tested this program and i have still 0.5V on P1.1 but i switched msp430g2553 for msp430g2211 (i added g2553 library on the program just for the transfer), the program doesn't work correctly (normal because it's g2211) but i have 3V on P1.1. So i think i have a problem with the microcontroller, maybe have i to buy an other msp430g2553 ? I also have g2231, maybe it can do the same work than g2553?

    Regards

    Marco

  • Hello Marco,
    an electrical overstress damage, e.g. resulting from ESD could be a reason for the erroneous behavior you're experiencing.
    The test with the MSP430G2211 is not a perfect one, as the device does not have the USCI module and thus does not offer the same functionality. Due to this you also cannot apply the same settings to the respective pins and modules.
    But definitely getting some other samples of the MSP430G2553 makes sense. You can order those online from our webpage.

    Best regards
    Peter
  • Peter,
    Thanks a lot for your help and your explanations. I didn't think about that but without knowckledge 2 weeks ago i tried to connect serial driver with the launchpad without rs232-ttl converter, so there was 13V on P1.1 this is probably the electrical overstress damage.
    Last question, if i understood correctly i can't use msp430g2231 or msp430g2211 for a UART to SPI conversion ? I have to use msp430g2553.
    Regards
    Marco

  • Marco,
    while MSP430G2231 and MSP430G2211 are different devices with different feature sets, they both do not support in HW neither UART nor SPI.
    There is a possibility to emulate both, by using the CPU, port or/and Timer interrupts, driving and using some general purpose GPIOs.
    But there are a few things to consider with such an approach. It is definitely more difficult in terms of writing the code, and dependent on the communication speed and load, you could run into issues with CPU bandwidth.
    So for the two reasons definitely I would recommend going with the MSP430G2553, which has HW support for both UART and SPI and can do this simultaneously based on the integrated USCI module.

    Best regards
    Peter

**Attention** This is a public forum