13#ifndef APP_CONFIG_STM32_H_
14#define APP_CONFIG_STM32_H_
21#include "stm32_uart.h"
23#include "stm32_gpio.h"
27#include "stm32_gpio_irq.h"
39#define TARGET_NAME SDP_K1
42#define APP_UART_HANDLE &huart5
43#define UART_IRQ_ID UART5_IRQn
44#define APP_UART_USB_HANDLE &hUsbDeviceHS
53#define GPIO_TRIGGER_INT_PORT BSY_PORT
57#define STM32_SPI_CS_PORT 0
59#define SPI_CS_PORT_NUM 0
60#define SPI_CS_PIN_NUM 15
64#define I2C_DEVICE_ID 1
65#define SPI_DEVICE_ID 1
70#define TRIGGER_INT_ID BSY_PIN
71#define trigger_gpio_handle 0
72#define BSY_GPIO_PRIORITY 1
76#define CNV_PWM_CHANNEL 3
77#define CNV_PWM_CLK_DIVIDER 2
78#define CNV_PWM_HANDLE htim1
79#define PWM_GPIO_PORT CNV_PORT
80#define PWM_GPIO_PIN CNV_PIN
84#define CS_TIMER_PRESCALER 0
85#define CS_TIMER_CHANNEL 1
86#define TIMER_2_CLK_DIVIDER 2
87#define CS_TIMER_HANDLE htim2
91#define TIMER_8_PRESCALER 0
92#define TIMER_8_CLK_DIVIDER 2
93#define TIMER_CHANNEL_1 1
94#define TIMER8_HANDLE htim8
96#define Rx_DMA_IRQ_ID DMA2_Stream0_IRQn
97#define TxDMA_CHANNEL_NUM DMA_CHANNEL_7
98#define RxDMA_CHANNEL_NUM DMA_CHANNEL_3
100#define AD7091R_DMA_NUM_CHANNELS 2
103#define spi_extra_init_params stm32_spi_init_params
104#define uart_extra_init_params stm32_uart_init_params
105#define i2c_extra_init_params stm32_i2c_init_params
106#define pwm_extra_init_params stm32_cnv_pwm_init_params
107#define cnv_gpio_extra_init_param stm32_gpio_cnv_init_params
108#define reset_gpio_extra_init_param stm32_gpio_reset_init_params
109#define trigger_gpio_irq_extra_params stm32_trigger_gpio_irq_init_params
110#define pwm_gpio_extra_init_params stm32_pwm_cnv_gpio_init_params
111#define alt_bsy_gpio_extra_init_params stm32_gpio_gp0_extra_init_params
112#define tx_trigger_extra_init_params stm32_tx_trigger_extra_init_params
113#define cs_extra_init_params stm32_cs_extra_init_params
114#define cs_pwm_gpio_extra_init_params stm32_cs_pwm_gpio_extra_init_params
115#define vcom_extra_init_params stm32_vcom_extra_init_params
118#define trigger_gpio_irq_ops stm32_gpio_irq_ops
119#define gpio_ops stm32_gpio_ops
120#define spi_ops stm32_spi_ops
121#define pwm_ops stm32_pwm_ops
122#define uart_ops stm32_uart_ops
123#define i2c_ops stm32_i2c_ops
124#define dma_ops stm32_dma_ops
125#define vcom_ops stm32_usb_uart_ops
128#define MAX_SPI_SCLK 40000000
134#if (INTERFACE_MODE == SPI_INTERRUPT)
135#if (DATA_CAPTURE_MODE == CONTINUOUS_DATA_CAPTURE)
136#define MAX_SAMPLING_RATE 40000
138#define MAX_SAMPLING_RATE 50000
140#define PWM_DUTY_CYCLE_PERCENT 90
141#define CNV_PWM_PRESCALER 3
142#define PWM_DUTY_CYCLE_NSEC 360
144#define MAX_SAMPLING_RATE 830000
145#define CHIP_SELECT_DUTY_CYCLE_NS 530
146#define CNV_PWM_PRESCALER 1
147#define PWM_DUTY_CYCLE_NSEC 250
151#define TX_TRIGGER_PERIOD 400
152#define TX_TRIGGER_DUTY_CYCLE_NS 30
166extern UART_HandleTypeDef
huart5;
167extern TIM_HandleTypeDef
htim1;
168extern TIM_HandleTypeDef
htim2;
171#if (INTERFACE_MODE == SPI_DMA)
174extern TIM_HandleTypeDef
htim8;
int stm32_timer_stop(void)
Stop generating timer signals.
Definition app_config_stm32.c:281
UART_HandleTypeDef huart5
int stm32_timer_enable(void)
Starts the timer signal generation for PWM.
Definition app_config_stm32.c:258
DMA_HandleTypeDef hdma_tim8_ch1
struct stm32_dma_channel rxdma_channel
Definition app_config_stm32.c:136
USBD_HandleTypeDef hUsbDeviceHS
struct stm32_spi_init_param stm32_spi_init_params
Definition app_config_stm32.c:48
void stm32_system_init(void)
Initialize the STM32 system peripherals.
Definition app_config_stm32.c:176
void tim8_config(void)
Configure Tx Trigger timer for slave mode operation, one-pulse mode and to generate DMA requests.
Definition app_config_stm32.c:245
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_gpio_init_param stm32_gpio_reset_init_params
Definition app_config_stm32.c:72
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
DMA_HandleTypeDef hdma_spi1_rx
struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params
Definition app_config_stm32.c:43
struct stm32_uart_init_param stm32_uart_init_params
Definition app_config_stm32.c:33
struct stm32_i2c_init_param stm32_i2c_init_params
Definition app_config_stm32.c:54
volatile int dma_cycle_count
Definition app_config_stm32.c:242
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 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_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
uint8_t local_buf[MAX_LOCAL_BUF_SIZE]
Definition ad405x_support.c:42
struct stm32_dma_channel txdma_channel
Definition app_config_stm32.c:115
void tim2_config(void)
Configure CS timer.
Definition app_config_stm32.c:223
struct stm32_gpio_init_param stm32_gpio_cnv_init_params
Definition app_config_stm32.c:70
void configure_intr_priority(void)
Prioritizes the UART1 interrupt over the other peripheral interrupts.
Definition app_config_stm32.c:473
struct stm32_pwm_init_param stm32_cnv_pwm_init_params
Definition app_config_stm32.c:94
void ad7091r8_pulse_convst_stm(void)
Pull the CONVST line down then up.
Definition app_config_stm32.c:420
int ad7091r8_read_one_stm(uint8_t channel, uint16_t *read_val)
Read one sample.
Definition app_config_stm32.c:432
struct stm32_gpio_init_param stm32_pwm_cnv_gpio_init_params
Definition app_config_stm32.c:76
Configuration file of nanodac firmware example program.
VCOM driver for stm32 as a no_os_uart implementation.
Specific initialization parameters for stm32 UART over USB.
Definition stm32_usb_uart.h:27