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+GSM problems

Other Parts Discussed in Thread: MSP430G2553

Hai,

 Iam trying to interface msp430G2553 interface with sim900 gsm modem

But not working , I think the problem is in the last "ctrl+z"   the remaining things is printed on serial

Please help , Can I send ctrl+Z as   UCA0TXBUF =26;  

Iam using 9600 baud rate and frequency 1MHz SMCLK 

message sending function is below

void send_sms()
{
UARTSendArray("AT+CMGF=1", 11);
UARTSendArray("\n", 1);
__delay_cycles(10000);
UARTSendArray("AT+CMGS=",8);
while(!(IFG2 & UCA0TXIFG)); // Wait for TX buffer to be ready for new data
UCA0TXBUF =34;
UARTSendArray("9446727427",10);
while(!(IFG2 & UCA0TXIFG)); // Wait for TX buffer to be ready for new data
UCA0TXBUF =34;
UARTSendArray("\n", 1);
__delay_cycles(10000);
UARTSendArray("Water Theft\r", 13);
//UARTSendArray("\n\r", 2);
// UARTSendArray("Customer ID:TML987/236\n", 25);
// UARTSendArray("\n\r", 2);
__delay_cycles(10000);
while(!(IFG2 & UCA0TXIFG)); // Wait for TX buffer to be ready for new data
UCA0TXBUF =26;
}

  • From what it looks like you are trying to send AT commands from the MSP to the sim900 gsm using UART. Is that correct? How do you know the sim900 is correctly receiving any of the previous AT commands you sent? Normally, an ACK AT command is sent by the sim900 (or any other module for that matter). I don’t see any checking for any response in your code. Have you tried using an oscilloscope/logic analyzer to see what your MSP is actually outputting out the UART pin? Better yet, do you have access to a UART-to-USB converter? If so, you can connect MSP to your computer, and with the use of a terminal emulator you can see what your MSP is actually outputting at 9600 BaudRate. If you are sure that the problem lies in the "ctrl+z", then I see why UCA0TXBUF =26 should not work. Sometimes “ctrl+z” is rendered by two characters as ^Z.  Try sending those characters instead.

  • Ricardo Zepeda said:
    Sometimes “ctrl+z” is rendered by two characters as ^Z.  Try sending those characters instead

    That suggestion makes no sense at all. Ctrl+Z is sent as a binary 0x26. How a terminal program *displays* it has nothing to do with the proper way to send it.

  • Here Iam given only the GSM function. 

    The Tx pin of msp is connected with a usb to serial converter and that I connected to my computer terminal. In that terminal I can see the GSM command I entered in the function. Except ctrl+z remaining all is printed as such but in the place of ctrl+z I can see a small ? . So I doubt.  My GSM modem is working When Iam using direct terminal AT commands

  • Great suggestion by Ricardo. To further complement it try downloading a terminal emulator that dist plays the ASCII non printable characters. In other words download a terminal emulator that displays the hexadecimal values of the data received thorough the UART. The small ? That u r getting is because the terminal emulator that u have is letting u know that it has received a non printable character. Try downloading codevisionavr. It has a great terminal emulator that will display the hexadecimal values.

  • One other thing. If you are seeing the characters printed on the emulator then that means the problem does not lie in the msap430. The msp is doing what it is suppose to do. You should be posting or question to the company that manufactures the sim900.

  • hey.. BINU K

    IF u r putting something in UART TX buffer than u have to wait some time to allow that data to be transmitted.

    so let allow the tx flag to be clear. if u r going to this after ther each character. then u don't need to use the line..while(!(IFG2 & UCA0TXIFG)); 

    try this ... 

    UCA0TXBUF = 0X1A;// put any character u want to transmit.
    while(UCA0TXIFG==0);_delay_cycles(1000);

    through this u would be able to transmit any character...and then also arrrays.

    Regards,

    Dharmendra Sharma

    India

  • hey BUN K,

    for more..

    make a tx function of a charecter and string like..

    void tx_char(unsigned char a)
    {
    UCA0TXBUF=a;
    while(UCA0TXIFG==0);_delay_cycles(1000000/1000);//--> won't work with delay less than 1 ms
    }
    void tx_string(unsigned char *str)
    {
    for (i=0;*(str+i)!='\0';i++)
    {
    j=(char)(*(str+i));

    UCA0TXBUF=j;
    while(UCA0TXIFG==0);
    }
    }

    and then use turn echo off and set text mode,...

     use the send message function like...

    void send_message(unsigned char *no,unsigned char *msg)
    {
    tx_char('A');tx_char('T');tx_char('+');tx_char('C');
    tx_char('M');tx_char('G');tx_char('S');tx_char('=');
    tx_char('"');

    for (i=0;i<10;i++)
    {j=(char)(*(no+i));tx_char(j);}
    tx_char('"');tx_char(0X0D);

    _delay_cycles(1000000/5);// give delay is u dont want to see response
    {
    for (i=0;*(msg+i)!='\0';i++)
    {unsigned char k=(char)(*(msg+i));tx_char(k);}
    tx_char(0X1A);//ctrl+z
    }
    }

    Dharmendra Sharma

    INDIA

  • BINU K, 

    and also don't forget to configure UART and setting the Tx pin as output and rx as input,

    Dharmendra Sharma

    INDIA

  • Hai all ;

        Finaly I get the output. Here is the code

    UARTSendArray("AT+CMGF=1\r\n", 11);
    __delay_cycles(10000);
    UARTSendArray("AT+CMGS=\"9446727427\"\r\n",25);
    __delay_cycles(10000);
    UARTSendArray("COde testing\x1A",15);
    __delay_cycles(10000);

    here Iam change the order of \n\r  to \r\n

    Thank you for all support

**Attention** This is a public forum