Join Now
Quality Rating:
  • Currently 5.0 / 5
(5.0 / 5 - 1 vote cast)
Expertise Level:
  • Currently 5.0 / 5
(5.0 / 5 - 1 vote cast)

This page was last modified 12:54, 23 October 2007.

TSS000769 - SIR (Serial Infrared) communication using raw (physical) SIR frames

From Forum Nokia Wiki

ID TSS000769 Creation date October 19, 2007
Platform S60 3rd Edition, MR Devices  
Category Symbian C++ Subcategory Infrared (IR)


Overview

When developing a Symbian C++ application that uses SIR (serial infrared) communication using raw (physical) SIR frames to communicate with another type of IR-capable device, a serial port is opened to send and receive bytes via IR.

This SIR routine is explained in the article Programming IrComm3 wire raw and the glass term example in S60 3rd Edition examples demonstrates this.

This works, however, only in S60 devices which do not take IrDA framing into consideration. IrDA-compliant devices simply discard the received frames silently if the frames are not IrDA compliant.


Description

Using a port under ECUART means bypassing some IrDA protocol layers. This could be stated, in a simplified way, as "talking directly to the IrDA hardware." There are certain differences in the HW implementations that may cause compatibility problems if an application is using this low-level interface.

The differences in this case are:

1. Different port number.

2. Different handling of IRLAP framing and transparency elements.

For some devices, the ECUART level is "below" the frame handling - this means that if anything is sent over EUART, communication in both directions should be properly framed:


1. Optional XBOFs

2. BOF // the starting byte should be 0xC0

3. Payload (anything in this context)

4. Frame Checksum calculated from payload, and

5. EOF // The ending byte should be oxc1

The FCS needs to be calculated based on the payload. The CalculateCRC() method can be used to calculate the FCS based on the payload bits (0 to 5). The FCS table (fcstab) is available in the IRDA example application


void CIRDASampleExAppUi::CalculateCRC()
     {      
     TUint pppsendcrc,pppreccrc;
     iFrame.SetLength(11);
     iFrame[0] = 0x41;  // Payload bits( 0 to 5)
     iFrame[1] = 0x42;
     iFrame[2] = 0x49;
     iFrame[3] = 0x45;
     iFrame[4] = 0x45;
     iFrame[5] = 0x46;
     iFrmPointer = iFrame.Ptr();
     pppsendcrc = pppfcs16(PPPINITFCS,iFrmPointer,FRM_SIZE-4);
     iFrame[6] = pppsendcrc & 0xff;   // FCS bit
     iFrame[7] = (pppsendcrc>>8) & 0xff;
     }
TUint CIRDASampleExAppUi::pppfcs16(TUint fcs, const TUint16 *cp, TInt len)
    {
    ASSERT( sizeof (TUint16) == 2);
    for ( ; len>0; len--)
       fcs = (fcs >> 8) ^ fcstab[(fcs ^ *cp++) & 0xff];
    fcs ^= 0xffff; // complement
    return (fcs);
    }   	 


The following devices require packet-level framing and use port 2 for SIR communication:


Nokia E60

Nokia E61

Nokia E70

Nokia N71

Nokia N73

Nokia N80

Nokia N92

Nokia N93

Nokia N95


The following devices do not require packet-level framing and use port 1 for SIR communication:


Nokia 5500

Nokia E50

Nokia E62


This was tested with Nokia E60, Nokia E61 (frame compatible), and Nokia 5500, Nokia E50 (not frame compatible).

Related Discussions
Thread Thread Starter Forum Replies Last Post
Serial port commn - Glassterm example tcs_rk Symbian Networking & Messaging 1 2007-02-16 18:38
About infrared huweipm Mobile Java General 1 2003-10-16 09:27
sending photos through infrared florinstoian PC Suite API and PC Connectivity SDK 1 2003-12-17 21:43
AT Commands james_m_sharp Mobile Java General 4 2004-09-22 02:52
ASD + S60 FAQs kamaljaiswal General Symbian C++ 29 2007-09-27 19:56
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZconnectivityQ
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZKnowledgeBaseContentQ
     qfnZtypeQUqfnTypeZTechnicalSolutionQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX