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

Generated on Tue Feb 3 11:30:25 2004 for OneWireLibrary++ by doxygen 1.3.2