thunderboympm
Full Member level 5
- Joined
- Sep 17, 2007
- Messages
- 243
- Helped
- 32
- Reputation
- 64
- Reaction score
- 29
- Trophy points
- 1,308
- Location
- Malappuram, India
- Activity points
- 2,469
Connecting what to the GSM module?but when I am connecting to the AE GSM MODULE
Thanks for reply sir,Hi,
I don't understand:
* when you say you use ft232, then your PIC needs to have an USB_host to operate it.
If it does work with FT232, then why not use it this way?
Connecting what to the GSM module?
A simple (hand drawn) sketch of the two situations (working and not_working) could be useful.
I assume you already read some UART troubleshooting threads here. Then you already should know that in 95% of the cases the problem is:
* wrong interface setting (baud rate, baud rate tolerance, bits per byte, start bits, stop bits, parity, handshaking...)
* or wrong voltage levels.
--> but you don't give none of the above informations.
Klaus
Are you confusing FT232 and MAX232 perhaps?
FT232 = serial to USB converter
MAX232 = Voltage level converter usually used in serial TTL to RS232 applications.
Normally you don't need a voltage level converter between GSM modules and a PIC and you should also be aware that if it is a MAX232 it inverts the signal and could result in voltages that can damage one or both connected devices.
Brian.
Sir, I am resetting OERR and giving a NOP period.OERR means overrun error, a new character arrived before the UART buffer has been read. Apparently your code isn't able to process the data in time. Did you consider an interrupt driven RX ring buffer?
A trivial point is that your code should monitor UART errors, e.g. OERR, and reset it if they occur sporadically.
OERR means overrun error, a new character arrived before the UART buffer has been read. Apparently your code isn't able to process the data in time. Did you consider an interrupt driven RX ring buffer?
A trivial point is that your code should monitor UART errors, e.g. OERR, and reset it if they occur sporadically.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 void __interrupt() ISR(void){ GIE = 0; if(RCIF){ RCIF = 0; GSMtemp = RCREG; if(GSMtemp == '+'){ plusFlag = 1; GSMindex = 0; } if(plusFlag){ GSMbuff[GSMindex] = GSMtemp; GSMindex ++; } if(GSMtemp == 'K') OKFlag = 1; if(OERR){ CREN = 0; NOP(); CREN = 1; } } GIE = 1; }
Sir, I made a buffer GSMbuff of 80.Remove the two lines that contain 'GIE', they are not needed and could cause other problems including possible 'deaf' periods where serial data is lost.
I think you are trying to capture all the characters between '+' and 'OK' but you face two problems, the first is no check for the data overflowing the size of 'GSMbuff' and other is it will fail if 'K' appears in the data before it is used as the terminator.
Brian.
That's a bit more of information.I made a code for this and successfully simulated and tested successfully in hardware (by connecting to pc). But when I connecting to GSM module the problem arises.
That's a bit more of information.
1. There may be a hardware problem, e.g. wrong or incomplete connection of the modem module, missing handshake lines etc.
I made a code for this and successfully simulated and tested successfully in hardware (by connecting to pc). But when I connecting to GSM module the problem arises...
At that time it is working as in my simulation in Proteus.
But when I am connecting to GSM module the program is not working...
Sir, as per the whole consideration.It has to be asked: Are you simulating exactly with the same 'AT' sentences used with a previously tested manual connection? If so, it is most likely a matter of timing, which could be avoided by using the flow control mentioned before.
As per the sippet you posted, it is almost senseless. Was your intent is to decode some specific sentence on the fly? Seems like you wanted to check reception of both '+' and 'K' characters not in sequence, the if's are not cascaded with else's, so any other incoming character - garbage or not (as expected on real world) would make your code act erratically (e.g: After evaluating plusFlag as true, you do not take any action otherwise) .
Just a tip: Try to simulate and validate each part of the code incrementally, not the whole, so that you can determine at what stage of the 'conversation' among microcontroller and Modem it fails.
void __interrupt() ISR(void){
if(PIR1bits.RCIF){
if(RCSTAbits.OERR){
RCSTAbits.CREN = 0;
NOP();
RCSTAbits.CREN = 1;
}
GSMbuff[GSMindex] = RCREG;
GSMindex++;
gsmFlag = 1;
}
}
while(1){
if(gsmFlag){
while(1){
if(GSMbuff[GSMindex - 1] == EOD){
gsmFlag = 0;
break;
}
if(GSMindex >= MAX_BUF_LEN)
break;
STAT = !STAT;
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?