13#ifndef APP_CONFIG_STM32_H_
14#define APP_CONFIG_STM32_H_
24#include "stm32_gpio_irq.h"
26#include "stm32_gpio.h"
27#include "stm32_uart.h"
30#include "stm32_usb_uart.h"
38#define TARGET_NAME SDP_K1
43#define UART_IRQ UART5_IRQn
44#define SPI_DEVICE_ID 1
45#define SPI_CS_PIN_NUM 15
46#define SPI_CS_PORT_BASE GPIOA
47#define SPI_CS_PORT_NUM 0
50#define CNV_PORT_BASE GPIOA
55#define BSY_PIN_NUM GP0_PIN_NUM
56#define BSY_PORT_NUM GP0_PORT_NUM
57#define RESET_PIN_NUM 9
58#define RESET_PORT_NUM 6
59#define TRIGGER_INT_ID GP0_PIN_NUM
60#define TRIGGER_GPIO_PORT 0
61#define TRIGGER_GPIO_PIN GP0_PIN_NUM
62#define MAX_SPI_SCLK 22500000
64#define gpio_ops stm32_gpio_ops
65#define spi_ops stm32_spi_ops
66#define i2c_ops stm32_i2c_ops
67#define uart_ops stm32_uart_ops
68#define pwm_ops stm32_pwm_ops
69#define trigger_gpio_irq_ops stm32_gpio_irq_ops
70#define dma_ops stm32_dma_ops
71#define vcom_ops stm32_usb_uart_ops
72#define trigger_gpio_handle 0
76#define TIMER_1_PRESCALER 1
77#define TIMER_2_PRESCALER 0
78#define TIMER_1_CLK_DIVIDER 2
79#define TIMER_2_CLK_DIVIDER 2
80#define TIMER_8_PRESCALER 0
81#define TIMER_8_CLK_DIVIDER 2
84#define TIMER_CHANNEL_1 1
85#define TIMER_CHANNEL_2 2
86#define TIMER_CHANNEL_3 3
92#define Rx_DMA_IRQ_ID DMA2_Stream0_IRQn
93#define AD469x_TxDMA_CHANNEL_NUM DMA_CHANNEL_7
94#define AD469x_RxDMA_CHANNEL_NUM DMA_CHANNEL_3
103#if (INTERFACE_MODE == SPI_INTERRUPT)
104#define SAMPLING_RATE (50000)
105#define CONV_TRIGGER_DUTY_CYCLE_NSEC(x) (x / 10)
107#define SAMPLING_RATE (500000)
108#define CHIP_SELECT_DUTY_CYCLE_NS 300
110#define CONV_TRIGGER_PERIOD_NSEC(x) (((float)(1.0 / x) * 1000000) * 1000)
112#define AD469x_DMA_NUM_CHANNELS 2
115#define TX_TRIGGER_PERIOD 406
116#define TX_TRIGGER_DUTY_RATIO 50
118#define CNV_DUTY_RATIO_NS 690
123extern I2C_HandleTypeDef
hi2c1;
124extern SPI_HandleTypeDef
hspi1;
126extern TIM_HandleTypeDef
htim1;
127extern TIM_HandleTypeDef
htim2;
130extern TIM_HandleTypeDef
htim12;
131extern UART_HandleTypeDef
huart5;
143#if (INTERFACE_MODE == SPI_DMA)
int stm32_timer_stop(void)
Stop generating timer signals.
Definition app_config_stm32.c:279
UART_HandleTypeDef huart5
int stm32_timer_enable(void)
Starts the timer signal generation for PWM.
Definition app_config_stm32.c:256
DMA_HandleTypeDef hdma_tim8_ch1
struct stm32_dma_channel rxdma_channel
Definition app_config_stm32.c:134
USBD_HandleTypeDef hUsbDeviceHS
void stm32_system_init(void)
Initialize the STM32 system peripherals.
Definition app_config_stm32.c:174
void receivecomplete_callback(DMA_HandleTypeDef *hdma)
Callback function to flag the transfer of number of requested samples.
Definition app_config_stm32.c:338
struct stm32_pwm_init_param stm32_tx_trigger_extra_init_params
Definition app_config_stm32.c:98
int stm32_abort_dma_transfer(void)
Abort DMA Transfers.
Definition app_config_stm32.c:313
struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
Definition app_config_stm32.c:38
DMA_HandleTypeDef hdma_spi1_rx
struct stm32_dma_channel txdma_channel
Definition app_config_stm32.c:31
DMA_HandleTypeDef hdma_tim1_ch2
volatile bool data_ready
Definition ad405x_iio.c:164
uint32_t rxdma_ndtr
Definition app_config_stm32.c:177
void stm32_cs_output_gpio_config(bool is_gpio)
Configures the chip select pin as output mode.
Definition app_config_stm32.c:394
void halfcmplt_callback(DMA_HandleTypeDef *hdma)
Callback function to flag the capture of half the number of requested samples.
Definition app_config_stm32.c:270
struct stm32_pwm_init_param stm32_cs_extra_init_params
Definition app_config_stm32.c:135
struct stm32_gpio_init_param stm32_gpio_cnv_extra_init_params
Definition app_config_stm32.c:68
struct stm32_pwm_init_param stm32_pwm_cnv_extra_init_params
Definition app_config_stm32.c:120
DMA_HandleTypeDef hdma_tim1_ch3
int dma_cycle_count
Definition app_config_stm32.c:171
void stm32_cnv_output_gpio_config(bool is_gpio)
Configures the conversion pin as output mode.
Definition app_config_stm32.c:413
struct stm32_gpio_init_param stm32_pwm_gpio_extra_init_params
Definition app_config_stm32.c:110
struct stm32_uart_init_param stm32_uart_extra_init_params
Definition app_config_stm32.c:51
struct stm32_gpio_irq_init_param stm32_gpio_irq_extra_init_params
Definition app_config_stm32.c:86
void update_buff(uint32_t *local_buf, uint32_t *buf_start_addr)
Update buffer index.
Definition app_config_stm32.c:291
struct stm32_spi_init_param stm32_spi_extra_init_params
Definition app_config_stm32.c:61
struct stm32_gpio_init_param stm32_cs_pwm_gpio_extra_init_params
Definition app_config_stm32.c:97
struct stm32_gpio_init_param stm32_gpio_gp0_extra_init_params
Definition app_config_stm32.c:74
struct stm32_gpio_init_param stm32_gpio_gp1_extra_init_params
Definition app_config_stm32.c:80
uint8_t local_buf[MAX_LOCAL_BUF_SIZE]
Definition ad405x_iio.c:173
void MX_USB_DEVICE_Init(void)
struct stm32_gpio_init_param stm32_gpio_reset_extra_init_params
Definition app_config_stm32.c:82