13#ifndef APP_CONFIG_STM32_H_
14#define APP_CONFIG_STM32_H_
24#include "stm32_gpio_irq.h"
25#include "stm32_gpio.h"
26#include "stm32_uart.h"
46#define TIMER_CHANNEL(x) x
49#define AD405x_DMA_NUM_CHANNELS 2
56#define TARGET_NAME SDP_K1
59#define SPI_SUPPORT_AVAILABLE
60#define SDRAM_SUPPORT_AVAILABLE
61#define CONSOLE_STDIO_PORT_AVAILABLE
63#define I2C_EXTRA_PARAM_PTR NULL
64#define I2C_MAX_SPEED_HZ 100000
69#define UART_HANDLE huart5
70#define UART_IRQ UART5_IRQn
71#define SPI_DEVICE_ID 1
72#define SPI_CS_PIN_NUM 15
73#define SPI_CS_PORT_NUM 0
80#define STM32_GP1_IRQ EXTI15_10_IRQn
81#define STM32_DMA_CONT_TRIGGER DMA2_Stream2_IRQn
82#define STM32_DMA_SPI_RX_TRIGGER DMA2_Stream0_IRQn
86#define CNV_TIMER_BURST_AVG_PRESCALER 7
87#define CNV_TIMER_PRESCALER 1
88#define CS_TIMER_PRESCALER 0
89#define TX_TRIGGER_TIMER_PRESCALER 0
90#define CNV_TIMER_CLK_DIVIDER 2
91#define CS_TIMER_CLK_DIVIDER 2
92#define TX_TRIGGER_TIMER_CLK_DIVIDER 2
95#define CNV_TIMER_CHANNEL TIMER_CHANNEL(3)
96#define CS_TIMER_CHANNEL TIMER_CHANNEL(1)
97#define TX_TRIGGER_TIMER_CHANNEL TIMER_CHANNEL(1)
99#define CNV_TIMER_ID TIMER_ID(1)
100#define CS_TIMER_ID TIMER_ID(2)
101#define TX_TRIGGER_TIMER_ID TIMER_ID(8)
103#define CNV_TIMER_HANDLE &htim1
104#define CS_TIMER_HANDLE &htim2
105#define TX_TRIGGER_TIMER_HANDLE &htim8
107#define CNV_TIMER_TYPE STM32_PWM_TIMER_TIM
108#define CS_TIMER_TYPE STM32_PWM_TIMER_TIM
109#define TX_TRIGGER_TIMER_TYPE STM32_PWM_TIMER_TIM
111#define CNV_PWM_TIMER_IRQ_ID 0
113#define STM32_DMA_OPS stm32_dma_ops
115#define AD405x_TxDMA_HANDLE hdma_tim8_ch1
116#define AD405x_RxDMA_HANDLE hdma_spi1_rx
117#define AD405x_TxDMA_CHANNEL_NUM DMA_CHANNEL_7
118#define AD405x_RxDMA_CHANNEL_NUM DMA_CHANNEL_3
119#define Rx_DMA_IRQ_ID DMA2_Stream0_IRQn
128#define TARGET_NAME NUCLEO-H563ZI
131#define I3C_SUPPORT_AVAILABLE
135#define I2C_MAX_SPEED_HZ 100000
136#define I2C_EXTRA_PARAM_PTR &i2c_extra_init_params
140#define I2C_TIMING 0x00000E14
145#define I3C_HANDLE hi3c1
146#define I3C_CR_REG I3C_HANDLE.Instance->CR
151#define UART_HANDLE huart3
152#define UART_IRQ USART3_IRQn
156#define CNV_PORT_NUM 0
158#define GP0_PIN_NUM 15
159#define GP0_PORT_NUM 3
161#define GP1_PORT_NUM 5
162#define STM32_GP1_IRQ EXTI3_IRQn
166#define CNV_TIMER_BURST_AVG_PRESCALER 8
167#define CNV_TIMER_PRESCALER 1
168#define CNV_TIMER_CLK_DIVIDER 1
171#define STM32_DMA_OPS stm32_gpdma_ops
172#define I3C_TX_DMA_CHANNEL_NUM (uint32_t)GPDMA1_Channel0
173#define I3C_RX_DMA_CHANNEL_NUM (uint32_t)GPDMA1_Channel1
174#define I3C_TX_DMA_HANDLE handle_GPDMA1_Channel0
175#define I3C_RX_DMA_HANDLE handle_GPDMA1_Channel1
176#define I3C_TX_DMA_IRQ_ID GPDMA1_Channel0_IRQn
177#define I3C_RX_DMA_IRQ_ID GPDMA1_Channel1_IRQn
179#define AD405x_TxDMA_HANDLE I3C_TX_DMA_HANDLE
180#define AD405x_RxDMA_HANDLE I3C_RX_DMA_HANDLE
181#define AD405x_TxDMA_CHANNEL_NUM I3C_TX_DMA_CHANNEL_NUM
182#define AD405x_RxDMA_CHANNEL_NUM I3C_RX_DMA_CHANNEL_NUM
183#define Tx_DMA_IRQ_ID I3C_TX_DMA_IRQ_ID
184#define Rx_DMA_IRQ_ID I3C_RX_DMA_IRQ_ID
188#define CNV_TIMER_ID TIMER_ID(1)
189#define CNV_TIMER_CHANNEL TIMER_CHANNEL(1)
190#define CNV_TIMER_HANDLE &hlptim1
191#define CNV_TIMER_TYPE STM32_PWM_TIMER_LPTIM
192#define CNV_PWM_TIMER_IRQ_ID LPTIM1_IRQn
198#define uart_extra_init_params stm32_uart_extra_init_params
199#define vcom_extra_init_params stm32_vcom_extra_init_params
200#define i2c_extra_init_params stm32_i2c_extra_init_params
201#define cnv_extra_init_params stm32_gpio_cnv_extra_init_params
202#define pwm_extra_init_params stm32_pwm_cnv_extra_init_params
203#define pwm_gpio_extra_init_params stm32_pwm_gpio_extra_init_params
204#define gp0_extra_init_params stm32_gpio_gp0_extra_init_params
205#define gp1_extra_init_params stm32_gpio_gp1_extra_init_params
206#define trigger_gpio_irq_extra_params stm32_gpio_irq_extra_init_params
207#define dma_extra_init_params stm32_dma_extra_init_params
208#define cs_extra_init_params stm32_cs_extra_init_params
209#define tx_trigger_extra_init_params stm32_tx_trigger_extra_init_params
210#ifdef SPI_SUPPORT_AVAILABLE
211#define spi_extra_init_params stm32_spi_extra_init_params
213#ifdef I3C_SUPPORT_AVAILABLE
214#define i3c_extra_init_params stm32_i3c_extra_init_params
218#define gpio_ops stm32_gpio_ops
219#define i2c_ops stm32_i2c_ops
220#define uart_ops stm32_uart_ops
221#define vcom_ops stm32_usb_uart_ops
222#define pwm_ops stm32_pwm_ops
223#define trigger_gpio_irq_ops stm32_gpio_irq_ops
224#define dma_ops STM32_DMA_OPS
225#ifdef SPI_SUPPORT_AVAILABLE
226#define spi_ops stm32_spi_ops
228#ifdef I3C_SUPPORT_AVAILABLE
229#define i3c_ops stm32_i3c_ops
232#define MAX_SPI_SCLK 22500000
233#define MAX_SPI_SCLK_45MHz 45000000
242#if (APP_CAPTURE_MODE == WINDOWED_DATA_CAPTURE)
243#define SAMPLING_RATE_SPI_INTR 62500
245#define SAMPLING_RATE_SPI_INTR 30000
247#define CONV_TRIGGER_DUTY_CYCLE_NSEC(x) (x / 10)
248#define SAMPLING_RATE_SPI_DMA (1000000)
249#define SAMPLING_RATE_I3C_INTR (30000)
250#define SAMPLING_RATE_I3C_DMA (140000)
256extern I2C_HandleTypeDef
hi2c1;
263extern TIM_HandleTypeDef
htim1;
265extern TIM_HandleTypeDef
htim2;
267extern TIM_HandleTypeDef
htim8;
268extern SPI_HandleTypeDef
hspi1;
273extern LPTIM_HandleTypeDef hlptim1;
274extern I3C_HandleTypeDef I3C_HANDLE;
275extern PCD_HandleTypeDef hpcd_USB_DRD_FS;
282#ifdef SPI_SUPPORT_AVAILABLE
285#ifdef I3C_SUPPORT_AVAILABLE
286extern struct stm32_i3c_init_param stm32_i3c_extra_init_params;
302#ifdef SPI_SUPPORT_AVAILABLE
303extern struct stm32_dma_channel spi_dma_rxdma_channel;
304extern struct stm32_dma_channel spi_dma_txdma_channel;
306#ifdef I3C_SUPPORT_AVAILABLE
307extern struct stm32_dma_channel i3c_dma_rxdma_channel;
308extern struct stm32_dma_channel i3c_dma_txdma_channel;
int stm32_timer_stop(void)
Stop generating timer signals.
Definition app_config_stm32.c:281
int stm32_timer_enable(void)
Starts the timer signal generation for PWM.
Definition app_config_stm32.c:258
USBD_HandleTypeDef hUsbDeviceHS
void stm32_system_init(void)
Initialize the STM32 system peripherals.
Definition app_config_stm32.c:176
void receivecomplete_callback(DMA_HandleTypeDef *hdma)
Callback function to flag the transfer of number of requested samples.
Definition app_config_stm32.c:340
struct stm32_pwm_init_param stm32_tx_trigger_extra_init_params
Definition app_config_stm32.c:99
int stm32_abort_dma_transfer(void)
Abort DMA Transfers.
Definition app_config_stm32.c:315
struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
Definition app_config_stm32.c:38
void stm32_system_init_post_verification(void)
Initialize the STM32 system peripherals after the device has been verified.
Definition app_config_stm32.c:462
__weak unsigned int ux_device_stack_tasks_run(void)
Dummy function for USBx middleware used in STM32H563.
Definition app_config_stm32.c:785
DMA_HandleTypeDef AD405x_TxDMA_HANDLE
struct stm32_dma_init_param stm32_spi_dma_extra_init_params
struct stm32_i2c_init_param stm32_i2c_extra_init_params
Definition app_config_stm32.c:152
volatile int dma_cycle_count
Definition app_config_stm32.c:242
volatile bool data_ready
Definition ad405x_iio.c:137
UART_HandleTypeDef UART_HANDLE
uint32_t rxdma_ndtr
Definition app_config_stm32.c:245
void update_buff(uint8_t *local_buf, uint8_t *buf_start_addr)
Update buffer index.
Definition app_config_stm32.c:499
void stm32_cs_output_gpio_config(bool is_gpio)
Configures the chip select pin as output mode.
Definition app_config_stm32.c:309
void stm32_config_spi_data_frame_format(bool is_16_bit)
void halfcmplt_callback(DMA_HandleTypeDef *hdma)
Callback function to flag the capture of Half the number of requested samples.
Definition app_config_stm32.c:389
struct stm32_pwm_init_param stm32_cs_extra_init_params
Definition app_config_stm32.c:120
struct stm32_gpio_init_param stm32_gpio_cnv_extra_init_params
Definition app_config_stm32.c:64
struct stm32_pwm_init_param stm32_pwm_cnv_extra_init_params
Definition app_config_stm32.c:190
struct stm32_pwm_init_param stm32_dma_extra_init_params
struct stm32_gpio_init_param stm32_pwm_gpio_extra_init_params
Definition app_config_stm32.c:180
struct stm32_uart_init_param stm32_uart_extra_init_params
Definition app_config_stm32.c:102
struct stm32_gpio_irq_init_param stm32_gpio_irq_extra_init_params
Definition app_config_stm32.c:156
void stm32_config_cnv_prescalar(void)
Configures the prescalar according to the operating mode.
Definition app_config_stm32.c:682
DMA_HandleTypeDef AD405x_RxDMA_HANDLE
struct stm32_gpio_init_param stm32_cs_pwm_gpio_extra_init_params
Definition app_config_stm32.c:167
struct stm32_gpio_init_param stm32_gpio_gp0_extra_init_params
Definition app_config_stm32.c:144
struct stm32_gpio_init_param stm32_gpio_gp1_extra_init_params
Definition app_config_stm32.c:150
uint8_t local_buf[MAX_LOCAL_BUF_SIZE]
Definition ad405x_support.c:42
struct stm32_spi_init_param stm32_spi_extra_init_params
Definition app_config_stm32.c:46
VCOM driver for stm32 as a no_os_uart implementation.
Specific initialization parameters for stm32 UART over USB.
Definition stm32_usb_uart.h:27