Go to the documentation of this file.
47 #define AD5933_REG_CONTROL_HB 0x80 // HB of the Control register
48 #define AD5933_REG_CONTROL_LB 0x81 // LB of the Control register
49 #define AD5933_REG_FREQ_START 0x82 // Start frequency
50 #define AD5933_REG_FREQ_INC 0x85 // Frequency increment
51 #define AD5933_REG_INC_NUM 0x88 // Number of increments
52 #define AD5933_REG_SETTLING_CYCLES 0x8A // Number of settling time cycles
53 #define AD5933_REG_STATUS 0x8F // Status
54 #define AD5933_REG_TEMP_DATA 0x92 // Temperature data
55 #define AD5933_REG_REAL_DATA 0x94 // Real data
56 #define AD5933_REG_IMAG_DATA 0x96 // Imaginary data
59 #define AD5933_CONTROL_FUNCTION(x) ((x) << 4)
60 #define AD5933_CONTROL_RANGE(x) ((x) << 1)
61 #define AD5933_CONTROL_PGA_GAIN(x) ((x) << 0)
64 #define AD5933_CONTROL_RESET (0x1 << 4)
65 #define AD5933_CONTROL_INT_SYSCLK (0x0 << 3)
66 #define AD5933_CONTROL_EXT_SYSCLK (0x1 << 3)
69 #define AD5933_FUNCTION_NOP 0x0
70 #define AD5933_FUNCTION_INIT_START_FREQ 0x1
71 #define AD5933_FUNCTION_START_SWEEP 0x2
72 #define AD5933_FUNCTION_INC_FREQ 0x3
73 #define AD5933_FUNCTION_REPEAT_FREQ 0x4
74 #define AD5933_FUNCTION_MEASURE_TEMP 0x9
75 #define AD5933_FUNCTION_POWER_DOWN 0xA
76 #define AD5933_FUNCTION_STANDBY 0xB
79 #define AD5933_RANGE_2000mVpp 0x0
80 #define AD5933_RANGE_200mVpp 0x1
81 #define AD5933_RANGE_400mVpp 0x2
82 #define AD5933_RANGE_1000mVpp 0x3
85 #define AD5933_GAIN_X5 0
86 #define AD5933_GAIN_X1 1
89 #define AD5933_15_CYCLES 15
92 #define AD5933_SETTLING_X1 0
93 #define AD5933_SETTLING_X2 1
94 #define AD5933_SETTLING_X4 3
97 #define AD5933_STAT_TEMP_VALID (0x1 << 0)
98 #define AD5933_STAT_DATA_VALID (0x1 << 1)
99 #define AD5933_STAT_SWEEP_DONE (0x1 << 2)
102 #define AD5933_ADDRESS 0x0D
105 #define AD5933_BLOCK_WRITE 0xA0
106 #define AD5933_BLOCK_READ 0xA1
107 #define AD5933_ADDR_POINTER 0xB0
110 #define AD5933_INTERNAL_SYS_CLK 16000000ul // 16MHz
111 #define AD5933_MAX_INC_NUM 511 // Maximum increment number
150 uint8_t register_address,
151 uint32_t register_value,
152 uint8_t bytes_number);
156 uint8_t register_address,
157 uint8_t bytes_number);
165 uint32_t ext_clk_freq);
186 uint8_t freq_function,
192 uint32_t calibration_impedance,
193 uint8_t freq_function);
198 uint8_t freq_function);
203 uint16_t number_cycles);
#define AD5933_STAT_DATA_VALID
Definition: ad5933.h:98
#define AD5933_REG_FREQ_INC
Definition: ad5933.h:50
#define AD5933_FUNCTION_START_SWEEP
Definition: ad5933.h:71
#define AD5933_ADDR_POINTER
Definition: ad5933.h:107
#define AD5933_CONTROL_PGA_GAIN(x)
Definition: ad5933.h:61
#define AD5933_CONTROL_FUNCTION(x)
Definition: ad5933.h:59
void ad5933_set_range_and_gain(struct ad5933_dev *dev, int8_t range, int8_t gain)
Selects the range and gain of the device.
Definition: ad5933.c:222
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:159
#define AD5933_CONTROL_RESET
Definition: ad5933.h:64
int32_t no_os_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: no_os_i2c.c:52
#define AD5933_REG_FREQ_START
Definition: ad5933.h:49
uint8_t current_clock_source
Definition: ad5933.h:132
#define AD5933_CONTROL_RANGE(x)
Definition: ad5933.h:60
int32_t ad5933_remove(struct ad5933_dev *dev)
Free the resources allocated by ad5933_init().
Definition: ad5933.c:94
uint32_t ad5933_get_register_value(struct ad5933_dev *dev, uint8_t register_address, uint8_t bytes_number)
Reads the value of a register.
Definition: ad5933.c:139
#define AD5933_SETTLING_X2
Definition: ad5933.h:93
void ad5933_config_sweep(struct ad5933_dev *dev, uint32_t start_freq, uint32_t inc_freq, uint16_t inc_num)
Configures the sweep parameters: Start frequency, Frequency increment and Number of increments.
Definition: ad5933.c:286
int32_t no_os_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: no_os_i2c.c:113
float ad5933_get_temperature(struct ad5933_dev *dev)
Reads the temperature from the part and returns the data in degrees Celsius.
Definition: ad5933.c:245
void ad5933_set_register_value(struct ad5933_dev *dev, uint8_t register_address, uint32_t register_value, uint8_t bytes_number)
Writes data into a register.
Definition: ad5933.c:115
uint8_t current_clock_source
Definition: ad5933.h:122
Definition: ad9361_util.h:69
#define AD5933_REG_INC_NUM
Definition: ad5933.h:51
#define AD5933_CONTROL_EXT_SYSCLK
Definition: ad5933.h:66
void ad5933_set_system_clk(struct ad5933_dev *dev, int8_t clk_source, uint32_t ext_clk_freq)
Selects the source of the system clock.
Definition: ad5933.c:189
void ad5933_reset(struct ad5933_dev *dev)
Resets the device.
Definition: ad5933.c:170
int32_t ad5933_init(struct ad5933_dev **device, struct ad5933_init_param init_param)
Initializes the communication peripheral and the initial Values for AD5933 Board.
Definition: ad5933.c:65
void ad5933_set_system_clk(struct ad5933_dev *dev, int8_t clk_source, uint32_t ext_clk_freq)
Selects the source of the system clock.
Definition: ad5933.c:189
#define AD5933_REG_SETTLING_CYCLES
Definition: ad5933.h:52
#define AD5933_REG_TEMP_DATA
Definition: ad5933.h:54
#define AD5933_FUNCTION_STANDBY
Definition: ad5933.h:76
void ad5933_set_register_value(struct ad5933_dev *dev, uint8_t register_address, uint32_t register_value, uint8_t bytes_number)
Writes data into a register.
Definition: ad5933.c:115
#define AD5933_MAX_INC_NUM
Definition: ad5933.h:111
uint32_t current_sys_clk
Definition: ad5933.h:121
#define AD5933_STAT_TEMP_VALID
Definition: ad5933.h:97
void ad5933_set_settling_time(struct ad5933_dev *dev, uint8_t mulitplier, uint16_t number_cycles)
Selects the number of settling cycles of the device.
Definition: ad5933.c:475
#define AD5933_FUNCTION_NOP
Definition: ad5933.h:69
void ad5933_start_sweep(struct ad5933_dev *dev)
Starts the sweep operation.
Definition: ad5933.c:332
int32_t ad5933_remove(struct ad5933_dev *dev)
Free the resources allocated by ad5933_init().
Definition: ad5933.c:94
uint32_t current_sys_clk
Definition: ad5933.h:131
const int32_t pow_2_27
Definition: ad5933.c:45
uint8_t current_gain
Definition: ad5933.h:123
uint32_t ad5933_get_register_value(struct ad5933_dev *dev, uint8_t register_address, uint8_t bytes_number)
Reads the value of a register.
Definition: ad5933.c:139
double ad5933_calculate_gain_factor(struct ad5933_dev *dev, uint32_t calibration_impedance, uint8_t freq_function)
Reads the real and the imaginary data and calculates the Gain Factor.
Definition: ad5933.c:416
void ad5933_config_sweep(struct ad5933_dev *dev, uint32_t start_freq, uint32_t inc_freq, uint16_t inc_num)
Configures the sweep parameters: Start frequency, Frequency increment and Number of increments.
Definition: ad5933.c:286
#define AD5933_REG_REAL_DATA
Definition: ad5933.h:55
#define AD5933_REG_IMAG_DATA
Definition: ad5933.h:56
void ad5933_set_settling_time(struct ad5933_dev *dev, uint8_t multiplier, uint16_t number_cycles)
Selects the number of settling cycles of the device.
Definition: ad5933.c:475
double ad5933_calculate_impedance(struct ad5933_dev *dev, double gain_factor, uint8_t freq_function)
Reads the real and the imaginary data and calculates the Impedance.
Definition: ad5933.c:444
uint8_t current_gain
Definition: ad5933.h:133
Header file of AD5933 Driver.
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
struct no_os_i2c_desc * i2c_desc
Definition: ad5933.h:119
#define AD5933_SETTLING_X4
Definition: ad5933.h:94
int32_t no_os_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Read data from slave device.
Definition: no_os_i2c.c:190
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
Header file of I2C Interface.
#define AD5933_REG_CONTROL_HB
Definition: ad5933.h:47
uint8_t current_range
Definition: ad5933.h:134
int32_t ad5933_init(struct ad5933_dev **device, struct ad5933_init_param init_param)
Initializes the communication peripheral and the initial Values for AD5933 Board.
Definition: ad5933.c:65
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
struct no_os_i2c_init_param i2c_init
Definition: ad5933.h:129
void ad5933_start_sweep(struct ad5933_dev *dev)
Starts the sweep operation.
Definition: ad5933.c:332
void ad5933_get_data(struct ad5933_dev *dev, uint8_t freq_function, short *imag_data, short *real_data)
Reads the real and imaginary value from register.
Definition: ad5933.c:373
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
#define AD5933_FUNCTION_INIT_START_FREQ
Definition: ad5933.h:70
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
double ad5933_calculate_gain_factor(struct ad5933_dev *dev, uint32_t calibration_impedance, uint8_t freq_function)
Reads the real and the imaginary data and calculates the Gain Factor.
Definition: ad5933.c:416
#define AD5933_REG_CONTROL_LB
Definition: ad5933.h:48
float ad5933_get_temperature(struct ad5933_dev *dev)
Reads the temperature from the part and returns the data in degrees Celsius.
Definition: ad5933.c:245
void ad5933_set_range_and_gain(struct ad5933_dev *dev, int8_t range, int8_t gain)
Selects the range and gain of the device.
Definition: ad5933.c:222
#define AD5933_FUNCTION_MEASURE_TEMP
Definition: ad5933.h:74
void ad5933_reset(struct ad5933_dev *dev)
Resets the device.
Definition: ad5933.c:170
#define AD5933_INTERNAL_SYS_CLK
Definition: ad5933.h:110
#define AD5933_SETTLING_X1
Definition: ad5933.h:92
uint8_t current_range
Definition: ad5933.h:124
void ad5933_get_data(struct ad5933_dev *dev, uint8_t freq_function, short *imag_data, short *real_data)
Reads the real and imaginary value from register.
Definition: ad5933.c:373
#define AD5933_REG_STATUS
Definition: ad5933.h:53
double ad5933_calculate_impedance(struct ad5933_dev *dev, double gain_factor, uint8_t freq_function)
Reads the real and the imaginary data and calculates the Impedance.
Definition: ad5933.c:444