|
| 1 | +MAX17616 no-OS driver |
| 2 | +===================== |
| 3 | + |
| 4 | +.. no-os-doxygen:: |
| 5 | + |
| 6 | +Supported Devices |
| 7 | +----------------- |
| 8 | + |
| 9 | +* `MAX17616/MAX17616A <https://www.analog.com/MAX17616>`_ |
| 10 | + |
| 11 | +Overview |
| 12 | +-------- |
| 13 | + |
| 14 | +The MAX17616/MAX17616A offers highly versatile and programmable protection |
| 15 | +boundaries for systems against input voltage faults and output overcurrent |
| 16 | +faults. Input-voltage faults (with positive polarity) are protected up to +80V |
| 17 | +(without Reverse Current Protection)/+75V (with Reverse Current Protection), by |
| 18 | +an internal nFET featuring low ON-resistance (20mΩ typ). The devices feature a |
| 19 | +programmable undervoltage-lockout (UVLO) thresholds by using external voltage- |
| 20 | +dividers. The MAX17616 features a programmable overvoltage-lockout (OVLO) while |
| 21 | +MAX17616A offers a programmable output voltage clamp function through the OVFB |
| 22 | +pin that features an output voltage limiting regulation during input transient |
| 23 | +surge events. Input undervoltage and overvoltage protection (MAX17616)/output |
| 24 | +voltage clamp function (MAX17616A) can be programmed across the entire 3V to 80V |
| 25 | +operating range. |
| 26 | + |
| 27 | +Applications |
| 28 | +------------ |
| 29 | + |
| 30 | +MAX17616 |
| 31 | +-------- |
| 32 | + |
| 33 | +* Input Voltage and Output Overcurrent Protections |
| 34 | +* Loss of Ground Protection |
| 35 | +* Surge Protection |
| 36 | + |
| 37 | +MAX17616 Device Configuration |
| 38 | +----------------------------- |
| 39 | + |
| 40 | +Driver Initialization |
| 41 | +--------------------- |
| 42 | + |
| 43 | +In order to be able to use the device, you will have to provide the support |
| 44 | +for the communication protocol (I2C) alongside other GPIO pins if needed in the |
| 45 | +specific application (depends on the way the device is used). |
| 46 | + |
| 47 | +The first API to be called is **max17616_init**. Make sure that it return 0, |
| 48 | +which means that the driver was initialized correctly. |
| 49 | + |
| 50 | +The initialization API uses the device descriptor and an initialization |
| 51 | +parameter. |
| 52 | + |
| 53 | +Status Bytes |
| 54 | +------------ |
| 55 | + |
| 56 | +Assertion in the status bytes/words indicates fault/warning in device input/ |
| 57 | +output, temperature, and communication, memory and logic. These statuses can be |
| 58 | +accessed via the **max17616_read_status** API. |
| 59 | + |
| 60 | +Telemetry |
| 61 | +--------- |
| 62 | + |
| 63 | +Measurements for each output channel can be read using the |
| 64 | +**max17616_read_telemetry_all** API. Some telemetry values includes input/output |
| 65 | +voltage, input current, temperature, and output power. |
| 66 | + |
| 67 | +MAX17616 Driver Initialization Example |
| 68 | +-------------------------------------- |
| 69 | + |
| 70 | +.. code-block:: bash |
| 71 | +
|
| 72 | + struct max17616_dev *max17616_dev; |
| 73 | +
|
| 74 | + struct no_os_i2c_init_param i2c_ip = { |
| 75 | + .device_id = I2C_DEVICE_ID, |
| 76 | + .max_speed_hz = I2C_CLK_SPEED, |
| 77 | + .platform_ops = I2C_OPS, |
| 78 | + .slave_address = I2C_ADDR, |
| 79 | + .extra = I2C_EXTRA, |
| 80 | + }; |
| 81 | +
|
| 82 | + struct max17616_init_param max17616_ip = { |
| 83 | + .i2c_init = &_i2c_ip, |
| 84 | + .chip_id = ID_MAX17616, |
| 85 | + }; |
| 86 | +
|
| 87 | + ret = max17616_init(&max17616_dev, &max17616_ip); |
| 88 | + if (ret) |
| 89 | + goto error; |
| 90 | +
|
| 91 | +MAX17616 no-OS IIO support |
| 92 | +-------------------------- |
| 93 | +
|
| 94 | +The MAX17616 IIO driver comes on top of the MAX17616 driver and offers support |
| 95 | +for interfacing IIO clients through libiio. |
| 96 | +
|
| 97 | +MAX17616 IIO Device Configuration |
| 98 | +--------------------------------- |
| 99 | +
|
| 100 | +Channels |
| 101 | +-------- |
| 102 | +
|
| 103 | +The device has a total of 15 input channels and 7 output channels: |
| 104 | +
|
| 105 | +**Telemetry Input Channels:** |
| 106 | +
|
| 107 | +* ``vin - input voltage`` |
| 108 | +* ``vout - output voltage`` |
| 109 | +* ``iout - output current`` |
| 110 | +* ``temp1 - device temperature`` |
| 111 | +* ``pout - output power (calculated from vout * iout)`` |
| 112 | +
|
| 113 | +**Status Input Channels:** |
| 114 | +
|
| 115 | +* ``status_word - 16-bit comprehensive status register (hex)`` |
| 116 | +* ``status_vout - VOUT status byte (hex)`` |
| 117 | +* ``status_iout - IOUT status byte (hex)`` |
| 118 | +* ``status_input - INPUT status byte (hex)`` |
| 119 | +* ``status_temperature - TEMPERATURE status byte (hex)`` |
| 120 | +* ``status_cml - Communication/Memory/Logic status byte (hex)`` |
| 121 | +* ``status_mfr_specific - Manufacturer-specific status byte (hex)`` |
| 122 | +* ``capability - Device capability register (hex)`` |
| 123 | +
|
| 124 | +**Control Output Channels:** |
| 125 | +
|
| 126 | +* ``operation - device operation state (0=disabled, 1=enabled)`` |
| 127 | +* ``clmode - current limit mode setting`` |
| 128 | +* ``istart_ratio - current start ratio setting`` |
| 129 | +* ``tstoc - short circuit timeout setting`` |
| 130 | +* ``istlim - current limit setting`` |
| 131 | +* ``vout_uv_fault_limit - output undervoltage fault limit setting`` |
| 132 | +
|
| 133 | +Input Channel Attributes |
| 134 | +------------------------ |
| 135 | +
|
| 136 | +The telemetry input channels (vin, vout, iout, temp1, pout) each have 2 channel |
| 137 | +attributes: |
| 138 | +
|
| 139 | +* ``raw - the raw converted value from the device using DIRECT format conversion`` |
| 140 | +* ``scale - the scale factor (always returns 1 for DIRECT format values)`` |
| 141 | +
|
| 142 | +The status input channels (status_word, status_vout, status_iout, status_input, |
| 143 | +status_temperature, status_cml, status_mfr_specific, capability) each have |
| 144 | +1 channel attribute: |
| 145 | +
|
| 146 | +* ``raw - the raw hexadecimal value of the status register`` |
| 147 | +
|
| 148 | +Output Channel Attributes |
| 149 | +------------------------- |
| 150 | +
|
| 151 | +The control output channels (operation, clmode, istart_ratio, tstoc, istlim, |
| 152 | +vout_uv_fault_limit) each have 1 channel attribute: |
| 153 | +
|
| 154 | +* ``raw - read/write the integer value of the control setting`` |
| 155 | +
|
| 156 | +Global Attributes |
| 157 | +----------------- |
| 158 | +
|
| 159 | +The device has a total of 4 global attributes: |
| 160 | +
|
| 161 | +* ``operation - device operation state (read/write: "enabled"/"disabled" or "1"/"0")`` |
| 162 | +* ``clear_faults - clears all asserted faults (write-only, write any value to trigger)`` |
| 163 | +* ``device_info - device identification information (read-only string)`` |
| 164 | +* ``fault_summary - summary of current active faults (read-only string)`` |
| 165 | +
|
| 166 | +Debug Attributes |
| 167 | +---------------- |
| 168 | +
|
| 169 | +The device has no debug attributes implemented. |
| 170 | +
|
| 171 | +MAX17616 IIO Driver Initialization Example |
| 172 | +------------------------------------------ |
| 173 | +
|
| 174 | +.. code-block:: bash |
| 175 | +
|
| 176 | + int ret; |
| 177 | +
|
| 178 | + struct max17616_iio_desc *max17616_iio_desc; |
| 179 | + struct max17616_iio_desc_init_param max17616_iio_ip = { |
| 180 | + .max17616_init_param = &max17616_ip, |
| 181 | + }; |
| 182 | +
|
| 183 | + struct iio_app_desc *app; |
| 184 | + struct iio_app_init_param app_init_param = { 0 }; |
| 185 | +
|
| 186 | + ret = max17616_iio_init(&max17616_iio_desc, &max17616_iio_ip); |
| 187 | + if (ret) |
| 188 | + return ret; |
| 189 | +
|
| 190 | + struct iio_app_device iio_devices[] = { |
| 191 | + { |
| 192 | + .name = "max17616", |
| 193 | + .dev = max17616_iio_desc, |
| 194 | + .dev_descriptor = max17616_iio_desc->iio_dev, |
| 195 | + } |
| 196 | + }; |
| 197 | +
|
| 198 | + app_init_param.devices = iio_devices; |
| 199 | + app_init_param.nb_devices = NO_OS_ARRAY_SIZE(iio_devices); |
| 200 | + app_init_param.uart_init_params = uart_ip; |
| 201 | +
|
| 202 | + ret = iio_app_init(&app, app_init_param); |
| 203 | + if (ret) |
| 204 | + return ret; |
| 205 | +
|
| 206 | + return iio_app_run(app); |
0 commit comments