GSM Modem Problem
Discussion in "Embedded GSM Development" started by roshan Dec 17, 2008.
Wed Dec 17 2008, 04:02 pm
Hi Friend, I have completed message sending part using ARM7 and SIMCOM GSM/GPRS m22 Modem, also able to receive message using UART Interrupt.
My problem is that my received response and data is not getting stored in any buffer variable.
Please if anybody can help me out....thanx in advance....
My problem is that my received response and data is not getting stored in any buffer variable.
Please if anybody can help me out....thanx in advance....
Thu Dec 18 2008, 01:49 pm
Hi Ajay, Thanx 4 ur quick, response...as my code is too large i am sending youn in short only ISR and main......please go through it.....also i am using 2 serial port
COM1 is connected between computer and LPC2148 to see response @ terminal
COM2 is connected between GSM modem and LPC2148
In short I am using both the COM Port of ARM7(LPC2148)
COM1 is connected between computer and LPC2148 to see response @ terminal
COM2 is connected between GSM modem and LPC2148
In short I am using both the COM Port of ARM7(LPC2148)
//================================================= // UART1 ISR //================================================= void uart1ISR (void) __attribute__ ((interrupt ("IRQ"))) { uint32 u32Temp ,tempcounter=0; while((u32Temp = U1IIR & 0x0f) != UART1_NO_INTERRUPT) { if (u32Temp == UART1_RLS_INTERRUPT) { // read U0LSR to reset the interrupt u32Temp = U1LSR ; } else if ((u32Temp == UART1_RDA_INTERRUPT) || (u32Temp == UART1_CTI_INTERRUPT)) { while(U1LSR & 0x01) { UART_u8SerBuffer[UART_u32SerWrPtr] = U1RBR ; //================================================== ////////////putchar1(UART_u8SerBuffer[UART_u32SerWrPtr]); //putchar0(UART_u8SerBuffer[UART_u32SerWrPtr]); mybuffer[tempcounter]=UART_u8SerBuffer[UART_u32SerWrPtr]; UART_u32SerWrPtr++ ; tempcounter++; mybuffer[tempcounter]='\0'; //UART_u8SerBuffer[UART_u32SerWrPtr] = '\0'; //================================================== u32Temp = MAX_BUF_LEN ; if (UART_u32SerWrPtr > = u32Temp) UART_u32SerWrPtr = 0 ; } } else if (u32Temp == UART1_THRE_INTERRUPT) { if(U1LSR & 0x20) // is this condition necessary??? { UART_u32MyTi = 1 ; } } } ISR_DONE(); } int main (void) { /*-------------UART0 Interrupt not required-----------*/ /* */ /* setupISR(1,UART0_INT,uart0ISR,IRQ_SEL); */ /* */ /*-----------------------------------------------------------*/ setupISR(0,UART1_INT,uart1ISR,IRQ_SEL) ; All_UART_Init(); GSM_Init(); puts1("ATE0"); //Echo off putchar1(CR); puts1("AT+CMGF=0"); //set echo off putchar1(CR); puts0(UART_u8SerBuffer); //read response and set buffer counter zero UART_u32SerWrPtr=0; puts1("AT+CMGR=1"); //read message at index = 1 putchar1(CR); puts0(UART_u8SerBuffer); //display message UART_u32SerWrPtr=0; return 0; }
[ Edited Fri Dec 19 2008, 02:32 am ]
Powered by e107 Forum System