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.

TM4C123GH6PM: GSM Interface

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: EK-TM4C123GXL

hello, is there anyone who can guide me to interface GSM module with TM4C123GH6PM. so far have no idea how to interface them and how the AT commands will me applied with the UART of TM4C

  • You need to look at the specific GSM module. Most GSM modules interface to an asynchronous serial interface (UART), but make sure you have the correct levels. (TTL compatible or RS232) You also need to understand what baud-rate your GSM module uses. I suggest you start with a development board like the EK-TM4C123GXL launch-pad. Learn to build and debug a simple program that uses a UART like "Hello World" first.
  • can you please send me some code which is linking GSM with TM4C123 so that i can get a broader idea of their interface.

  • Which GSM module do you wish to use?
  • i am going to use SIM900
  • Ahmad,
    First, you will need to inform a more precise definition of your module... I found that SIM900 can either refer to the SMD module itself, or to assembled boards which contains power supplies, serial port connectors and other associated circuitry.
    Also, be very careful with products that seem to be hobby-oriented. They come to extremes like having these lines on one of their product page:
    * Power Supply: +5V
    * Supply voltage range : 3.1-4.8V
    How can one design with such conflicting info?
    Now, more into your question: that module communicates via UART at TTL level, and in fact what you need to do is connect it to a UART port of your TM4C - provided that the voltage is kept within the accepted range (luckily TM4C123x takes 5V in most pins, careful if you port later to TM4C129x).
    As for sending commands, you simply need to send the pre-defined AT strings out the serial port. Being a popular module, there are probably open libraries out there to "facilitate" the job, having already created the strings for the more typical commands. If that's an exercise, you can create your own library by looking up documents on the module, and learning what strings (serial byte commands) are used for each of the functions.
    For all that, you will need to start by learning how to send and receive one single byte on a serial port. Look for the UART examples inside Tivaware library.
    Regards
    Bruno
  • Hi Ahmad. You definitely need a separate psu 4V/2A to supply the SIM900/800 module. DO NOT get the power from the TIVA module. You also need to connect the 'ground' of SIM900 to the 'ground' of the module along with the Tx/Rx signals/pins. You also NEED to set jumpers on SIM900 module to the TTL/3.3v - 4v positions. NOT RS-232, otherwise you'll fry TM4C. WHEN all that done, just type the AT+ command on the console of your IDE that your code needs to stream it to the serial port of the TM4C that connects to the serial of the SIM900 module. If you get an OK as a reply from the module, then you are in business. The rest is a chapter by its own and after you have succeed in the previous VERY important steps then the rest will be easy to follow.
    John

  • I am trying this code to interface GSM with TM4C123GH6PM but GSM is not responding with ok acknowledgement. Can u please point out my mistake?


    #include<Tm4C123GH6PM.H>
    void PLL_Init(void);
    void UART2_Init(void);
    void UartWrite(char*pstr);
    unsigned char Receiver(void);
    void Transmitter(unsigned char data);
    int main(void){
    unsigned char command;
    PLL_Init();
    UART2_Init();
    UartWrite("this program writes");
    UartWrite("AT");
    }
    void UART2_Init(void){
    SYSCTL->RCGCUART|=0X00000004;
    SYSCTL->RCGCGPIO|=0X00000008;
    UART2->CTL&=~0X00000002;
    UART2->IBRD=43; //----Setting Baud Rate 115200
    UART2->FBRD=26;
    UART2->LCRH=0X00000070;
    UART2->CTL|=0X00000002;
    GPIOD->AFSEL|=0XC0; 
    GPIOD->DEN|=0XC0;
    GPIOD->PCTL=(GPIOC->PCTL&0XFFFFFF00)+0X0000000C0;
    GPIOD->AMSEL&=~0XC0;
    GPIOD->DIR |=0X80;
    }
    void PLL_Init(void) {
    SYSCTL->RCC2|=0X80000000;
    SYSCTL->RCC2|=0X00000800;
    SYSCTL->RCC2=(SYSCTL->RCC2&~0X000007C0)+0X00000540;
    SYSCTL->RCC2&=~0X80000070;
    SYSCTL->RCC2&=~0X80002000;
    SYSCTL->RCC2|=0X40000000;
    SYSCTL->RCC2=(SYSCTL->RCC2&~0X1FC00000)+(4<<22);
    while((SYSCTL->RIS&0X00000040)==0){};
    SYSCTL->RCC2&=~0X00000800;
    }

    void UartWrite(char*pstr){
    while(*pstr !=0){
    Transmitter(*pstr++);
    } }
    unsigned char Receiver(void){
    while((UART1->FR&0X01)!=0){};
    return UART1->DR&0XFF;
    }
    void Transmitter(unsigned char data){
    while((UART1->FR&0X20)!=0){};
    UART1->DR=data;
    }

  • Hello ahmad,

    Check your SIM card if it is valid/working by inserting it  into a mobile phone and see if phone displays "network found" or something similar. Also make sure that your SIM card DOES NOT require a PIN. If it does, delete it from the phone's menu. After inserting it again into your module it should work. If still "defends", key in the command AT+COPS=0.

    I also note that in your code while you initialize UART2 (I didn't check the addresses), you are using UART1. Check if your problem is due to this "possible mistype", before checking on your SIM card.

    John

  • Hello Ahmad,
    You are doing the code the hard way. I strongly suggest that you use the functions in the TivaWare library to do your initialization and your UART send and receive. Please, as I suggested earlier, take a look at the example code in TivaWare such as "C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\ek-tm4c123gxl\hello".