[Tinyos-beta-commits] CVS: tinyos-1.x/beta/teps/txt tep101.txt, 1.13, 1.14

David Gay idgay at users.sourceforge.net
Thu Jul 7 13:47:42 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/beta/teps/txt
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13455

Modified Files:
	tep101.txt 
Log Message:
atmega128 hal update


Index: tep101.txt
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/teps/txt/tep101.txt,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** tep101.txt	6 Jul 2005 23:22:02 -0000	1.13
--- tep101.txt	7 Jul 2005 20:47:40 -0000	1.14
***************
*** 235,242 ****
  |                      |  conversion mode     |  mode               |
  |                      |- free running mode   |- repeat single      |
! |                      |  (repeated single    |  conversion mode    |
! |                      |  channel conversion) |- sequence mode      |
! |                      |                      |  (sequence <= 16    |
! |                      |                      |  channels)          |
  |                      |                      |- repeat sequence    |
  |                      |                      |  mode               |
--- 235,242 ----
  |                      |  conversion mode     |  mode               |
  |                      |- free running mode   |- repeat single      |
! |                      |  (channels and       |  conversion mode    |
! |                      |  reference voltages  |- sequence mode      |
! |                      |  can be switched     |  (sequence <= 16    |
! |                      |  between samples)    |  channels)          |
  |                      |                      |- repeat sequence    |
  |                      |                      |  mode               |
***************
*** 385,391 ****
         e. The ADC on ATmega128:
         
!        In the current implementation on the Atmel an ADC channel is
!        exhaustively defined by the port numer, i.e. there is no 
!        configuration mechanism (e.g. like for the MSP430):: 
         
           configuration HALADCC
--- 385,395 ----
         e. The ADC on ATmega128:
         
!        The HAL for the ATmega128 offers two interfaces: ATm128ADCSingle is
!        for collecting single samples from a given channel, and
!        ATm128ADCMultiple is for collecting multiple samples from one or
!        more channels, using the ATmega128's A/D free-running mode. Rather
!        than using a configuration mechanism, the commands of these
!        interfaces have explicit parameters for setting all A/D conversion
!        parameters:
         
           configuration HALADCC
***************
*** 395,417 ****
               interface StdControl;
               interface Resource[uint8_t client];
!              interface ATm128ADC[uint8_t port];
             }
           }
!          
!          interface ATm128ADC 
!          {
!            async command error_t getData();
!            async command error_t getContinuousData();
!            async event error_t dataReady(uint16_t data);
!          }
         
!        The Resource interface is specified in TEP 108. Before any call
!        on the ATm128ADC interface can succeed, the ADC MUST be
!        reserved via the Resource interface. After an application has
!        performed all desired operations on the ADC, it then MUST
!        release the ADC via the Resource interface.  In the meantime
!        the ADC will be blocked for all other applications, therefore an
!        application SHOULD minimize this reservation period.
          
  
  Hardware Adaptation SubLayer2 (HAL2)
--- 399,515 ----
               interface StdControl;
               interface Resource[uint8_t client];
!              interface ATm128ADCSingle[uint8_t channel];
!              interface ATm128ADCMultiple;
             }
           }
! 
! 	 interface ATm128ADCSingle
! 	 {
! 	   /**
! 	    * Initiates an ADC conversion on a given channel.
! 	    *
! 	    * @param refVoltage Select reference voltage for A/D conversion. See
! 	    *   the ATM128_ADC_VREF_xxx constants in ATm128ADC.h
! 	    * @param leftJustify TRUE to place A/D result in high-order bits 
! 	    *   (i.e., shifted left by 6 bits), low to place it in the low-order bits
! 	    * @param prescaler Prescaler value for the A/D conversion clock. Normally
! 	    *  this should be ATM128_ADC_PRESCALE to guarantee full precision. Other
! 	    *  prescalers can be used to get faster conversions. See the ATmega128
! 	    *  manual for details.
! 	    * @return TRUE if the conversion will be precise, FALSE if it will be 
! 	    *   imprecise (due to a change in refernce voltage, or switching to a
! 	    *   differential input channel)
! 	    */
! 	   async command bool getData(uint8_t refVoltage, bool leftJustify,
! 				      uint8_t prescaler);
! 
! 	   /**
! 	    * Indicates a sample has been recorded by the ADC as the result
! 	    * of a <code>getData()</code> command.
! 	    *
! 	    * @param data a 2 byte unsigned data value sampled by the ADC.
! 	    * @param precise if the conversion precise, FALSE if it wasn't. This
! 	    *   values matches the result from the <code>getData</code> call.
! 	    */	
! 	   async event void dataReady(uint16_t data, bool precise);
! 	 }
         
! 	 interface ATm128ADCMultiple
! 	 {
! 	   /**
! 	    * Initiates free-running ADC conversions, with the ability to switch 
! 	    * channels and reference-voltage with a one sample delay.
! 	    *
! 	    * @param channel Initial A/D conversion channel. The channel can 
! 	    *   be changed in the dataReady event, though these changes happen
! 	    *   with a one-sample delay (this is a hardware restriction).
! 	    * @param refVoltage Initial A/D reference voltage. See the
! 	    *   ATM128_ADC_VREF_xxx constants in ATm128ADC.h. Like the channel,
! 	    *   the reference voltage can be changed in the dataReady event with
! 	    *   a one-sample delay.
! 	    * @param leftJustify TRUE to place A/D result in high-order bits 
! 	    *   (i.e., shifted left by 6 bits), low to place it in the low-order bits
! 	    * @param prescaler Prescaler value for the A/D conversion clock. Normally
! 	    *  this should be ATM128_ADC_PRESCALE to guarantee full precision. Other
! 	    *  prescalers can be used to get faster conversions. See the ATmega128
! 	    *  manual for details.
! 	    * @return TRUE if the conversion will be precise, FALSE if it will be 
! 	    *   imprecise (due to a change in reference voltage, or switching to a
! 	    *   differential input channel)
! 	    */
! 	   async command bool getData(uint8_t channel, uint8_t refVoltage,
! 				      bool leftJustify, uint8_t prescaler);
! 
! 	   /**
! 	    * Returns the next sample in a free-running conversion. Allow the user
! 	    * to switch channels and/or reference voltages with a one sample delay.
! 	    *
! 	    * @param data a 2 byte unsigned data value sampled by the ADC.
! 	    * @param precise if this conversion was precise, FALSE if it wasn't 
! 	    *   (we assume that the second conversion after a change of reference
! 	    *   voltage or after switching to a differential channel is precise)
! 	    * @param channel Channel this sample was from.
! 	    * @param newChannel Change this parameter to switch to a new channel
! 	    *   for the second next sample.
! 	    * @param newRefVoltage Change this parameter to change the reference 
! 	    *   voltage for the second next sample.
! 	    *
! 	    * @return TRUE to continue sampling, FALSE to stop.
! 	    */	
! 	   async event bool dataReady(uint16_t data, bool precise, uint8_t channel,
! 				      uint8_t *newChannel, uint8_t *newRefVoltage);
! 	 }
! 
!        The Resource interface is specified in TEP 108. Before any call is
!        made to the ATm128ADCSingle or ATm128ADCMultiple interfaces, the ADC
!        MUST be reserved via the Resource interface. After an application
!        has performed all desired operations on the ADC, it then MUST
!        release the ADC via the Resource interface.  In the meantime the ADC
!        will be blocked for all other applications, therefore an application
!        SHOULD minimize this reservation period. The ADC MUST NOT be released
!        or stopped while an A/D conversion is in progress. Each platform MUST
!        define an ATM128_ADC_PRESCALE constant which gives maximum A/D conversion
!        precision (see the ATmega128 manual for details).
          
+        Because of the possibility that samples may be imprecise after 
+        switching channels and/or reference voltages, and because there
+        is a one sample delay on swithcing channels and reference voltages,
+        ATm128ADCMultiple is complex. Two straightforward uses are:
+ 
+        A) Acquire N samples from channel C:
+ 	  1. call getData to start sampling on channel C at the desired rate
+ 	     (note that the choice of prescalers is very limited, so you
+ 	     don't have many choices for sampling rate)
+ 	  2. ignore the first dataReady event
+ 	  3. use the results of the next N dataReady() events, return FALSE
+ 	     on the last one
+ 
+        B) Acquire one sample each from channels C1, ..., Cn (this pseudocode
+ 	  assumes that none of these channels are differential)
+ 	  1. call getData to start sampling on channel C1
+ 	  2. on the ith dataReady event switch to channel Ci+1 by changing
+ 	     *newChannel
+ 	  3. the data passed to the ith dataReady event is for channel Ci-1
+ 	     (the data from the first dataReady event is ignored)
  
  Hardware Adaptation SubLayer2 (HAL2)
***************
*** 508,514 ****
         configuration data for the platform or sensorboard.
  
!        ii. For the ADC on the ATmega128 in the current implementation
!        a port number exhaustively defines all relevant settings.
  
  
  Services 
--- 606,642 ----
         configuration data for the platform or sensorboard.
  
!        ii. Like the MSP430, the ATmega128 uses a configuration interface
!        to acquire the per-channel settings. This interface is parameterised
!        by channel number: 
! 
! 	 configuration ADCC {
! 	   provides {
! 	     interface Init;
! 	     interface StdControl;
! 	     interface Resource[uint8_t client];
! 	     interface AcquireData[uint8_t port];
! 	     interface AcquireDataNow[uint8_t port];
!              interface AcquireDataBuffered[uint8_t port];
! 	   }
! 	   uses interface ATm128ADCConfig[uint8_t port];
! 	 }
! 
! 	 interface ATm128ADCConfig {
! 	   /**
! 	    * Return the reference voltage to use for this channel
! 	    */
! 	   command uint8_t getRefVoltage();
  
+ 	   /**
+ 	    * Return the prescaler value to use for this channel
+ 	    */
+ 	   command uint8_t getPrescaler();
+ 	 }
+ 
+        If the ATm128ADCConfig interface is not wired for a particular port,
+        the default values of ATM128_ADC_VREF_OFF (use external AREF pin)
+        and ATM128_ADC_PRESCALE are used. If the ATmega128 HAL1 indicates
+        that the conversion may be imprecise, the conversion will be
+        repeated automatically.
  
  Services 



More information about the Tinyos-beta-commits mailing list