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.
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
can you please send me some code which is linking GSM with TM4C123 so that i can get a broader idea of their interface.
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