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.
Tool/software: TI C/C++ Compiler
currently i am working on TM4C123GH6PM micro controller,and here i have interfaced my micro controller to the SIM800 GSM/GPRS module.And when i transmitting the command AT from my controller but only first two AT command send i want to send multiple command .
here just i modified uart echo example....
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include <string.h>
#define TEST "AT\r\n\0"
#define CSTT "\"AT+CSTT=\"BSNLNET\"\n\r\0"
#define CIICR "AT+CIICR\r\n\0"
uint32_t uiFreq;
char receivechar;
uint8_t ui32i = 0;
void UARTTransmitCommand(char *cmd) //Transmit AT commands using UART
{
while(UARTBusy(UART5_BASE));
while(*cmd != '\0')
{
UARTCharPut(UART5_BASE, *cmd++);
}
}
void UARTIntHandler(void)
{
uint32_t ui32Status;
ui32Status = UARTIntStatus(UART5_BASE, true); //get interrupt status
UARTIntClear(UART5_BASE, ui32Status); //clear the asserted interrupts
while(UARTCharsAvail(UART5_BASE)) //loop while there are chars
{
// Read the next character from the UART and write it back to the UART.
//
while (ui32i !=35) {
receivechar=UARTCharGet(UART5_BASE);
UARTCharPut(UART0_BASE, receivechar);
ui32i++;
}
ui32i=0;
// Delay for 1 millisecond. Each SysCtlDelay is about 3 clocks.
//
SysCtlDelay(uiFreq / (1000 * 3));
}
}
int main(void) {
//Disable all interrupt
IntMasterDisable();
// UART 0
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
// UART 5
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART5);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinConfigure(GPIO_PE4_U5RX);
GPIOPinConfigure(GPIO_PE5_U5TX);
GPIOPinTypeUART(GPIO_PORTE_BASE, GPIO_PIN_4 | GPIO_PIN_5);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); //enable GPIO port for LED
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); //enable pin for LED PF2
UARTConfigSetExpClk(UART5_BASE, SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
IntMasterEnable(); //enable processor interrupts
IntEnable(INT_UART5); //enable the UART interrupt
UARTIntEnable(UART5_BASE, UART_INT_RX | UART_INT_RT ); //only enable RX and TX interrupts
//Master enable all interrupts
IntMasterEnable();
UARTTransmitCommand(TEST);
UARTTransmitCommand(CSTT);
SysCtlDelay(200000);
UARTTransmitCommand(CIICR);
while (1) //let interrupt handler do the UART echo function
{
}
}