i would like to interface GSM SIM800 module with Tiva c series coordinator.
and to send AT commands to GSM module with uart of TM4C.i want to published MQTT data over GPRS using SIM800 and AT commands
if i send
"AT\r\n" I receive back
"AT"
OK
"\"AT+CSTT=\"BSNLNET\"\n\r\0" I receive back
"AT+CSTT="BSNLNE expected
AT+CSTT="BSNLNET"
OK
here is my code
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
//#include "inc/tm4c123gh6pm.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "driverlib/debug.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.h"
#include "driverlib/uart.h"
char ok[]="OK\r\n";
char receivechar[50];
int count=0;
int count1=0;
unsigned int i,j;
void UARTTransmitCommand( char *p)
{
while(*p!='\0')
{
ROM_UARTCharPutNonBlocking(UART1_BASE, *p);
p++;
}
ROM_IntEnable(INT_UART1);
}
// The error routine that is called if the driver library encounters an error.
//
//*****************************************************************************
#ifdef DEBUG
void
__error__(char *pcFilename, uint32_t ui32Line)
{
}
#endif
//*****************************************************************************
// The UART interrupt handler.
/************************************************************/
void
UART1IntHandler(void)
{
uint32_t ui32Status;
++count1;
//
// Get the interrrupt status.
//
ui32Status = ROM_UARTIntStatus(UART1_BASE, true);
//
// Clear the asserted interrupts.
ROM_UARTIntClear(UART1_BASE, ui32Status);
// Loop while there are characters in the receive FIFO.
//
while(ROM_UARTCharsAvail(UART1_BASE))
{
receivechar[count]=ROM_UARTCharGetNonBlocking(UART1_BASE);
ROM_UARTCharPutNonBlocking(UART0_BASE, receivechar[count]);
count++;
if(count==50);
count=0;
}
ROM_IntDisable(INT_UART1);
}
/********************************************************/
int
main(void)
{
//
// Enable lazy stacking for interrupt handlers. This allows floating-point
// //instructions to be used within interrupt handlers, but at the expense of
// extra stack usage.
//
ROM_FPUEnable();
ROM_FPULazyStackingEnable();
//
// Set the clocking to run directly from the crystal.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Enable the peripherals used by this example.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
//
// Enable processor interrupts.
//
ROM_IntMasterEnable();
//
// Set GPIO B0 and B1 as UART pins.
//
GPIOPinConfigure(GPIO_PB0_U1RX);
GPIOPinConfigure(GPIO_PB1_U1TX);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Configure the UART for 115,200, 8-N-1 operation.
//
ROM_UARTConfigSetExpClk(UART1_BASE, ROM_SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
//
// Enable the UART interrupt.
ROM_UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT);
ROM_UARTFIFOEnable(UART1_BASE);
UARTFIFOLevelSet(UART1_BASE, UART_FIFO_TX1_8, UART_FIFO_RX1_8);
ROM_UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
ROM_UARTFIFOEnable(UART0_BASE);
UARTFIFOLevelSet(UART0_BASE, UART_FIFO_TX1_8, UART_FIFO_RX1_8);
UARTEnable (UART0_BASE);
UARTEnable (UART1_BASE);
while(1)
{
do
{
UARTTransmitCommand("AT\r\n");
SysCtlDelay(SysCtlClockGet());
SysCtlDelay(SysCtlClockGet());
SysCtlDelay(SysCtlClockGet());
break;
}while((strcmp(ok,receivechar))!=0);
do
{
UARTTransmitCommand("\"AT+CSTT=\"BSNLNET\"\n\r\0");
SysCtlDelay(SysCtlClockGet());
SysCtlDelay(SysCtlClockGet());
SysCtlDelay(SysCtlClockGet());
break;
}while((strcmp(ok,receivechar))!=0);
}
}
i get output as following

Please help me give me any suggestion.
Thanks in Advanced..............