Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
resources:tools-software:uc-drivers:ltc2672 [21 Feb 2023 02:08] Marc Sosaresources:tools-software:uc-drivers:ltc2672 [06 Apr 2023 04:42] (current) Marc Sosa
Line 1: Line 1:
 ====== LTC2672 - No-OS Driver ====== ====== LTC2672 - No-OS Driver ======
  
-===== Supported Devices =====+==== Supported Devices ====
   * [[adi>LTC2672]]   * [[adi>LTC2672]]
  
 +==== Evaluation Boards ==== 
 +  * [[ADI>DC2903A]] 
 +\\
 ===== Overview ===== ===== Overview =====
 The [[adi>LTC2672]] is a family of five-channel, 12-/16-bit current source, digital-to-analog converters (DACs) that provide five high compliance, current source outputs with guaranteed 0.6 V dropout at 200 mA. There are eight current ranges that are programmable per channel with full-scale outputs of up to 300 mA.  The [[adi>LTC2672]] is a family of five-channel, 12-/16-bit current source, digital-to-analog converters (DACs) that provide five high compliance, current source outputs with guaranteed 0.6 V dropout at 200 mA. There are eight current ranges that are programmable per channel with full-scale outputs of up to 300 mA. 
Line 12: Line 14:
 The [[adi>LTC2672]] includes a precision integrated 1.25 V reference (10 ppm/°C maximum), with the option to use an external reference. The serial peripheral interface (SPI)-compatible, 3‑wire serial interface operates on logic levels as low as 1.71 V and at clock rates as high as 50 MHz. The [[adi>LTC2672]] includes a precision integrated 1.25 V reference (10 ppm/°C maximum), with the option to use an external reference. The serial peripheral interface (SPI)-compatible, 3‑wire serial interface operates on logic levels as low as 1.71 V and at clock rates as high as 50 MHz.
  
-=== Applications === +==== Applications ==== 
-    * Tunable Lasers+    * Tunable lasers
     * Semiconductor optical amplifier biasing     * Semiconductor optical amplifier biasing
     * Resistive heaters     * Resistive heaters
-    * Current mode biasing+    * Current-mode biasing
  
-{{ :resources:tools-software:uc-drivers:dc2903_ltc2672_eval.png?250 |}}+{{ :resources:tools-software:uc-drivers:dc2903_ltc2672_eval.png?300 |}}
  
 ===== ADI No-OS ===== ===== ADI No-OS =====
-The goal of ADI Microcontroller No-OS is to be able to provide reference projects for lower end processors, which can't run Linuxor aren't running a specific operating system, to help those customers using microcontrollers with ADI parts. ADI No-OS offers **generic drivers** which can be used as a base for any microcontroller platform and also **example projects** which are using these drivers on various microcontroller platforms.  +The goal of ADI Microcontroller No-OS is to provide reference projects for lower end processors, which can't run Linux or aren't running a specific operating system, and to help those customers using microcontrollers with ADI parts. ADI No-OS offers **generic drivers**which can be used as a base for any microcontroller platform and also **example projects**which are using these drivers on various microcontroller platforms. 
- +
-For more information about ADI No-OS and supported microcontroller platforms see: [[:resources:no-os | no-OS]] +
  
 +For more information about ADI No-OS and supported microcontroller platforms, visit the [[:resources:no-os | No-OS User Guide]].
 +\\
 +\\
 ===== LTC2672 ADI No-OS driver ===== ===== LTC2672 ADI No-OS driver =====
  
-==== LTC2672 Driver Source Code ====+==== Driver Source Code ====
 The source code for LTC2672 driver can be found here:  The source code for LTC2672 driver can be found here: 
-<WRAP round download 50%>+<WRAP round center download 80%>
   * {{https://github.com/analogdevicesinc/no-OS/blob/master/drivers/dac/ltc2672/ltc2672.h|Header file of LTC2672 Driver}}   * {{https://github.com/analogdevicesinc/no-OS/blob/master/drivers/dac/ltc2672/ltc2672.h|Header file of LTC2672 Driver}}
   * {{https://github.com/analogdevicesinc/no-OS/blob/master/drivers/dac/ltc2672/ltc2672.c|Implementation of LTC2672 Driver}}   * {{https://github.com/analogdevicesinc/no-OS/blob/master/drivers/dac/ltc2672/ltc2672.c|Implementation of LTC2672 Driver}}
 </WRAP> </WRAP>
  
-The driver also uses the ADI util library, so make sure you also add the necessary files in your project. The source code for the util library can be found here: +This driver also uses the ADI utility library, so make sure you also add the necessary files to your project. The source code for the util library can be found here: 
-<WRAP round download 50%>+<WRAP round center download 80%>
   * {{https://github.com/analogdevicesinc/no-OS/blob/master/include/no_os_util.h| Header file of ADI util library}}   * {{https://github.com/analogdevicesinc/no-OS/blob/master/include/no_os_util.h| Header file of ADI util library}}
   * {{https://github.com/analogdevicesinc/no-OS/blob/master/util/no_os_util.c | Implementation file of ADI util library}}   * {{https://github.com/analogdevicesinc/no-OS/blob/master/util/no_os_util.c | Implementation file of ADI util library}}
 </WRAP> </WRAP>
  
-In order to be able to use this driver you will have to provide the specific implementation for the communication APIs and the specific types they use. +To use the LTC2672 No-OS Driver, you need to provide the specific implementation for the communication APIs and the specific types they use. 
-If the SPI communication is chosen, there are three functions which are called by the ADXL355 driver and have to be implemented: +If the SPI communication is chosen, there are three functions which are called by the LTC2672 driver and have to be implemented: 
-  * no_os_spi_init() – initializes the communication peripheral. +<WRAP center box 60%> 
-  * no_os_spi_write_and_read() – writes and reads data to/from the device. +| **no_os_spi_init()** | initializes the communication peripheral. | 
-  * no_os_spi_remove() – deinitializes the communication peripheral.+| **no_os_spi_write_and_read()** | writes and reads data to/from the device. | 
 +| **no_os_spi_remove()** | deinitializes the communication peripheral. 
 +</WRAP>
  
 And there are two data types that have to be defined: And there are two data types that have to be defined:
-  * no_os_spi_desc structure holding the SPI descriptor +<WRAP center box 60%> 
-  * no_os_spi_init_param structure holding the parameters for SPI initialization +| **no_os_spi_desc**  | structure holding the SPI descriptor | 
- +| **no_os_spi_init_param**  | structure holding the parameters for SPI initialization | 
-An example of a header file containing the prototypes of the functions which have to be implemented, along with some generic data types they are using can be found below:+</WRAP> 
 +An example of a header file containing the prototypes of the functions which have to be implemented, along with some generic data types they are usingcan be found below:
  
-<WRAP round download 55%>+<WRAP round center download 80%>
   * {{https://github.com/analogdevicesinc/no-OS/blob/master/include/no_os_spi.h| Generic header file for SPI Communication APIs}}   * {{https://github.com/analogdevicesinc/no-OS/blob/master/include/no_os_spi.h| Generic header file for SPI Communication APIs}}
 </WRAP> </WRAP>
  
-==== LTC2672 Code Driver Documentation ==== +==== Code Documentation ==== 
-Source code documentation for the driver is automatically generated using the Doxygen tool and it is available below:+Source code documentation for the driver is automatically generated using the Doxygen tool and can be accessed in these links: 
 +<WRAP round center download 80%>
   * [[http://analogdevicesinc.github.io/no-OS/ltc2672_8h.html|LTC2672 Header file]]   * [[http://analogdevicesinc.github.io/no-OS/ltc2672_8h.html|LTC2672 Header file]]
   * [[http://analogdevicesinc.github.io/no-OS/ltc2672_8c.html|LTC2672 Source file]]   * [[http://analogdevicesinc.github.io/no-OS/ltc2672_8c.html|LTC2672 Source file]]
 +</WRAP>
  
- +==== Device Configuration ====
-==== LTC2672 Device Configuration ====+
  
 === Driver Initialization === === Driver Initialization ===
-In order to use the device, you will have to provide the support for the communication protocol (SPI) as mentioned above. +To use the device, you need to provide the support for the communication protocol (SPI) as mentioned above. 
-The first API to be called is **ltc2672_init**. Make sure that it returns 0, indicating successful driver initialization. +\\ 
 +\\ 
 +The first API function to be called is **ltc2672_init**. Make sure that it returns 0. This indicates a successful driver initialization. 
 +\\ 
 +\\
 === Output Span Configuration === === Output Span Configuration ===
-Each channel's output span can be configured individually by using the **ltc2672_set_span_channel** API or same across all channels through the **ltc2672_set_span_all_channels** API. +  
- +Use either of the following functions to configure the channel output span: 
-<note important> The current driver and evaluation hardware only supports the default VREF and FSADJ settings of the [[adi>LTC2672]]. For settings other than the default, appropriate scaling of the output span and desired current must be performed. For reference, refer to Table 9 of [[adi>LTC2672]]. </note>+<WRAP center box 80%> 
 +| **ltc2672_set_span_channel** | allows each channel's output span to be configured individually 
 +**ltc2672_set_span_all_channels** | sets same output span across all channels | 
 +</WRAP> 
 +<note important> The current driver and evaluation hardware only supports the default VREF and FSADJ settings of the [[adi>LTC2672]]. For settings other than the default, appropriate scaling of the output span and desired current must be performed. For reference, refer to Table 9 of [[adi>LTC2672]] data sheet. </note>
  
 === Monitor Multiplexer Output Configuration === === Monitor Multiplexer Output Configuration ===
-The LTC2672 contains a multiplexer pin output which allows an external controller or Analog-to-Digital Converter (ADC) to monitor certain chip measurements. To enable this functionality, use the **ltc2672_monitor_mux** API and specify the property from the valid list of properties in the header implementation. +The [[ADI>LTC2672]] contains a multiplexer pin outputwhich allows an external controller or analog-to-digital converter (ADC) to monitor certain chip measurements. To enable this functionality, use the **ltc2672_monitor_mux** function and specify the property from the valid list of properties in the header implementation. 
- +\\ 
-== Current Measurement using Multiplexer output == +\\ 
-The output current from any one channel can be measured by configuring the multiplexer via the **ltc2672_monitor_mux** API command. Once configured, the voltage at the multiplexer output pin can be measured, and the current from the selected channel can be estimated by using the equation: +**Current Measurement using Multiplexer Output** 
 +\\ 
 +The output current from any one channel can be measured by configuring the multiplexer using the **ltc2672_monitor_mux** function. Once configured, the voltage at the multiplexer output pin can be measured, and the current from the selected channel can be estimated using the equation below
 +<code>
 I_OUTx = I_FS(mA) * V_MUX / V_REF I_OUTx = I_FS(mA) * V_MUX / V_REF
- +</code> 
-Where V_REF is the measurement from the VREF pin (~1.25V) and I_FS(mA) is the output span setting in mA. +where:  
- +\\ 
-The current isn't directly measured but instead estimated from the DAC settings of the specified channel. This means that the measurement using the above equation is only valid when the output is properly terminated (not open / dropping out) and the output span is configured to a valid value (refer to header implementation). +**V_REF** is the measurement from the VREF pin (~1.25V)
- +\\ 
-== Die Temperature Measurement using Multiplexer Output == +**I_FS(mA)** is the output span setting in mA. 
-Similar with the output current, the die temperature of the LTC2672 can also be measured through the **ltc2672_monitor_mux** function. The voltage at the multiplexer output pin varies directly with the temperature with a temperature coefficient of -3.7mV / °C. The die temperature can be estimated through the following relationship+\\ 
 +\\ 
 +The current isn't directly measuredbut instead estimated from the DAC settings of the specified channel. This means that the measurement using the above equation is only valid when the output is properly terminated (not open/dropping out) and the output span is configured to a valid value (refer to header implementation). 
 +\\ 
 +\\ 
 +**Die Temperature Measurement using Multiplexer Output** 
 +\\ 
 +Similar with the output current, the die temperature of the [[ADI>LTC2672]] can also be measured through the **ltc2672_monitor_mux** function. The voltage at the multiplexer output pin varies directly with the temperature with a temperature coefficient of -3.7 mV/°C. The die temperature can be estimated using this equation
 +<code>
 T = T0 + (V0 − V_MUX) / (3.7 mV/°C). T = T0 + (V0 − V_MUX) / (3.7 mV/°C).
- +</code> 
-Where T0 = 25°C (initial temperature) and V0 = 1.4 V (initial voltage). +where:  
 +\\ 
 +**T0 = 25°C** (initial temperature)
 +\\ 
 +**V0 = 1.4 V** (initial voltage). 
 +\\
 For calibration or more accurate measurements, the actual initial temperature and voltage can be measured and replaced on the equation above. For calibration or more accurate measurements, the actual initial temperature and voltage can be measured and replaced on the equation above.
 +\\ 
 +\\
 === Output Current Configuration === === Output Current Configuration ===
-Once the channel output spans have been set, the current output for each can now be set. Current can be set individually per channel using the **ltc2672_set_current_channel** API or similarly across all channels, given that they have the same output span, using the **ltc2672_set_current_all_channels**. 
  
-<note> When the output span of a channel/s is configured to connect to the negative supply (V-), the output current is fixed at -80mA regardless of the current set! </note>+Once the channel output spans have been setyou may now configure the output current using the following functions: 
 +|**ltc2672_set_current_channel**| allows output current to be individually set per channel | 
 +| **ltc2672_set_current_all_channels** | sets similar output current across all channels (given that they have the same output span) |
  
-== Load Termination and Combining Multiple Channels == +<note> When the output span of a channel/s is configured to connect to the negative supply (V-), the output current is fixed at -80 mA regardless of the current set! </note> 
-Each output channel of the LTC2672 can output a maximum of 300mA. In instances where current greater than 300mA is needed, multiple channels can be tied together to produce the desired level. Channels tied together must operate in the same span category which can be done via **ltc2672_set_span_all_channels**. +\\ 
 +**Load Termination and Combining Multiple Channels** 
 +\\ 
 +Each output channel of the [[ADI>LTC2672]] can output a maximum of 300 mA. In instances where current greater than 300 mA is needed, multiple channels can be tied together to produce the desired level. Channels tied together must operate in the same span categorywhich can be set using the **ltc2672_set_span_all_channels** function
  
-Once the desired channels have been set to have similar output span, the target current can then be set by configuring the same channels via **ltc2672_set_current_channel**. For example, channels 0 and 1 can be combined to produce 350mA of current by configuring one channel to have 300mA output while the other at 50mA (assuming they're operating in the same span i.e., 300mA span).+Once the desired channels have been set to have similar output span, the target current can then be set by configuring the same channels via **ltc2672_set_current_channel** function. For example, Channels 0 and 1 can be combined to produce 350 mA of current by configuring one channel to have 300 mA outputwhile the other channel to have 50 mA (assuming they're operating in the same span i.e., 300 mA span).
  
-<note> All Output pins must be terminated to GND. Unused pins must remain unconnected or floating for proper operation. </note>+<note> All output pins must be terminated to GND. Unused pins must remain unconnected or floating for proper operation. </note>
  
 === Power Down Options === === Power Down Options ===
-Single or multiple channels can be powered down by using the **ltc2672_power_down_channel** or **ltc2672_power_down_all_channels** respectively to save power. Other than the channel power down, there's also an option to power down the entire chip, shutting down all other blocks such as the internal reference, using the **ltc2672_chip_power_down** API. +To save power, you may use the following functions: 
 +**ltc2672_power_down_channel** | used to power down single or multiple channels | 
 +**ltc2672_power_down_all_channels** | used to power down all channels | 
 +| **ltc2672_chip_power_down** | used to power down the entire chip, shutting down all other blocks such as the internal reference | 
 +\\
 === Output Current Toggle Configuration === === Output Current Toggle Configuration ===
-For instances that require the DAC outputs to toggle between two levels, the LTC2672 offers a toggle function which allows two current values to be stored in a channel's DAC register A and B. Once the two current levels and desired channel/s have been identified or toggle operationthey can then be setup using the **ltc2672_setup_toggle** and **ltc2672_enable_channel** API functions. +For instances requiring the DAC outputs to toggle between two levels, the [[adi>LTC2672]] offers a toggle function which allows two current values to be stored in a channel's DAC register A and B. Once the two current levels and desired channel/s have been identified, the following functions can be used to set the toggle operation: 
- +<WRAP center box 50%> 
-Once setup, perform the toggle by repeatedly using the **ltc2672_global_toggle** API as needed. The output levels can be verified by connecting an ammeter on the output of the desired channel and measuring the current levels during state changes. + **ltc2672_setup_toggle**  
 +\\   
 + **ltc2672_enable_channel**   
 +</WRAP> 
 +Once set up, perform the toggle by repeatedly using the **ltc2672_global_toggle** function as needed. The output levels can be verified by connecting an ammeter on the output of the desired channel and measuring the current levels during state changes. 
 +\\ 
 +\\
 === Fault Register Bits === === Fault Register Bits ===
-The first 8 bits of SPI transaction response serve as fault indicators. Whenever a fault is detected, the corresponding Fault Register bit is set and is outputted on the next SPI transaction. If SPI transaction fixes any of the existing faults, the cleared fault register bit is reflected on the next SPI transaction response. The faults that are detected include open circuit detection for any of the output channels, overtemperature detection (> 175°C) with thermal protection, and invalid SPI transaction length (valid lengths are 24, 32 and multiple of 32 bits). +The first 8 bits of an SPI transaction response serve as fault indicators. Whenever a fault is detected, the corresponding Fault Register bit is set and is outputted on the next SPI transaction. If an SPI transaction fixes any of the existing faults, the cleared fault register bit is reflected on the next SPI transaction response. The faults that are detected include open circuit detection for any of the output channels, overtemperature detection (> 175°C) with thermal protection, and invalid SPI transaction length (valid lengths are 24, 32and multiple of 32 bits). 
 +\\ 
 +\\
 == Configuration Command == == Configuration Command ==
-Using the **ltc2672_config_command** allows disabling of any of the active fault detection mechanisms of the part. The open circuit detection and thermal protection mechanism can be disabled via this command. The external reference operation is also configurable via this command. For the valid corresponding mask or values, refer to the device data sheet. 
  
-==== LTC2672 Driver Initialization Example ====+|**ltc2672_config_command** | allows disabling of any of the active fault detection mechanisms. This function can also disable the open circuit detection and thermal protection mechanism, as well as provide means to configure the external reference operation. | 
 + 
 +For the valid corresponding mask or values, refer to the device data sheet. 
 +\\ 
 +\\ 
 +==== Driver Initialization Example ====
  
 === Example Initialization Using Maxim SDK as Platform === === Example Initialization Using Maxim SDK as Platform ===
Line 127: Line 171:
     int ret;     int ret;
  
-    struct ltc2672_dev *ltc_dac;+    struct ltc2672_dev *ltc2672_desc;
          
     struct max_spi_init_param spi_extra = {     struct max_spi_init_param spi_extra = {
Line 134: Line 178:
     };     };
  
-    struct ltc2672_init_param init_params_dac = { +    struct ltc2672_init_param ltc2672_init_params = { 
-    .spi_init.device_id = 1, // tested using id = 2 (VDDIOH)+    .spi_init.device_id = 1, 
  .spi_init.max_speed_hz = 2000000,  .spi_init.max_speed_hz = 2000000,
  .spi_init.chip_select = 0,  .spi_init.chip_select = 0,
- .spi_init.mode = NO_OS_SPI_MODE_0, // Mode 0 for LTC2672+ .spi_init.mode = NO_OS_SPI_MODE_0, 
  .spi_init.bit_order = NO_OS_SPI_BIT_ORDER_MSB_FIRST,  .spi_init.bit_order = NO_OS_SPI_BIT_ORDER_MSB_FIRST,
- .spi_init.platform_ops = &max_spi_ops,+ .spi_init.platform_ops = &SPI_OPS,
  .spi_init.extra = &spi_extra,  .spi_init.extra = &spi_extra,
  .active_device = LTC2672_12,  .active_device = LTC2672_12,
     };     };
  
-    ret = ltc2672_init(&ltc_dac, &init_params_dac);+    ret = ltc2672_init(&ltc2672_desc, &ltc2672_init_params);
     if (ret)     if (ret)
     return ret;     return ret;
Line 154: Line 198:
  
     /* Set all channels for 6.25mA output span */     /* Set all channels for 6.25mA output span */
-    ret = ltc2672_set_span_all_channels(ltc_dac, LTC2672_100VREF);+    ret = ltc2672_set_span_all_channels(ltc2672_desc, LTC2672_100VREF);
     if (ret)     if (ret)
     return ret;     return ret;
  
     /* Set current of all channels to 3.125mA */     /* Set current of all channels to 3.125mA */
-    ret = ltc2672_set_current_all_channels(ltc_dac, current_set);+    ret = ltc2672_set_current_all_channels(ltc2672_desc, current_set);
     if (ret)     if (ret)
     return ret;     return ret;
  
     /* Monitor the Voltage Reference Level via Multiplexer Output */     /* Monitor the Voltage Reference Level via Multiplexer Output */
-    ret = ltc2672_monitor_mux(ltc_dac, LTC2672_MUX_VREF);+    ret = ltc2672_monitor_mux(ltc2672_desc, LTC2672_MUX_VREF);
     if (ret)     if (ret)
     return ret;     return ret;
  
     /* Power Down All channels and Voltage Reference */     /* Power Down All channels and Voltage Reference */
-    ret = ltc2672_chip_power_down(ltc_dac);+    ret = ltc2672_chip_power_down(ltc2672_desc);
     if (ret)     if (ret)
     return ret;     return ret;
  
     /* Setup Channel 3 to toggle bet. 1.5mA and 1.9mA */     /* Setup Channel 3 to toggle bet. 1.5mA and 1.9mA */
-    ret = ltc2672_setup_toggle_channel(ltc_dac, LTC2672_DAC3, 1.5, 1.9);+    ret = ltc2672_setup_toggle_channel(ltc2672_desc, LTC2672_DAC3, 1.5, 1.9);
     if (ret)     if (ret)
     return ret;     return ret;
  
     /* Enable CH3 for toggling */     /* Enable CH3 for toggling */
-    ret = ltc2672_enable_toggle_channel(ltc_dac, 8);+    ret = ltc2672_enable_toggle_channel(ltc2672_desc, 8);
     if (ret)     if (ret)
  return ret;  return ret;
Line 187: Line 231:
  toggle_flag ^= true;  toggle_flag ^= true;
  
- ret = ltc2672_global_toggle(ltc_dac, toggle_flag);+ ret = ltc2672_global_toggle(ltc2672_desc, toggle_flag);
  if (ret)  if (ret)
  return ret;  return ret;
      }      }
 </code> </code>
 +\\
 +\\
 +==== Driver Application Example ====
 +<WRAP center round tip 100%>
 +You can find application example projects for LTC2672 driver here: [[resources:eval:user-guides:dc2903a:no-os-setup|Evaluating the LTC2672]]
 +</WRAP>
  
-=== Hardware Output Checking === 
-Here are the steps on checking the hardware output when using the example code. 
-  * Step 1:  
-  * Step 2: 
-  * Step 3: 
resources/tools-software/uc-drivers/ltc2672.1676941722.txt.gz · Last modified: 21 Feb 2023 02:08 by Marc Sosa