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 with interfacing gsm module with Tiva c series launch pad

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,

    Maybe there are no GSM experts here to help you - your problem is more GSM related than Tiva processors.

    The best thing to do is to get more informations about the AT protocol for GSM - to read more and understand its behaviour. AFAIK for many commands, the GSM has its own response, which is different from the question so it is useless to expect the GSM to respond you in echo, with the same string.

    The best thing you can do is to think about and try to build a parser for GSM rsponses, since each command sent may respond with OK, error, strings and so on.

    Petrei

  • Hello Surendra,

    i.. really tried hard to understand your problem. So here goes.

    If i understood you right, you are complaining that what you send to the GSM Module over your UART is coming right back at you, correct? So the GSM Module is in a sort of Echo-Mode. It would've helped loads if you told us which GSM-Module you are using so we could check the datasheet but..

    Well at least the GSM-Module is sending something back! Try to send AT&F and then AT&W to reset most GSM Modules back to standard settings. From there on, you can figure out why the Echo mode is on, what baudrate to work on etc.

    As Petrei said though, you are in the TivaC Forums. I'll be glad to help, but after all you should restrain your questions concerning external stuff you interface with.

    Sincerely,

     

    Michel

     

  • Surendra,

    Taking into account your previous question posted here: http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/377762.aspx

    how did you used (hardware) the UART1 to link to GSM modem? Use plain language, not short-short SMS style phrases.

    Petrei

    EDIT[06:37]: you do not need to play with enabling/disabling UART interrupts, take into account these are wrong placed into the code posted. (i.e you may have more receive interrupts, and at the first one you disable further receivings...)

  • Hai Petrei

              I will connect the GSM modem  like this  PB0(U1--->rx)and PB1(U1---->tx)

    U1 rx will connected to the transmitter of the GSM modem

    U1 tx will connected to the receiver of the GSM modem