The great Symbian AT command response challenge?
| Wed, 2007-03-07 14:22 | |
|
Hi, I have been fiddling with AT commands lately on my N-GAGE.I have been successful on writing the commands and then getting some response. ![]() But the good news ends there:The response is just: Code: OKOK Nothing less nothing more.For any command I get this response. The code for writing the commands and reading the response is as follows: Code: _LIT(PDD_NAME,"EUART1"); _LIT(LDD_NAME,"ECOMM"); _LIT(KCommModuleName, "dataport"); _LIT(KPort, "DATAPORT::0");//just echoes back the most recent commands//N-GAge opens ,but 6630 does not work //_LIT(KPort, "DATAPORT::1");//works on 6630 _LIT8(KATCommand,"ATQ0\r\n%S\r\n"); // Init code starts here CActiveScheduler::Add(this); iAppState = EConnecting; User::LoadPhysicalDevice (PDD_NAME); User::LoadLogicalDevice (LDD_NAME); StartC32(); User::LeaveIfError(iCommServer.Connect()); iCommServer.LoadCommModule(KCommModuleName); User::LeaveIfError(iComm.Open (iCommServer, KPort, ECommShared)); //Wait for some time User::After(2000000); //configuring the port TCommConfig portSettings; TCommConfigV01 portSettingsv01 = portSettings(); iComm.Config (portSettings); portSettingsv01.iRate = EBps19200; portSettingsv01.iParity = EParityNone; portSettingsv01.iDataBits = EData8; portSettingsv01.iStopBits = EStop1; portSettingsv01.iFifo = EFifoEnable; portSettingsv01.iHandshake = (KConfigObeyXoff | KConfigSendXoff); // for xon/xoff portSettingsv01.iTerminator[0] = 10; portSettingsv01.iTerminatorCount = 1; // so that we terminate a read on each line feed arrives User::LeaveIfError(iComm.SetConfig (portSettings)); iComm.SetSignals (KSignalDTR, 0); iComm.SetSignals (KSignalRTS, 0); TInt curlenth = iComm.ReceiveBufferLength (); iComm.SetReceiveBufferLength (4096); curlenth = iComm.ReceiveBufferLength (); CEventLogger::SLog(_L("Open done..")); // Code for writing to the port CEventLogger::SLog(_L("Writing command..")); iComm.Write(iStatus, iAtRequest); iAppState = EWriting; SetActive(); response->Des().Zero(); // Code for reading from port User::After(1000000); CEventLogger::SLog(_L("read now..")); iResponseDes.Zero(); iComm.ReadOneOrMore(iStatus, iResponseDes); iAppState = EReading; SetActive(); I have seen samples where the code is returning some response,but then am not able to gauge why it doesn't return the desired response in my case. So please can someone help me in my quest for AT command response. ![]() One more thing:DATAPORT::0 works on N-GAGE fine but not on 6630. Also DATAPORT::1 on 6630 opens but spews the same response as specified above. Thanks. --Mayur. |
|








Forum posts: 12
I think it's like all the nokia's phone : there is already a program that uses the serial port and is listening to AT command. for example on Nokia N70 this program is called "FaxModem" and you have to kill it before doing anything with the serial port...
Forum posts: 404
--Mayur.
http://symbiangeek.blogspot.com
Forum posts: 12
TBuf8<50> buf;
TFullName repName;
_LIT8(KFAXMODEM, "FaxModem" );
TFindProcess process;
for(TInt i = 0; i < 1000; i++)
{
while(process.Next(repName) != KErrNotFound)
{
buf.Copy(repName);
if ( (buf.Find(KFAXMODEM) != KErrNotFound) )
{
RProcess aProcess;
aProcess.Open(process);
aProcess.Kill(0);
aProcess.Close();
}
}
}
instead of "FaxModem" you put the name of the task
Forum posts: 404
I have seen some posts where they have been able to do this stuff without killing any other process.
Any other ideas are welcome?
--Mayur.
http://symbiangeek.blogspot.com
Forum posts: 80
Hi Mayur,
Please let me know if you have tested this code on Nokia 6600 or Nokia 6670.
My application goes into an infinite loop when I try to read the data from the port. Writing to the port gives no error and request completes successfully.
I am using the same code as u have posted here, only that I am not using an Active Object but waiting on the request as follows:
TBuf8<512> aDes;
comm.Read(status, aDes);
User::WaitForRequest(status);
How much time does it normally take to receive the response of an AT command??
plz do reply....
regards,
jp
Forum posts: 80
I have at least managed to get a response by using ReadOneOrMore in place of Read function.
But now the problem is that, no matter how much delay I keep between write and read, in response I get the same command back.
Whereas I should be getting an "OK" in response..
Any ideas what the problem is?