Go to the documentation of this file.
54 #define AD5755_LDAC_OUT no_os_gpio_direction_output(dev->gpio_ldac, \
56 #define AD5755_LDAC_LOW no_os_gpio_set_value(dev->gpio_ldac, \
58 #define AD5755_LDAC_HIGH no_os_gpio_set_value(dev->gpio_ldac, \
62 #define AD5755_RESET_OUT no_os_gpio_direction_output(dev->gpio_rst, \
64 #define AD5755_RESET_LOW no_os_gpio_set_value(dev->gpio_rst, \
66 #define AD5755_RESET_HIGH no_os_gpio_set_value(dev->gpio_rst, \
70 #define AD5755_CLEAR_OUT no_os_gpio_direction_output(dev->gpio_clr, \
72 #define AD5755_CLEAR_LOW no_os_gpio_set_value(dev->gpio_clr, \
74 #define AD5755_CLEAR_HIGH no_os_gpio_set_value(dev->gpio_clr, \
78 #define AD5755_POC_OUT no_os_gpio_direction_output(dev->gpio_poc, \
80 #define AD5755_POC_LOW no_os_gpio_set_value(dev->gpio_poc, \
82 #define AD5755_POC_HIGH no_os_gpio_set_value(dev->gpio_poc, \
86 #define AD5755_ISR_WRITE (0ul << 23)
87 #define AD5755_ISR_DUT_AD1(x) (((x) & 0x1) << 22)
88 #define AD5755_ISR_DUT_AD0(x) (((x) & 0x1) << 21)
89 #define AD5755_ISR_DREG(x) (((x) & 0x7) << 18)
90 #define AD5755_ISR_DAC_AD(x) (((x) & 0x3) << 16)
91 #define AD5755_ISR_DATA(x) ((x) & 0xFFFF)
94 #define AD5755_ISR_NOP 0x1CE000
97 #define AD5755_DREG_WR_DAC 0
98 #define AD5755_DREG_WR_GAIN 2
99 #define AD5755_DREG_WR_GAIN_ALL 3
100 #define AD5755_DREG_WR_OFFSET 4
101 #define AD5755_DREG_WR_OFFSET_ALL 5
102 #define AD5755_DREG_WR_CLR_CODE 6
103 #define AD5755_DREG_WR_CTRL_REG 7
106 #define AD5755_DAC_A 0
107 #define AD5755_DAC_B 1
108 #define AD5755_DAC_C 2
109 #define AD5755_DAC_D 3
112 #define AD5755_GAIN_ADJUSTMENT(x) ((x) & 0xFFFF)
115 #define AD5755_OFFSET_ADJUSTMENT(x) ((x) & 0xFFFF)
118 #define AD5755_CLEAR_CODE(x) ((x) & 0xFFFF)
121 #define AD5755_CTRL_CREG(x) (((x) & 0x7) << 13)
122 #define AD5755_CTRL_DATA(x) ((x) & 0x1FFF)
125 #define AD5755_CREG_SLEW 0 // Slew rate control register(one per channel)
126 #define AD5755_CREG_MAIN 1 // Main control register
127 #define AD5755_CREG_DAC 2 // DAC control register(one per channel)
128 #define AD5755_CREG_DC_DC 3 // DC-to-dc control register
129 #define AD5755_CREG_SOFT 4 // Software register
132 #define AD5755_SLEW_SREN (1 << 12)
133 #define AD5755_SLEW_SR_CLOCK(x) (((x) & 0xF) << 3)
134 #define AD5755_SLEW_SR_STEP(x) (((x) & 0x7) << 0)
137 #define AD5755_SR_CLK_64K 0
138 #define AD5755_SR_CLK_32k 1
139 #define AD5755_SR_CLK_16k 2
140 #define AD5755_SR_CLK_8K 3
141 #define AD5755_SR_CLK_4K 4
142 #define AD5755_SR_CLK_2K 5
143 #define AD5755_SR_CLK_1K 6
144 #define AD5755_SR_CLK_500 7
145 #define AD5755_SR_CLK_250 8
146 #define AD5755_SR_CLK_125 9
147 #define AD5755_SR_CLK_64 10
148 #define AD5755_SR_CLK_32 11
149 #define AD5755_SR_CLK_16 12
150 #define AD5755_SR_CLK_8 13
151 #define AD5755_SR_CLK_4 14
152 #define AD5755_SR_CLK_0_5 15
155 #define AD5755_STEP_1 0
156 #define AD5755_STEP_2 1
157 #define AD5755_STEP_4 2
158 #define AD5755_STEP_16 3
159 #define AD5755_STEP_32 4
160 #define AD5755_STEP_64 5
161 #define AD5755_STEP_128 6
162 #define AD5755_STEP_256 7
165 #define AD5755_MAIN_POC (1 << 12)
166 #define AD5755_MAIN_STATREAD (1 << 11)
167 #define AD5755_MAIN_EWD (1 <<10)
168 #define AD5755_MAIN_WD(x) (((x) & 0x3) << 8)
169 #define AD5755_MAIN_SHTCCTLIM(x) (((x) & 0x1) << 6)
170 #define AD5755_MAIN_OUTEN_ALL (1 << 5)
171 #define AD5755_MAIN_DCDC_ALL (1 << 4)
174 #define AD5755_WD_5MS 0 // 5 ms timeout period
175 #define AD5755_WD_10MS 1 // 10 ms timeout period
176 #define AD5755_WD_100MS 2 // 100 ms timeout period
177 #define AD5755_WD_200MS 3 // 200 ms timeout period
180 #define AD5755_LIMIT_16_MA 0 // 16 mA (default)
181 #define AD5755_LIMIT_8_MA 1 // 8 mA
184 #define AD5755_DAC_INT_ENABLE (1 << 8)
185 #define AD5755_DAC_CLR_EN (1 << 7)
186 #define AD5755_DAC_OUTEN (1 << 6)
187 #define AD5755_DAC_RSET (1 << 5)
188 #define AD5755_DAC_DC_DC (1 << 4)
189 #define AD5755_DAC_OVRNG (1 << 3)
190 #define AD5755_DAC_R(x) ((x) & 0x7)
193 #define AD5755_R_0_5_V 0 // 0 V to 5 V voltage range (default)
194 #define AD5755_R_0_10_V 1 // 0 V to 10 V voltage range
195 #define AD5755_R_M5_P5_V 2 // -5 V to +5 V voltage range
196 #define AD5755_R_M10_P10_V 3 // -10 V to 10 V voltage range
197 #define AD5755_R_4_20_MA 4 // 4 mA to 20 mA current range
198 #define AD5755_R_0_20_MA 5 // 0 mA to 20 mA current range
199 #define AD5755_R_0_24_MA 6 // 0 mA to 24 mA current range
202 #define AD5755_DC_DC_COMP (1 << 6)
203 #define AD5755_DC_DC_PHASE(x) (((x) & 0x3) << 4)
204 #define AD5755_DC_DC_FREQ(x) (((x) & 0x3) << 2)
205 #define AD5755_DC_DC_MAX_V(x) (((x) & 0x3) << 0)
208 #define AD5755_PHASE_ALL_DC_DC 0 // all dc-dc converters clock on same edge
209 #define AD5755_PHASE_AB_CD 1 // Ch A,B clk same edge, C,D opposite edge
210 #define AD5755_PHASE_AC_BD 2 // Ch A,C clk same edge, B,D opposite edge
211 #define AD5755_PHASE_A_B_C_D_90 3 // A,B,C,D clock 90 degree out of phase
214 #define AD5755_FREQ_250_HZ 0 // 250 +/- 10% kHz
215 #define AD5755_FREQ_410_HZ 1 // 410 +/- 10% kHz
216 #define AD5755_FREQ_650_HZ 2 // 650 +/- 10% kHz
219 #define AD5755_MAX_23V 0 // 23 V + 1 V/-1.5 V (default)
220 #define AD5755_MAX_24_5V 1 // 24.5 V +/- 1 V
221 #define AD5755_MAX_27V 2 // 27 V +/- 1 V
222 #define AD5755_MAX_29_5V 3 // 29.5 V +/- 1V
225 #define AD5755_SOFT_USER_BIT (1 << 12)
226 #define AD5755_SOFT_RESET_CODE(x) ((x) & 0xFFF)
229 #define AD5755_RESET_CODE 0x555 // Performs a reset of the AD5755.
230 #define AD5755_SPI_CODE 0x195 // If watchdog is enabled, 0x195 must be
235 #define AD5755_ISR_READ (1 << 23)
241 #define AD5755_ISR_RD(x) (((x) & 0x1F) << 16)
244 #define AD5755_RD_DATA_REG(x) (((x) & 0x3) + 0)
245 #define AD5755_RD_CTRL_REG(x) (((x) & 0x3) + 4)
246 #define AD5755_RD_GAIN_REG(x) (((x) & 0x3) + 8)
247 #define AD5755_RD_OFFSET_REG(x) (((x) & 0x3) + 12)
248 #define AD5755_RD_CODE_REG(x) (((x) & 0x3) + 16)
249 #define AD5755_RD_SR_CTRL_REG(x) (((x) & 0x3) + 20)
250 #define AD5755_RD_STATUS_REG 24
251 #define AD5755_RD_MAIN_CTRL_REG 25
252 #define AD5755_RD_Dc_DC_CTRL_REG 26
256 #define AD5755_STATUS_DC_DC(x) (1 << (12 + (x)))
257 #define AD5755_STATUS_USER_BIT (1 << 11)
258 #define AD5755_STATUS_PEC_ERROR (1 << 10)
259 #define AD5755_STATUS_RAMP_ACTIVE (1 << 9)
260 #define AD5755_STATUS_OVER_TEMP (1 << 8)
262 #define AD5755_STATUS_VOUT_FAULT(x) (1 << (4 + (x)))
263 #define AD5755_STATUS_IOUT_FAULT(x) (1 << (0 + (x)))
265 #define AD5755_CRC_POLYNOMIAL 0x07 // P(x)=x^8+x^2+x^1+1 = 100000111
266 #define AD5755_CRC_CHECK_CODE 0x00
371 uint8_t register_address);
375 uint8_t register_address,
377 uint16_t register_value);
392 uint8_t ctrl_reg_address,
398 uint8_t bytes_number);
433 #endif // __AD5755_H__
uint8_t rset_bits[4]
Definition: ad5755.h:306
float ad5755_set_current(struct ad5755_dev *dev, uint8_t channel, float m_acurrent)
Sets the output current of a channel.
Definition: ad5755.c:711
float ad5755_set_voltage(struct ad5755_dev *dev, uint8_t channel, float voltage)
Sets the output voltage of a channel.
Definition: ad5755.c:619
uint32_t timeout
Definition: ad413x.c:49
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
uint8_t dc_dc_max_vbit
Definition: ad5755.h:323
uint8_t dc_dc_freq_bit
Definition: ad5755.h:319
float ad5755_set_voltage(struct ad5755_dev *dev, uint8_t channel, float voltage)
Sets the output voltage of a channel.
Definition: ad5755.c:619
#define AD5755_RD_MAIN_CTRL_REG
Definition: ad5755.h:251
struct no_os_gpio_desc * gpio_ldac
Definition: ad5755.h:337
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:159
struct no_os_spi_desc * spi_desc
Definition: ad5755.h:335
Header file of SPI Interface.
#define AD5755_DAC_INT_ENABLE
Definition: ad5755.h:184
#define AD5755_CRC_CHECK_CODE
Definition: ad5755.h:266
float ad5755_set_current(struct ad5755_dev *dev, uint8_t channel, float m_acurrent)
Sets the output current of a channel.
Definition: ad5755.c:711
struct no_os_gpio_desc * gpio_rst
Definition: ad5755.h:338
#define AD5755_DAC_CLR_EN
Definition: ad5755.h:185
struct ad5755_setup * p_ad5755_st
Definition: ad5755.h:342
ad5755_type_t
Definition: ad5755.h:327
Header file of AD5755 Driver Configuration.
#define AD5755_SLEW_SREN
Definition: ad5755.h:132
Header file of Delay functions.
void ad5755_software_reset(struct ad5755_dev *dev)
Performs a software reset to the device.
Definition: ad5755.c:304
#define AD5755_RD_GAIN_REG(x)
Definition: ad5755.h:246
#define AD5755_MAIN_WD(x)
Definition: ad5755.h:168
enum ad5755_type_t this_device
Definition: ad5755.h:343
#define AD5755_DC_DC_FREQ(x)
Definition: ad5755.h:204
#define AD5755_DAC_A
Definition: ad5755.h:106
#define AD5755_ISR_RD(x)
Definition: ad5755.h:241
struct no_os_gpio_init_param gpio_clr
Definition: ad5755.h:352
Definition: ad9361_util.h:69
#define AD5755_MAIN_POC
Definition: ad5755.h:165
#define AD5755_LDAC_OUT
Definition: ad5755.h:54
#define AD5755_ISR_DATA(x)
Definition: ad5755.h:91
#define AD5755_CREG_DC_DC
Definition: ad5755.h:128
uint8_t dc_dc_comp_bit
Definition: ad5755.h:313
void ad5755_channel_clear_enable(struct ad5755_dev *dev, uint8_t channel, uint8_t clear_en)
Selects if the channel clears when CLEAR pin is activated.
Definition: ad5755.c:545
int32_t ad5755_get_register_value(struct ad5755_dev *dev, uint8_t register_address)
Reads the value of a register.
Definition: ad5755.c:193
void ad5755_feed_watch_dog_timer(struct ad5755_dev *dev)
Write a "service pulse" to the AD5755 watchdog timer when enabled.
Definition: ad5755.c:353
#define AD5755_ISR_DUT_AD0(x)
Definition: ad5755.h:88
#define AD5755_DREG_WR_DAC
Definition: ad5755.h:97
uint8_t sht_cc_lim_bit
Definition: ad5755.h:300
struct no_os_gpio_desc * gpio_clr
Definition: ad5755.h:339
#define AD5755_CREG_MAIN
Definition: ad5755.h:126
#define AD5755_ISR_DREG(x)
Definition: ad5755.h:89
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
#define AD5755_POC_LOW
Definition: ad5755.h:80
#define AD5755_DC_DC_MAX_V(x)
Definition: ad5755.h:205
void ad5755_watch_dog_setup(struct ad5755_dev *dev, uint8_t wtd_enable, uint8_t timeout)
Enables/Disables watchdog timer and sets the timeout period.
Definition: ad5755.c:327
#define AD5755_R_0_10_V
Definition: ad5755.h:194
@ ID_AD5757
Definition: ad5755.h:330
void ad5755_channel_clear_enable(struct ad5755_dev *dev, uint8_t channel, uint8_t clear_en)
Selects if the channel clears when CLEAR pin is activated.
Definition: ad5755.c:545
#define AD5755_DREG_WR_CTRL_REG
Definition: ad5755.h:103
uint8_t poc_bit
Definition: ad5755.h:293
@ ID_AD5755
Definition: ad5755.h:328
void ad5755_slew_rate_ctrl(struct ad5755_dev *dev, int8_t channel, int8_t sr_en, int8_t updt_freq, int8_t step_size)
Configures the Digital Slew Rate Control.
Definition: ad5755.c:592
Header file of AD5755 Driver. This driver supporting the following devices: AD5755,...
#define AD5755_ISR_DAC_AD(x)
Definition: ad5755.h:90
struct no_os_gpio_init_param gpio_poc
Definition: ad5755.h:353
#define AD5755_MAIN_STATREAD
Definition: ad5755.h:166
#define AD5755_MAIN_EWD
Definition: ad5755.h:167
enum ad5755_type_t this_device
Definition: ad5755.h:355
void ad5755_set_channel_range(struct ad5755_dev *dev, uint8_t channel, uint8_t range)
Sets the range of a channel.
Definition: ad5755.c:482
uint8_t dc_dc_phase_bit
Definition: ad5755.h:317
struct ad5755_setup AD5755_st
Definition: ad5755_cfg.h:37
#define AD5755_ISR_DUT_AD1(x)
Definition: ad5755.h:87
#define AD5755_ISR_READ
Definition: ad5755.h:235
#define AD5755_DC_DC_PHASE(x)
Definition: ad5755.h:203
#define AD5755_RD_CTRL_REG(x)
Definition: ad5755.h:245
#define AD5755_LDAC_LOW
Definition: ad5755.h:56
void ad5755_feed_watch_dog_timer(struct ad5755_dev *dev)
Write a "service pulse" to the AD5755 watchdog timer when enabled.
Definition: ad5755.c:353
#define AD5755_CLEAR_OUT
Definition: ad5755.h:70
#define AD5755_ISR_NOP
Definition: ad5755.h:94
struct no_os_spi_init_param spi_init
Definition: ad5755.h:348
uint16_t ad5755_set_register_value(struct ad5755_dev *dev, uint8_t register_address, uint8_t channel, uint16_t register_value)
Writes data into a register.
Definition: ad5755.c:261
#define AD5755_SLEW_SR_STEP(x)
Definition: ad5755.h:134
#define AD5755_SPI_CODE
Definition: ad5755.h:230
void ad5755_slew_rate_ctrl(struct ad5755_dev *dev, int8_t channel, int8_t sr_en, int8_t updt_freq, int8_t step_size)
Configures the Digital Slew Rate Control.
Definition: ad5755.c:592
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
#define AD5755_DAC_OUTEN
Definition: ad5755.h:186
struct no_os_gpio_desc * gpio_poc
Definition: ad5755.h:340
int32_t ad5755_remove(struct ad5755_dev *dev)
Free the resources allocated by ad5755_init().
Definition: ad5755.c:158
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
#define AD5755_ISR_WRITE
Definition: ad5755.h:86
Stores the settings that will be written to the device when the "AD5755_Init" functions is called.
Definition: ad5755.h:276
uint8_t pin_ad1state
Definition: ad5755.h:280
uint8_t ad5755_check_crc(uint8_t *data, uint8_t bytes_number)
Computes the CRC for a data buffer.
Definition: ad5755.c:401
#define AD5755_RD_OFFSET_REG(x)
Definition: ad5755.h:247
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:49
void ad5755_set_control_registers(struct ad5755_dev *dev, uint8_t ctrl_reg_address, uint8_t channel, uint16_t reg_value)
Configures one of the control registers.
Definition: ad5755.c:382
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
uint8_t stat_readbit
Definition: ad5755.h:295
int8_t ad5755_init(struct ad5755_dev **device, struct ad5755_init_param init_param)
Initializes the device and powers-up all channels. The device is initialized with the values held by ...
Definition: ad5755.c:58
void ad5755_set_channel_range(struct ad5755_dev *dev, uint8_t channel, uint8_t range)
Sets the range of a channel.
Definition: ad5755.c:482
#define AD5755_DAC_D
Definition: ad5755.h:109
int32_t ad5755_get_register_value(struct ad5755_dev *dev, uint8_t register_address)
Reads the value of a register.
Definition: ad5755.c:193
#define AD5755_RESET_CODE
Definition: ad5755.h:229
#define AD5755_POC_OUT
Definition: ad5755.h:78
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
#define AD5755_DC_DC_COMP
Definition: ad5755.h:202
#define AD5755_R_M10_P10_V
Definition: ad5755.h:196
#define AD5755_R_0_5_V
Definition: ad5755.h:193
int32_t ad5755_remove(struct ad5755_dev *dev)
Free the resources allocated by ad5755_init().
Definition: ad5755.c:158
#define AD5755_R_0_20_MA
Definition: ad5755.h:198
#define AD5755_CREG_SLEW
Definition: ad5755.h:125
uint8_t pin_ad0state
Definition: ad5755.h:278
#define AD5755_DAC_DC_DC
Definition: ad5755.h:188
#define AD5755_R_4_20_MA
Definition: ad5755.h:197
uint8_t ad5755_check_crc(uint8_t *data, uint8_t bytes_number)
Computes the CRC for a data buffer.
Definition: ad5755.c:401
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
void ad5755_watch_dog_setup(struct ad5755_dev *dev, uint8_t wtd_enable, uint8_t timeout)
Enables/Disables watchdog timer and sets the timeout period.
Definition: ad5755.c:327
void ad5755_set_control_registers(struct ad5755_dev *dev, uint8_t ctrl_reg_address, uint8_t channel, uint16_t reg_value)
Configures one of the control registers.
Definition: ad5755.c:382
void ad5755_software_reset(struct ad5755_dev *dev)
Performs a software reset to the device.
Definition: ad5755.c:304
#define AD5755_MAIN_SHTCCTLIM(x)
Definition: ad5755.h:169
int8_t ad5755_init(struct ad5755_dev **device, struct ad5755_init_param init_param)
Initializes the device and powers-up all channels. The device is initialized with the values held by ...
Definition: ad5755.c:58
uint8_t enable_packet_error_check
Definition: ad5755.h:284
#define AD5755_R_0_24_MA
Definition: ad5755.h:199
#define AD5755_SLEW_SR_CLOCK(x)
Definition: ad5755.h:133
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
Header file of GPIO Interface.
#define AD5755_RESET_OUT
Definition: ad5755.h:62
#define AD5755_DAC_R(x)
Definition: ad5755.h:190
@ ID_AD5755_1
Definition: ad5755.h:329
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
struct no_os_gpio_init_param gpio_rst
Definition: ad5755.h:351
#define AD5755_CTRL_CREG(x)
Definition: ad5755.h:121
#define AD5755_RESET_HIGH
Definition: ad5755.h:66
uint8_t ovrng_bits[4]
Definition: ad5755.h:308
#define AD5755_R_M5_P5_V
Definition: ad5755.h:195
void ad5755_set_channel_power(struct ad5755_dev *dev, uint8_t channel, uint8_t pwr_status)
Allows power-up/down of the dc-to-dc converter, DAC and internal amplifiers for the selected channel.
Definition: ad5755.c:439
uint16_t ad5755_set_register_value(struct ad5755_dev *dev, uint8_t register_address, uint8_t channel, uint16_t register_value)
Writes data into a register.
Definition: ad5755.c:261
struct no_os_gpio_init_param gpio_ldac
Definition: ad5755.h:350
#define AD5755_CREG_SOFT
Definition: ad5755.h:129
#define AD5755_CRC_POLYNOMIAL
Definition: ad5755.h:265
void ad5755_set_channel_power(struct ad5755_dev *dev, uint8_t channel, uint8_t pwr_status)
Allows power-up/down of the dc-to-dc converter, DAC and internal amplifiers for the selected channel.
Definition: ad5755.c:439
#define AD5755_CREG_DAC
Definition: ad5755.h:127
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
#define AD5755_CLEAR_LOW
Definition: ad5755.h:72