Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

LOW_linkDS2480B.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           LOW_linkDS2480B.h  -  description
00003                              -------------------
00004     begin                : Sat Jul 13 2002
00005     copyright            : (C) 2002 by Harald Roelle, Helmut Reiser
00006     email                : roelle@informatik.uni-muenchen.de, reiser@informatik.uni-muenchen.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef LOW_LINKDS2480B_H
00019 #define LOW_LINKDS2480B_H
00020 
00021 
00022 
00023 #include "LOW_link.h"
00024 #include "LOW_portSerial.h"
00025 #include "LOW_sharedMemSegment.h"
00026 
00027 
00028   
00029 /** Link class for DS2480B Serial 1-Wire Line Driver with Load Sensor.
00030 
00031     DS2480B features:
00032 
00033     - Universal, common-ground serial port to 1-Wire line driver for MicroLAN applications
00034     - Works with all iButtons and MicroLANcompatible 1-Wire slave devices
00035     - Communicates at regular and Overdrive 1- Wire speed and serial port data rates of
00036       9600 (default), 19200, 57600 and 115200 bps
00037     - Supports 12V EPROM programming and stiff 5V pullup for crypto iButton, sensors and EEPROM
00038     - Load sensor to terminate the stiff pullup as the energy demand of the crypto iButton drops
00039     - Self-calibrating time base with ± 5% tolerance for serial and 1-Wire communication
00040     - Slew rate controlled 1-Wire pulldown and active pullup to accommodate long lines and
00041       reduce radiation
00042     - User-selectable RXD/TXD polarity minimizes component count when interfacing to 5V based
00043       RS232 systems or directly to UARTs
00044     - Programmable 1-Wire timing and driver characteristics accommodate a wide range of MicroLAN
00045       configurations at regular speed
00046     - Smart protocol combines data and control information without requiring extra pins
00047     - Compatible with optical, IR and RF to RS232 converters
00048     - Low cost 8-pin SOIC surface mount package
00049     - Operates over 4.5V to 5.5V from -40°C to +85°C
00050 
00051     Some notes about the class:
00052     - Should be safe to be used from multiple processes.
00053     - Uses shared memory to hold internal data where necessary.
00054 
00055     @todo Complete documentation of exceptions thrown.
00056         
00057     @author Harald Roelle, Helmut Reiser
00058  */
00059 class LOW_linkDS2480B : public LOW_link  {
00060 
00061 //=======================================================================================
00062 public: 
00063 
00064   //=====================================================================================
00065   //
00066   // type definitions
00067   //
00068   
00069   /** RS232 RXD polarity */
00070   typedef enum { RXPOL_NORM=0x00, RXPOL_INV} RXPOL_val_t;
00071  
00072   /** 1-Wire communication speeds. */
00073   typedef enum { /** 16 kbps */ normal_speed=0, flexible_speed=1, /** 142 kbps */ overdrive_speed=2 } wireSpeed_t;
00074   
00075   //! @name Configuration values.
00076   //!@{
00077   typedef enum { PDSR_15=0x00,    PDSR_2_2,  PDSR_1_65, PDSR_1_37, PDSR_1_1, PDSR_0_83, PDSR_0_7, PDSR_0_55} PDSR_val_t;
00078   typedef enum { W1LT_8=0x00,     W1LT_9,    W1LT_10,   W1LT_11,   W1LT_12,  W1LT_13,   W1LT_14,  W1LT_15}   W1LT_val_t;
00079   typedef enum { SOW0RT_3=0x00,   SOW0RT_4,  SOW0RT_5,  SOW0RT_6,  SOW0RT_7, SOW0RT_8,  SOW0RT_9, SOW0RT_10} SOW0RT_val_t;
00080   //!@}
00081 
00082     
00083   //=====================================================================================
00084   //
00085   // constructors
00086   //
00087 
00088   LOW_linkDS2480B( const LOW_portSerialFactory::portSpecifier_t &inSerPortSpec, const RXPOL_val_t inRXPOL, 
00089                    const bool inHasExternalPower, const bool inAllowProgPulse = false);
00090   
00091   /** Destructor.
00092    */
00093   ~LOW_linkDS2480B();
00094   
00095   
00096   //=====================================================================================
00097   //
00098   // Standard methods required by LOW_Link
00099   //
00100   
00101   //! @name Bus touch (write/read) methods required by LOW_Link
00102   //!@{
00103   bool touchBit( const bool inSendBit, const strongPullup_t inPullup = pullUp_NONE);
00104   uint8_t touchByte( const uint8_t inSendByte, const strongPullup_t inPullup = pullUp_NONE);
00105   byteVec_t touchBlock( const byteVec_t &inBytes, const strongPullup_t inPullup = pullUp_NONE);
00106   //!@}
00107   
00108   //! @name Bus read methods required by LOW_Link
00109   //!@{
00110   bool readDataBit( const strongPullup_t inPullup = pullUp_NONE);
00111   uint8_t readDataByte( const strongPullup_t inPullup = pullUp_NONE);
00112   void readData( byteVec_t &outBytes, const strongPullup_t inPullup = pullUp_NONE);
00113   //!@}
00114     
00115   //! @name Bus write methods required by LOW_Link
00116   //!@{
00117   void writeData( const bool inSendBit, const strongPullup_t inPullup = pullUp_NONE);
00118   void writeData( const uint8_t inSendByte, const strongPullup_t inPullup = pullUp_NONE);
00119   void writeData( const byteVec_t &inSendBytes, const strongPullup_t inPullup = pullUp_NONE);
00120   //!@}
00121   
00122   //! @name Misc methods required by LOW_Link
00123   //!@{
00124   void resetLinkAdapter();
00125   bool resetBus();
00126   void strongPullup( const unsigned long inMicroSecs);
00127   void programPulse();
00128   void doSearchSequence( const LOW_deviceIDRaw &inBranchVector, 
00129                          LOW_deviceIDRaw &outFoundID, LOW_deviceIDRaw &outDiscrVec);
00130   //!@}
00131   
00132   
00133   //=====================================================================================
00134   //
00135   // DS2480B specific methods
00136   //
00137 
00138   /** Set the 1-Wire speed mode.
00139    */
00140   void setWireSpeed( const wireSpeed_t inWireSpeed);
00141 
00142   /** Get the 1-Wire speed mode.
00143    */
00144   wireSpeed_t getWireSpeed();
00145 
00146   
00147   /** Set the Pulldown Slew Rate Control.
00148       See setPullDownSlewRate_cmd()
00149       @throw  notAllowed_error  Thrown when not in flexible speed mode.
00150    */
00151   void setPullDownSlewRate( const PDSR_val_t inPDSR);
00152 
00153   /** Get the Pulldown Slew Rate Control.
00154       See setPullDownSlewRate_cmd()
00155       @throw  notAllowed_error  Thrown when not in flexible speed mode.
00156    */
00157   PDSR_val_t getPullDownSlewRate();
00158 
00159   
00160   /** Set the Write 1 Low Time.
00161       See setWrite1LowTime_cmd()
00162       @throw  notAllowed_error  Thrown when not in flexible speed mode.
00163    */
00164   void setWrite1LowTime( const W1LT_val_t inW1LT);
00165 
00166   /** Get the Write 1 Low Time.
00167       See setWrite1LowTime_cmd()
00168       @throw  notAllowed_error  Thrown when not in flexible speed mode.
00169    */
00170   W1LT_val_t getWrite1LowTime();
00171 
00172   
00173   /** Set the Sample Offset / Write 0 Recovery time.
00174       See setSampleOffsetWrite0Rec_cmd()
00175       @throw  notAllowed_error  Thrown when not in flexible speed mode.
00176    */
00177   void setSampleOffsetWrite0Rec( const SOW0RT_val_t inSOW0RT);
00178 
00179   /** Get the Sample Offset / Write 0 Recovery time.
00180       See setSampleOffsetWrite0Rec_cmd()
00181       @throw  notAllowed_error  Thrown when not in flexible speed mode.
00182    */
00183   SOW0RT_val_t getSampleOffsetWrite0Rec();
00184 
00185 
00186     
00187 //=======================================================================================
00188 private:
00189 
00190   //=====================================================================================
00191   //
00192   // constants
00193   //
00194 
00195   //! @name Communication command bytes
00196   //!@{
00197   static const uint8_t  SerialSpeedAdapt_Cmd         = 0xc1;  /**< Communication command byte */
00198   static const uint8_t  SwitchToDataMode_Cmd         = 0xe1;  /**< Communication command byte */
00199   static const uint8_t  SwitchToCommandMode_Cmd      = 0xe3;  /**< Communication command byte */
00200   static const uint8_t  PulseTermination_Cmd         = 0xf1;  /**< Communication command byte */
00201   static const uint8_t  Reset_Cmd                    = 0xc1;  /**< Communication command byte */
00202   static const uint8_t  SearchAccel_Cmd              = 0xa1;  /**< Communication command byte */
00203   static const uint8_t  Pulse_Cmd                    = 0xe1;  /**< Communication command byte */
00204   static const uint8_t  SingleBit_Cmd                = 0x81;  /**< Communication command byte */
00205   //!@}
00206 
00207   //! @name Configuration command bytes
00208   //!@{  
00209   static const uint8_t  PullDownSlewRate_cfgCmd      = 0x01;  /**< Configuration command byte */
00210   static const uint8_t  ProgPulseDuration_cfgCmd     = 0x02;  /**< Configuration command byte */
00211   static const uint8_t  StrongPullupDuration_cfgCmd  = 0x03;  /**< Configuration command byte */
00212   static const uint8_t  Write1LowTime_cfgCmd         = 0x04;  /**< Configuration command byte */
00213   static const uint8_t  SampleOffsetWrite0Rec_cfgCmd = 0x05;  /**< Configuration command byte */
00214   static const uint8_t  LoadSensorThreshold_cfgCmd   = 0x06;  /**< Configuration command byte */
00215   static const uint8_t  RS232BaudRate_cfgCmd         = 0x07;  /**< Configuration command byte */
00216   //!@}
00217   
00218   //=====================================================================================
00219   //
00220   // type definitions
00221   //
00222     
00223   //! @name Only internally needed configuration values.
00224   //!@{
00225   /** Programming Pulse Duration values. */
00226   typedef enum { PPD_32=0x00,     PPD_64,    PPD_128,   PPD_256,   PPD_512,  PPD_1024,  PPD_2048, PPD_inf}   PPD_val_t;
00227   /** Strong Pullup Duration values. */
00228   typedef enum { SPUD_16_4=0x00,  SPUD_65_5, SPUD_131,  SPUD_262,  SPUD_524, SPUD_1048, SPUD_dyn, SPUD_inf}  SPUD_val_t;
00229   /** Load Sensor Threshold values. */
00230   typedef enum { LST_1_8=0x00,    LST_2_1,   LST_2_4,   LST_2_7,   LST_3_0,  LST_3_3,   LST_3_6,  LST_3_9}   LST_val_t;
00231   /** RS232 Baud Rate values.*/
00232   typedef enum { RBR_9_6=0x00,    RBR_19_2,  RBR_57_6,  RBR_115_2}                                           RBR_val_t;
00233   //!@}
00234 
00235   /** Bus status in reset command reply */
00236   typedef enum { oneWireShorted_busStat=0x00, presencePulse_busStat, alarmingPresencePulse_busStat, noPresencePulse_busStat} busStatus_t;
00237 
00238   /** Reset command reply */
00239   typedef struct resetAnswer_t {
00240     busStatus_t       busStatus;
00241     bool              isVppPresent;
00242     uint8_t           chipRevision;
00243   } resetAnswer_t;
00244 
00245   /** Type for internal mode flag. */
00246   typedef enum { command_mode, data_mode} internalMode_t;
00247 
00248   /** Attributes shared between processes to enable alternating use. */
00249   typedef struct sharedAttr_t {
00250     internalMode_t   internalMode;
00251     wireSpeed_t      wireSpeed;  
00252   } sharedAttr_t;
00253 
00254   
00255     
00256   //=====================================================================================
00257   //
00258   // attributes
00259   //
00260   
00261   const LOW_portSerial   *serialPort;      /**< The serial port the adapter is attached to. */
00262   LOW_sharedMemSegment   *sharedMemSeg;    /**< Shared memory segment for inter-process attribute sharing. */
00263   const RXPOL_val_t      receivePolarity;  /**< Polarity of RXD pin. */
00264     
00265   sharedAttr_t     *sharedAttr;            /**< Inter-process shared attributes. */
00266   bool             cfgCmdAvailable[8][3];  /**< Determines availability of config parameters. See initCmdAvailTable(). */
00267 
00268     
00269   //=====================================================================================
00270   /**
00271       @name DS2480B communication commands
00272       The DS2480B supports four communication function commands: Reset, Single Bit, Pulse, and
00273       Search Accelerator control. The Reset, Search Accelerator Control and Single Bit commands
00274       include bits to select the 1-Wire communication speed (regular, flexible regular, Overdrive).
00275       Even if a command does not generate activity on the 1-Wire bus, these bits are latched
00276       inside the device and will take effect immediately.
00277   */
00278   //!@{
00279 
00280   /** Send Reset command.
00281       
00282       The Reset command must be used to begin all 1-Wire communication. The speed selection
00283       included in the command code immediately takes effect. The response byte includes a code
00284       for the reaction on the 1  Wire bus (bits 0 and 1) and a code for the chip revision
00285       (bits 2 to 4). If bit 5 of the response byte reads  1,  a programming voltage is present
00286       on the VPP pin, indicating that one may try programming EPROM devices.
00287 
00288       <pre>
00289                      | BIT 7 | BIT 6 | BIT 5     | BIT 4 | BIT 3 | BIT 2  | BIT 1 | BIT 0
00290       ===============+=======+=======+===========+=======+=======+========+=======+====================
00291       Send Reset     | 1     | 1     | 0         | 0     | 00 reg. speed  | 0     | 1
00292                      |       |       |           |       | 01 flex. speed |       |
00293                      |       |       |           |       | 10 OD. speed   |       |
00294                      |       |       |           |       | 11 reg. speed  |       |
00295       ---------------+-------+-------+-----------+-------+-------+--------+-------+--------------------
00296       Response Reset | 1     | 1     | 0 no Vpp  | chip revision          | 00 1-Wire shorted
00297                      |       |       | 1 Vpp     |                        | 01 presence pulse
00298                      |       |       |   present |                        | 10 alarming presence pulse
00299                      |       |       |           |                        | 11 no presence pulse
00300       </pre>
00301    */
00302   void reset_cmd( resetAnswer_t *outAnswer);
00303 
00304   
00305   /** Send Single Bit command.
00306   
00307       The Single Bit command is used to generate a single time slot on the 1-Wire bus at the speed
00308       indicated by bits 2 and 3. The type of the time slot (Write-0 or Write-1) is determined by the
00309       logic value of bit 4. A Read Data time slot is identical to the Write-1 time slot. Bits 0 and 1
00310       of the response byte transmitted by the DS2480B at the end of the time slot reveal the value
00311       found on the 1-Wire bus when reading.
00312 
00313       For a time slot without a subsequent strong pull up, bit 1
00314       of the command must be set to 0. For a time slot immediately followed by a strong pullup bit 1
00315       must be set to 1. As soon as the strong pullup is over, the device will send a second response
00316       byte, code EFh (read 1) or ECh (read 0), depending on the value found on the 1 Wire bus when
00317       reading. The strong pullup directly following the single bit is used in conjunction with the
00318       crypto iButton.
00319 
00320       <pre>
00321                           | BIT 7 | BIT 6 | BIT 5 | BIT 4     | BIT 3 | BIT 2  | BIT 1           | BIT 0
00322       ====================+=======+=======+=======+===========+=======+========+=================+=======
00323       Send Single Bit     | 1     | 0     | 0     | 0=write 0 | 00 reg. speed  | 0 norm pullup   | 1
00324                           |       |       |       | 1=write 1 | 01 flex. speed | 1 strong pullup |
00325                           |       |       |       |           | 10 OD. speed   |   SECOND RESP.  |
00326                           |       |       |       |           | 11 reg. speed  |   BYTE FOLLOWS  |
00327       --------------------+-------+-------+-------+-----------+-------+--------+-----------------+-------
00328       Response Single Bit | 1     | 0     | 0     | same as sent               | 1-Wire read back
00329                           |       |       |       |                            | both bits same value
00330       --------------------+-------+-------+-------+-----------+-------+--------+-----------------+-------
00331       Second response Bit | 1     | 1     | 1     | 0         | 1     | 1      | 00 = read 0
00332        when pullup        |       |       |       |           |       |        | 11 = read 1
00333       </pre>
00334    */
00335   bool singleBit_cmd( const bool inBitVal, const bool inStrongPullup = false);
00336 
00337   /** Send Pulse command.
00338   
00339       The Pulse command serves several functions that are selected by the contents of bit 1 and
00340       bit 4 of the command code. The main functions are generating a strong pullup to 5V and
00341       generating 12V programming pulses for EPROM devices (if the 12V are available at the VPP pin).
00342       The secondary function of the pulse command is arming and disarming a strong pullup after every
00343       subsequent byte in Data Mode.
00344 
00345       The arm/disarm function is controlled by bit 1 of the command code. Bit 4 determines whether
00346       the device will generate a strong pullup to 5V or a 12V programming pulse. The table below
00347       summarizes these options.
00348 
00349       <pre>
00350       BIT 4 | BIT 1 | FUNCTION
00351       ======+=======+==================================
00352        0    | 0     | strong pullup to 5V and disarm
00353       ------+-------+----------------------------------
00354        1    | 0     | 12V programming pulse and disarm
00355       ------+-------+----------------------------------
00356        0    | 1     | strong pullup to 5V and arm
00357       ------+-------+----------------------------------
00358        1    | 1     | 12V programming pulse and arm
00359       ------+-------+----------------------------------
00360       </pre>
00361       
00362       The strong pullup to 5V is required to program EEPROM devices or to operate special function
00363       devices that require a higher current for a limited time after having received a  go and convert
00364       command. Therefore and because it significantly reduces the effective data throughput on the
00365       1-wire bus, the strong pullup is disarmed most of the time. Although arming or disarming is
00366       simultaneously possible while generating a programming pulse, this is not recommended since
00367       it is likely to destroy the DS2480B if non EPROM devices are connected to the 1 Wire bus.
00368 
00369       The duration of the strong pullup or programming pulse is determined by configuration parameters
00370       and ranges from a few microseconds over  dynamic  duration (strong pullup only) up to unlimited
00371       (see section Configuration Commands). However, unlimited duration is not allowed in conjunction
00372       with arming the strong pullup after every byte. As long as the DS2480B is in Command Mode the
00373       host may terminate a strong pullup or programming pulse prematurely at any time by sending the
00374       command code F1h.
00375 
00376       The response byte is generated as soon as the strong pullup or programming pulse is over (either
00377       because the predefined time has elapsed, the high current demand is over, or due to termination
00378       by the host). The response byte mainly returns the command code as sent by the host, but the 2
00379       least significant bits are undefined.
00380 
00381       If the strong pullup is armed and the device is in Data Mode, the end of the strong pullup will
00382       be signaled as code F6h if the most significant bit of the preceding data byte on the 1 Wire bus
00383       is a 1 and 76h otherwise. The host will see this response byte in addition to the response on the
00384       data byte sent.
00385           
00386       <pre>
00387                      | BIT 7 | BIT 6 | BIT 5 | BIT 4              | BIT 3 | BIT 2  | BIT 1    | BIT 0
00388       ===============+=======+=======+=======+====================+=======+========+==========+=======
00389       Send Pulse     | 1     | 1     |1      | 0 5V strong pullup | 11 pulse       | 0 disarm | 1
00390                      |       |       |       | 1 12V prog. pulse  |                | 1 arm    |
00391       ---------------+-------+-------+-------+--------------------+-------+--------+----------+-------
00392       Response Pulse | 1     | 1     |1      | same as sent                        | undefined
00393       </pre>
00394    */
00395   void pulse_cmd( const bool inArm, const bool inProgPulse = false, const bool inImmidiateTerm = false);
00396 
00397   /**
00398       The Search Accelerator Control command is used to set or reset the Search Accelerator control
00399       flag. Bit 4 of the command code contains the state to which the accelerator control flag is
00400       to be set. If the flag is set to a 1 (on) the device translates every byte received in Data Mode
00401       into a 12 bit sequence on the 1-Wire bus. Before activating the Search Accelerator, one must
00402       make sure that the strong pullup after every byte is disarmed (see Pulse Command). The Search
00403       Accelerator command does not generate a command response byte.
00404 
00405       Although the Search Accelerator Control command itself does not generate any 1-Wire activity,
00406       it can be used to select the communication speed on the 1-Wire bus. The speed selection
00407       (if different from the previous setting, e.g., from a Reset command) will take effect immediately.
00408 
00409       Command code description:
00410       <pre>
00411                     | BIT 7 | BIT 6 | BIT 5 | BIT 4              | BIT 3 | BIT 2  | BIT 1 | BIT 0
00412       ==============+=======+=======+=======+====================+=======+========+=======+=======
00413       Search Accel. | 1     | 0     | 1     | 0 accelerator off  | 00 reg. speed  | 0     | 1
00414       Control       |       |       |       | 1 = accelerator on | 01 flex. speed |       |
00415                     |       |       |       |                    | 10 OD. speed   |       |
00416                     |       |       |       |                    | 11 reg. speed  |       |
00417       </pre>
00418    */
00419   void searchAccelCtrl_cmd( const bool inAccelOn);
00420 
00421   //@}
00422 
00423 
00424   //=====================================================================================
00425   /**
00426       @name DS2480B configuration commands
00427       The DS2480B is designed to be configurable for the varying requirements of its application.
00428       When the device powers up and/or performs a master reset cycle, the hard wired default
00429       configuration settings take effect. These settings will work on a short 1-Wire bus and assume
00430       regular 1-Wire communication speed. To change these default settings and to verify the current
00431       settings, the logic of the DS2480B supports configuration commands. A summary of the available
00432       configuration parameters, their default settings at regular and Overdrive speed and their
00433       applicability is shown in Table 3.
00434 
00435       Parameters not related to the communication speed on the 1-Wire bus specify the duration of the
00436       12V programming pulse, the duration of the strong pull up to 5V, the threshold current of the
00437       load sensor for  dynamic  strong pullup duration, and the baud rate on the interface that
00438       connects the DS2480B to the host.
00439 
00440       The remaining three parameters are used to modify the 1-Wire communication wave forms if one
00441       selects  Flexible Speed.
00442 
00443       Configuration parameter overview:
00444       <pre>
00445                                   |        | Confgrable at| Default
00446       Parameter Description       |Par.Code|Reg.|Flex|Ovrd| Reg/Flex| Overdrive
00447       ============================+========+====+====+====+=========+==========
00448       Pull-Down Slew Rate Control | 001  1 |    | X  |    | 15 V/µs | 15 V/µs
00449       ----------------------------+--------+----+----+----+---------+----------
00450       Programming Pulse Duration  | 010  2 | X  | X  | X  | 512 µs  | 512 µs
00451       ----------------------------+--------+----+----+----+---------+----------
00452       Strong Pullup Duration      | 011  3 | X  | X  | X  | 524 ms  | 524 ms
00453       ----------------------------+--------+----+----+----+---------+----------
00454       Write-1 Low Time            | 100  4 |    | X  |    | 8 µs    | 1 µs
00455       ----------------------------+--------+----+----+----+---------+----------
00456       Sample Offset               | 101  5 |    | X  |    | 3 µs    | 1 µs 
00457         and Write 0 Recovery Time |        |    |    |    | 3 µs    | 3 µs
00458       ----------------------------+--------+----+----+----+---------+----------
00459       Load Sensor Threshold       | 110  6 | X  | X  | X  | 3 mA    | 3 mA
00460       ----------------------------+--------+----+----+----+---------+----------
00461       RS232 Baud Rate             | 111  7 | X  | X  | X  | 9.6 kbps| 9.6 kbps 
00462       </pre>
00463 
00464       Configuration parameter value codes:
00465       <pre>
00466                      |                  Value Codes                  |
00467       Parameter Code | 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 | Unit
00468       ===============+=====+=====+=====+=====+=====+=====+=====+=====+========
00469       001 (PDSR)     | 15  | 2.2 | 1.65| 1.37| 1.1 | 0.83| 0.7 | 0.55| V/µs
00470       ---------------+-----+-----+-----+-----+-----+-----+-----+-----+--------
00471       010 (PPD)      | 32  | 64  | 128 | 256 | 512 | 1024| 2048| inf.| µs
00472       ---------------+-----+-----+-----+-----+-----+-----+-----+-----+--------
00473       011 (SPUD)     | 16.4| 65.5| 131 | 262 | 524 | 1048| dyn.| inf.| ms
00474       ---------------+-----+-----+-----+-----+-----+-----+-----+-----+--------
00475       100 (W1LT)     | 8   | 9   | 10  | 11  | 12  | 13  | 14  | 15  | µs
00476       ---------------+-----+-----+-----+-----+-----+-----+-----+-----+--------
00477       101 (SOW0RT)   | 3   | 4   | 5   | 6   | 7   | 8   | 9   | 10  | µs
00478       ---------------+-----+-----+-----+-----+-----+-----+-----+-----+--------
00479       110 (LST)      | 1.8 | 2.1 | 2.4 | 2.7 | 3.0 | 3.3 | 3.6 | 3.9 | mA
00480       ---------------+-----+-----+-----+-----+-----+-----+-----+-----+--------
00481       111 (RBR)      | 9.6 | 19.2| 57.6|115.2| 9.6 | 19.2| 57.6|115.2| kbits/s
00482       </pre>
00483   */
00484   //!@{
00485 
00486 
00487   /** Set the Pulldown Slew Rate Control.
00488       
00489       The numbers given Pulldown Slew Rate Control are nominal values. They may vary to
00490       some extent and are almost independent of the load on the 1-Wire bus.
00491 
00492       Whenever the DS2480B begins pulling the 1-Wire bus low to initiate a time slot,
00493       for example, it first turns off the weak pullup current IWEAKPU. Then, at regular
00494       and Overdrive speeds it will generate a falling edge at a slew rate of typically
00495       15V/ms. This value is acceptable for short 1-Wire busses and adequate for
00496       communication at Overdrive speed. For MicroLAN networks of more than roughly
00497       30 meters length one should always use flexible speed. One of the parameters that
00498       is adjustable at flexible speed is the slew rate of DS2480B initiated falling
00499       edges.
00500 
00501       As extensive tests have shown, MicroLAN networks at a length of up to 300 meters
00502       will perform best if the fall time tF is in the range of 4 ± 0.5 ms. This translates
00503       into a slew rate of approximately 1V/ms. If the actual measured fall time is longer
00504       than the target value, one should use a value of 1.37 V/µs or higher. If the fall
00505       time is shorter, one should use a value of 0.83 V/µs or lower.
00506 
00507       <B>Note:</B> This is the raw command version. No checking if the parameter is
00508                    selectable in the current 1-Wire speed mode is done.
00509    */
00510   void setPullDownSlewRate_cmd( const PDSR_val_t inPDSR);
00511 
00512   /** Get the Pulldown Slew Rate Control.
00513       See setPullDownSlewRate_cmd()
00514    */
00515   PDSR_val_t getPullDownSlewRate_cmd();
00516 
00517   /** Set the Programming Pulse Duration.
00518 
00519       For parameter Programming Pulse Duration one may select indefinite duration. This value,
00520       however, should only be selected if one is not going to switch the device to Data Mode.
00521       As long as the device stays in Command Mode, any pulse function (programming or
00522       strong pullup) that uses one of these parameters can be terminated by sending the
00523       command code F1h. Termination is not possible if the device is in Data Mode.
00524 
00525       <B>Note:</B> This is the raw command version. No checking if the parameter is
00526                    selectable in the current 1-Wire speed mode is done.
00527    */
00528   void setProgPulseDuration_cmd( const PPD_val_t inPPD);
00529 
00530   /** Get the Programming Pulse Duration.
00531       See setProgPulseDuration_cmd()
00532    */
00533   PPD_val_t getProgPulseDuration_cmd();
00534 
00535   
00536   /** Set the Strong Pullup Duration.
00537 
00538       For parameter Strong Pullup Duration one may select indefinite duration. This value,
00539       however, should only be selected if one is not going to switch the device to Data Mode.
00540       As long as the device stays in Command Mode, any pulse function (programming or
00541       strong pullup) that uses one of these parameters can be terminated by sending the
00542       command code F1h. Termination is not possible if the device is in Data Mode.
00543 
00544       <B>Note:</B> This is the raw command version. No checking if the parameter is
00545                    selectable in the current 1-Wire speed mode is done.
00546    */
00547   void setStrongPullupDuration_cmd( const SPUD_val_t inSPUD);
00548 
00549   /** Get the Strong Pullup Duration.
00550       See setProgPulseDuration_cmd()
00551 
00552       <B>Note:</B> This is the raw command version. No checking if the parameter is
00553                    selectable in the current 1-Wire speed mode is done.
00554    */
00555   SPUD_val_t getStrongPullupDuration_cmd();
00556 
00557 
00558   /** Set the Write 1 Low Time.
00559 
00560       <B>Note:</B> This is the raw command version. No checking if the parameter is
00561                    selectable in the current 1-Wire speed mode is done.
00562    */
00563   void setWrite1LowTime_cmd( const W1LT_val_t inW1LT);
00564 
00565   /** Get the Write 1 Low Time.
00566       See setWrite1LowTime_cmd()
00567    */
00568   W1LT_val_t getWrite1LowTime_cmd();
00569 
00570   
00571   /** Set the Sample Offset / Write 0 Recovery time.
00572 
00573       <B>Note:</B> This is the raw command version. No checking if the parameter is
00574                    selectable in the current 1-Wire speed mode is done.
00575    */
00576   void setSampleOffsetWrite0Rec_cmd( const SOW0RT_val_t inSOW0RT);
00577 
00578   /** Get the Sample Offset / Write 0 Recovery time.
00579       See setSampleOffsetWrite0Rec_cmd()
00580    */
00581   SOW0RT_val_t getSampleOffsetWrite0Rec_cmd();
00582 
00583 
00584   /** Set the Load Sensor Threshold.
00585 
00586       Parameter Load Sensor Threshold has been implemented in order to more efficiently
00587       support the high current demand of the crypto iButton. The load sensor is only active
00588       if  "dynamic"  for the Strong Pullup Duration has been selected. The nominal and
00589       default value for the load sensor threshold is 3.0 mA with a tolerance band of
00590       -25% to +80%. The sensor threshold should be left at its default value; changes should
00591       only be made to compensate for tolerances. Dynamic duration should only be used when
00592       operating crypto iButtons and not for gang-programming 1-Wire EEPROMs or measuring
00593       temperature with multiple temperature sensors converting simultaneously.
00594 
00595       <B>Note:</B> This is the raw command version. No checking if the parameter is
00596                    selectable in the current 1-Wire speed mode is done.
00597   */
00598   void setLoadSensorThreshold_cmd( const LST_val_t inLST);
00599   
00600   /** Set the Load Sensor Threshold.
00601       See setLoadSensorThreshold_cmd()
00602    */
00603   LST_val_t getLoadSensorThreshold_cmd();
00604 
00605   
00606   /** Set the RS232 Baud Rate and RXD polarity.
00607   
00608       Parameter RS232 Baud Rate has two functions. It selects the baud rate and allows
00609       inversion of the signal at the RXD pin. Note that when changing the baud rate, the
00610       DS2480B will send the command response byte at the new data rate.
00611 
00612       <B>Note:</B> This is the raw command version. No checking if the parameter is
00613                    selectable in the current 1-Wire speed mode is done.
00614    */    
00615   void setRS232BaudRate_cmd( const RBR_val_t inRBR, const RXPOL_val_t inRXPOL);
00616 
00617   /** Get the RS232 Baud Rate.
00618       See setRS232BaudRate_cmd()
00619    */
00620   RBR_val_t getRS232BaudRate_cmd();
00621 
00622   /** Get the RS232 RXD polarity.
00623       See setRS232BaudRate_cmd()
00624    */ 
00625   RXPOL_val_t getRS232RxPol_cmd();  
00626 
00627   //@}
00628 
00629 
00630   //=====================================================================================
00631   //!
00632   //! @name Internal methods 
00633   //!
00634   //@{  
00635 
00636   /** Write a config value to DS2480B and do sanity checking.
00637       <pre>
00638                                | BIT 7 | BIT 6 | BIT 5 | BIT 4 | BIT 3 | BIT 2 | BIT 1 |BIT 0
00639       =========================+=======+=======+=======+=======+=======+=======+=======+=====
00640       Send Write Parameter     | 0     |     parameter code    |  parameter value code | 1
00641       -------------------------+-------+-------+-------+-------+-------+-------+-------+-----
00642       Response Write Parameter | 0     |     same as sent      |     same as sent      | 0
00643       </pre>
00644       @param  inParamCode   Selection of configuration value to write.
00645       @param  inParamValue  Value to write.
00646       @throw comm_error  Thrown when sanity check fails.
00647    */
00648   void writeConfigValue( const uint8_t inParamCode, const uint8_t inParamValue);
00649 
00650   
00651   /** Read a config value from DS2480B and do sanity checking.
00652       <pre>
00653                                | BIT 7 | BIT 6 | BIT 5 | BIT 4 | BIT 3 | BIT 2 | BIT 1 |BIT 0
00654       =========================+=======+=======+=======+=======+=======+=======+=======+=====
00655       Send Read Parameter      | 0     | 0     | 0     | 0     |    parameter code     | 1
00656       -------------------------+-------+-------+-------+-------+-------+-------+-------+-----
00657       Response Read Parameter  | 0     |     same as sent      |  parameter value code | 0
00658       </pre>
00659       
00660       @param  inParamCode  Selection of configuration value to read.
00661       @return Read config value.
00662       @throw comm_error  Thrown when sanity check fails.
00663    */
00664   uint8_t readConfigValue( const uint8_t inParamCode);
00665 
00666   
00667   /** Switch between DS2480B data/command mode and vice versa.
00668       It is safe to call the method regardless of current state.
00669       @param  inMode  Desired DS2480 mode.
00670       @throw internal_error  Thrown on illegal transition (should never happen).
00671    */
00672   void setMode( const internalMode_t inMode);
00673 
00674   //@}
00675 
00676     
00677   //=====================================================================================
00678   //!
00679   //! @name Misc methods
00680   //!
00681   //@{
00682 
00683   /** Convert value of type strongPullup_t to SPUD_val_t.
00684       @param   inStrongPullup  Value to convert.
00685       @return  Converted value.
00686       @throw  internal_error  Thrown when conversion not possible (should not happen).
00687    */
00688   SPUD_val_t strongPullup_2_SPUD_val( const strongPullup_t inStrongPullup);
00689 
00690   
00691   /** Initialize attribute cfgCmdAvailable.
00692 
00693       <pre>
00694                                   |        |Configurable at
00695       Parameter Description       |Par.Code|Reg.|Flex|Ovrd|
00696       ============================+========+====+====+====+
00697       Pull-Down Slew Rate Control | 001  1 |    | X  |    |
00698       ----------------------------+--------+----+----+----+
00699       Programming Pulse Duration  | 010  2 | X  | X  | X  |
00700       ----------------------------+--------+----+----+----+
00701       Strong Pullup Duration      | 011  3 | X  | X  | X  |
00702       ----------------------------+--------+----+----+----+
00703       Write-1 Low Time            | 100  4 |    | X  |    |
00704       ----------------------------+--------+----+----+----+
00705       Sample Offset               | 101  5 |    | X  |    |
00706         and Write 0 Recovery Time |        |    |    |    |
00707       ----------------------------+--------+----+----+----+
00708       Load Sensor Threshold       | 110  6 | X  | X  | X  |
00709       ----------------------------+--------+----+----+----+
00710       RS232 Baud Rate             | 111  7 | X  | X  | X  |
00711       </pre>
00712    */
00713   void initCmdAvailTable();
00714 
00715   //@}
00716 
00717 };
00718 
00719 #endif

Generated on Sun Jan 12 21:07:43 2003 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001