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.

problem regarding Interfacing TIVA C SERIES launch pad with GSM modem

Other Parts Discussed in Thread: TM4C123GH6PM

Hai

      currently i am working on TM4C123GH6PM micro controller,and here i have interfaced my micro controller to the GSM modem.And when i transmitting the command AT from my controller then it has to generate an interrupt in that interrupt handler i want to store only the "RESPONSE" of interrupt handler,but here i got the problem is the same data is also stored in side the buffer in the interrupt handler i.e what i send(same AT).......please help me about this issue.....thank u

here just i modified uart echo example....

 
#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"
 
unsigned char ok[]="OK\r\n";
unsigned char m[20];
int count=0;
int count1=0;
unsigned int i,j;
 
 
// 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))
    {
      m[count]=ROM_UARTCharGetNonBlocking(UART1_BASE);
    
     count++;
     if(count==20);
     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);
 
    //
    // Enable processor interrupts.
    //
    ROM_IntMasterEnable();
 
    //
    // Set GPIO B0 and B1 as UART pins.
    //
    GPIOPinConfigure(GPIO_PB0_U1RX);
    GPIOPinConfigure(GPIO_PB1_U1TX);
 
 
    ROM_GPIOPinTypeUART(GPIO_PORTB_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));
 
    //
    // 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);
 
    UARTEnable (UART1_BASE);
 
    while(1)
    {
                   do
                     {
 
                        tx("AT\r\n");
 
                        SysCtlDelay(SysCtlClockGet());
                        SysCtlDelay(SysCtlClockGet());
                        SysCtlDelay(SysCtlClockGet());
                        
                 }while((strcmp(ok,m))!=0);
 
                    
 
 
                       do
                          {
 
                                tx("AT+CREG=1\r\n");
 
                                SysCtlDelay(SysCtlClockGet());
                                SysCtlDelay(SysCtlClockGet());
                                SysCtlDelay(SysCtlClockGet());
 
                      }while((strcmp(ok,m))!=0);
 
 
                      do
                      {
 
                                tx("AT+CREG=?\r\n");
 
                                SysCtlDelay(SysCtlClockGet());
                                SysCtlDelay(SysCtlClockGet());
                                SysCtlDelay(SysCtlClockGet());
 
                     }while((strcmp(ok,m))!=0);
 
         
  }
 
}
void tx(unsigned char *p)
{
    while(*p!='\0')
    {
        ROM_UARTCharPutNonBlocking(UART1_BASE, *p);
            p++;
    }

  ROM_IntEnable(INT_UART1);
    
}

  • Hi Surendra,

         Post more details about your project, your code and a link the that GSM Modem.

    - kel

  • this is code what i written for my program,here main problem with echoing.....while i am comparing with my predefined string both are does not match,y because in the interrupt  handler buffer it stores the data(echoing)what i send...please help me about this issue...thank u.just i modifies uart echo example and i tested with first 3 commands.

     
    #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"
     
    unsigned char ok[]="OK\r\n";
    unsigned char m[20];
    int count=0;
    int count1=0;
    unsigned int i,j;
     
     
    // 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))
        {
          m[count]=ROM_UARTCharGetNonBlocking(UART1_BASE);
        
         count++;
         if(count==20);
         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);
     
        //
        // Enable processor interrupts.
        //
        ROM_IntMasterEnable();
     
        //
        // Set GPIO B0 and B1 as UART pins.
        //
        GPIOPinConfigure(GPIO_PB0_U1RX);
        GPIOPinConfigure(GPIO_PB1_U1TX);
     
     
        ROM_GPIOPinTypeUART(GPIO_PORTB_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));
     
        //
        // 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);
     
        UARTEnable (UART1_BASE);
     
        while(1)
        {
                       do
                         {
     
                            tx("AT\r\n");
     
                            SysCtlDelay(SysCtlClockGet());
                            SysCtlDelay(SysCtlClockGet());
                            SysCtlDelay(SysCtlClockGet());
                            
                     }while((strcmp(ok,m))!=0);
     
                        
     
     
                           do
                              {
     
                                    tx("AT+CREG=1\r\n");
     
                                    SysCtlDelay(SysCtlClockGet());
                                    SysCtlDelay(SysCtlClockGet());
                                    SysCtlDelay(SysCtlClockGet());
     
                          }while((strcmp(ok,m))!=0);
     
     
                          do
                          {
     
                                    tx("AT+CREG=?\r\n");
     
                                    SysCtlDelay(SysCtlClockGet());
                                    SysCtlDelay(SysCtlClockGet());
                                    SysCtlDelay(SysCtlClockGet());
     
                         }while((strcmp(ok,m))!=0);
     
             
      }
     
    }
    void tx(unsigned char *p)
    {
        while(*p!='\0')
        {
            ROM_UARTCharPutNonBlocking(UART1_BASE, *p);
                p++;
        }

      ROM_IntEnable(INT_UART1);
        
    }