Archived:Serial communication over USB on S60 3rd Edition devices
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.
Article Metadata
Compatibility
Platform(s): S60 3rd Edition
S60 3rd Edition, FP1
S60 3rd Edition, FP1
Article
Created: User:Technical writer 2
(08 Mar 2007)
Last edited: hamishwillee
(31 May 2013)
Overview
Serial communication over USB on S60 3rd Edition devices.
Description
The RComm API can be used to transfer data over USB serial connection. On S60 3rd Edition, loading of physical (PDD) and logical (LDD) device drivers is not required. Only the CSY module ECACM should be loaded.
The port name available for USB communication is usually "ACM::1". Some devices may support multiple ACM ports. The first port (ACM::0) is reserved for fax/modem process, but ACM::1 and onwards can be used in other applications.
A simplified example for initializing the serial port:
_LIT(CSYMOD, "ECACM");
_LIT(KACMPort1, "ACM::1");
// RComm is a client to the RCommServ Comms server
// Start this service before any connections are made.
TInt ret = StartC32();
if ( ret != KErrNone && ret != KErrAlreadyExists )
{
User::Leave ( ret );
}
// Connect to CommServer
RCommServ server;
User::LeaveIfError( server.Connect() );
// Load CSY Module
User::LeaveIfError( server.LoadCommModule( CSYMOD ) );
TBuf16<KMaxPortName> portName;
portName.Copy( KACMPort1 );
// Open the comm. port
RComm commPort;
User::LeaveIfError( commPort.Open( server, portName, ECommShared ) );
// Verify capabilities of the port and configure it
TCommCaps portCaps;
commPort.Caps( portCaps );
if (((portCaps().iRate & KCapsBps115200) == 0) |
((portCaps().iDataBits & KCapsData8) == 0) |
((portCaps().iStopBits & KCapsStop1) == 0) |
((portCaps().iParity & KCapsParityNone) == 0))
{
User::Leave( KErrNotSupported );
}
TCommConfig portCfg;
commPort.Config( portCfg );
portCfg().iRate = EBps115200;
portCfg().iParity = EParityNone;
portCfg().iDataBits = EData8;
portCfg().iStopBits = EStop1;
portCfg().iHandshake = 0;
User::LeaveIfError( commPort.SetConfig( portCfg ) );
After this you can read from and write to the port. An application listening to the port should be running on the host (PC).


(no comments yet)