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.

CCS/MSP430F2416: CTRL+Z character not recognizing when sending SMS

Part Number: MSP430F2416

Tool/software: Code Composer Studio

Hi all,

I am trying to implement a project to send a SMS using MSP430F2416 with SIM800L GSM module. The code has been developed in CCS 6.0.1 compiler. Here with i have attached the code which I have developed. The issue for me is always my mobile receive empty SMS only, whevever the AT command has been sent via msp430 UART. So i have tried to send AT commands to SIM800L module via PC using hyper terminal, in this test  theSMS text is successfully received the mobile. The only difference I have seen is the recognition of the CTRL+Z  (char(26)).  

Also I have tried with SIM900 GSM module and msp430 (Sending AT commands via UART), for this case the SMS text is successfully received.

Since the msp30 is working with SIM900 module, and SIM800L is working fine with hyperterminal communication, with this testing results I can ensure there won't be any problem in MSP430 as well SIM800L module. Whenever  I am trying to communicate with SIM800L  via MSP430 UART the empty SMS only received to the mobile. I am unable to find any clue to solve this. 

But the SIM800L module size is comparatively smaller than SIM900 module. So I have to use only SIM 800L module. Does anyone else faced such a kind of issue? Will this problem arise because of any compiler issue?

The UART driver has been implemented in polling method.

Thanks in advance.

#include<msp430.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <uart.h>


unsigned char ctrlz = (char)26;
unsigned char at[4]   = {"AT\r\n"};
unsigned char cmgf[13] = {"AT+CMGF=1\r\n"};
unsigned char cmgs[30] = {"AT+CMGS=\"+919001111111\"\r\n"}; //SMS number

int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;   // Stop watchdog timer

    uint8_t index = 0, i = 0;
    uint32_t k = 0;
    int ind = 0;
    
    unsigned char tmpLatLong[10] = {0};
    unsigned char txfrBuffer[1]='a';
    
    //__bis_SR_register(GIE);                 // interrupts enabled

    Uart_Open(1);
    Uart_Open(0);


    Uart_TXn(&at[0],4, 1);
    k = 200000;
    do{
        --k;
    } while(k > 0);
    Uart_TXn(&cmgf[0],sizeof(cmgf),1);
    k = 200000;
    do{
        --k;
    } while(k > 0);

    Uart_TXn(&cmgs[0],sizeof(cmgs), 1);
    k = 200000;
    do{
        --k;
    } while(k > 0);

    Uart_TXn(&txfrBuffer[0], sizeof(txfrBuffer), 1);
    k = 2000000;
    do{
        --k;
    } while(k > 0);

    Uart_TXn(&ctrlz, sizeof(ctrlz), 1);
    k = 200000;
    do{
        --k;
    } while(k > 0);
    while(1);
}

  • Hi Prakash,

    I am not familiar with this module but I will try to help. Can you help confirm the following to ensure I correctly understand your issue:
    Using the exact same MSP430 code, everything works correctly with the other GSM module? And if you use a terminal to send the same data to the failing GSM module, it also works correctly?

    Have you tried using an oscilloscope or logic analyzer to observe the UART communication between the MSP430 and the two different GSM modules, to compare and see if anything is happening differently even though you are using the same code?

    In addition, I see that you are using some software delay by simply counting down in a loop - perhaps the compiler has somehow optimized this out since it doesn't do anything, or it is not taking the correct number of cycles - a more reliable way is to use __delay_cycles(x); where x is the number of CPU cycles of the MSP430 that you would like to delay.

    What is the purpose of the software delay? Is it to provide time for the packet to complete sending? Or is it to provide a delay between data packets? It is hard to know what might be going wrong without seeing your UART_TXn function.

    Regards,
    Katie
  • Hi Katie,

    Thanks for your reply. 

    Katie Pier said:
    Using the exact same MSP430 code, everything works correctly with the other GSM module?

    Yes, the same MSP430 code is working for SIM900A GSM module.

    Katie Pier said:
    And if you use a terminal to send the same data to the failing GSM module, it also works correctly?

    Yes, your understanding is correct. If i sent the AT commands via terminal to SIM800L module it is sending SMS with text.

    Katie Pier said:
    Have you tried using an oscilloscope or logic analyzer to observe the UART communication between the MSP430 and the two different GSM modules, to compare and see if anything is happening differently even though you are using the same code?

    Since i don't have an oscilloscope I have tried to capture the sending and receiving data through Serial port terminal. (HHD device monitoring studio 7.74, serial monitor).  In this case the commands are send to the modules via MSP430.In this serial port monitor output, the hex equivalent of CTRL+Z (0x1A) ((char)26) is not available for both the the module, also there is no different between them apart from the CMGS response, it will give the message count . I have attached the file GSM ERROR MONITORING.docx for your reference.

    Katie Pier said:

    In addition, I see that you are using some software delay by simply counting down in a loop - perhaps the compiler has somehow optimized this out since it doesn't do anything, or it is not taking the correct number of cycles - a more reliable way is to use __delay_cycles(x); where x is the number of CPU cycles of the MSP430 that you would like to delay.

    Even after modify the code for delay as  per your suggestion also the problem is persist.

    Katie Pier said:
    It is hard to know what might be going wrong without seeing your UART_TXn function.

    The UART_Txn function is inserted.

     I have changed the compiler to IAR, to find whether is it optimization issue or not. Even then also the empty SMS only sent to the mobile. If any one else face such a issue, help me to resolve this.

    void Uart_TXn( unsigned char *str, uint16_t size, uint8_t busNum)
    {
        i = 0;
        if(busNum == 0)
        {
    		while( size > 0)
    		{
    			UCA0TXBUF = str[i++];
    			while(!(IFG2 & UCA0TXIFG));
    			size--;
    		}
    	}
    
        if (busNum == 1)
        {
    		while(size > 0)
    		{
    			UCA1TXBUF = str[i++];
    			while(!(UC1IFG & UCA1TXIFG));
    			size--;
    		}
        }
    }

    Thanks in advance.

    GSM ERROR MONITORING.docx

  • Also about my hardware connection: the SIM800L GSM module is directly connected to the UART port pins of MSP430, but for the case of SIM900A module, I am using the development board of SIM900A mosule and it has level converter in the development board. The MSP 430 operates at 3.5V and the SIM800L module operates at 3-4V.
    Does this level converter create any impact on this? If Yes means, then how did it allows to send an empty SMS?
    Thanks
  • Hi Prakash,

    This is where it would be really helpful if you were able to get access to a scope or something that could show you voltage levels during the communication, rather than just a logic analyzer which will only give you a digital interpretation of the signal. When you have the MSP430 and the SIM800L, are you powering both from the same supply or from different supplies with different voltages? There is a spec for the MSP430 that you cannot have greater than the current MSP430 Vcc + 0.3V on any pin, so if for example you have the MSP430 running at 3V and the SIM800L at 4V, you'd be violating this spec and would need a level shifter.

    Also I looked up the SIM800L module and it sounds like it can consume a lot of current - how are you powering it when it is connected to the MSP430? You will need something that can supply sufficient current without the voltage dipping down.

    Regards,

    Katie

**Attention** This is a public forum