13 #ifndef APP_CONFIG_STM32_H_
14 #define APP_CONFIG_STM32_H_
21 #include "stm32_spi.h"
22 #include "stm32_i2c.h"
23 #include "stm32_uart.h"
24 #include "stm32_gpio.h"
26 #if (INTERFACE_MODE != SPI_DMA_MODE)
27 #include "stm32_gpio_irq.h"
29 #include "stm32_dma.h"
31 #include "stm32_tdm.h"
32 #if (INTERFACE_MODE == SPI_DMA_MODE)
33 #include "stm32_pwm.h"
40 #if defined (TARGET_SDP_K1)
42 #define HW_CARRIER_NAME SDP-K1
45 #define STM32_SPI_ID 1
46 #define STM32_SPI_CS_PORT 0
50 #define STM32_I2C_ID 1
53 #define APP_UART_HANDLE &huart5
54 #define UART_IRQ_ID UART5_IRQn
62 #define DIG_AUX_1_PORT 6
63 #define DIG_AUX_2_PORT 6
64 #define SYNC_INB_PORT 6
65 #define SYNC_INB_PORT_ID GPIOG
67 #define GPIO_TRIGGER_INT_PORT EXTI_GPIOG
72 #define AD469x_DMA_NUM_CHANNELS 2
74 #define Rx_DMA_IRQ_ID DMA2_Stream0_IRQn
75 #define AD469x_TxDMA_CHANNEL_NUM DMA_CHANNEL_7
76 #define AD469x_RxDMA_CHANNEL_NUM DMA_CHANNEL_3
79 #define TX_TRIGGER_TIMER_ID 8
81 #define TX_TRIGGER_PERIOD 2250
82 #define TX_TRIGGER_DUTY_RATIO 240
83 #define TIMER_8_PRESCALER 0
84 #define TIMER_8_CLK_DIVIDER 1
85 #define TIMER_CHANNEL_1 1
88 #define HW_CARRIER_NAME NUCLEO-H563ZI
91 #define STM32_SPI_ID 1
92 #define STM32_SPI_CS_PORT 3
96 #define STM32_I2C_ID 1
99 #define APP_UART_HANDLE &huart3
105 #define LED_GPO LED1_GREEN_Pin
107 #define DIG_AUX_1_PORT 6
108 #define DIG_AUX_2_PORT 6
109 #define SYNC_INB_PORT 4
111 #define GPIO_TRIGGER_INT_PORT EXTI_GPIOG
116 #define I2C_TIMING 0x00000E14
119 #define TDM_DATA_SIZE 32
120 #define TDM_SLOTS_PER_FRAME 1
121 #define TDM_FS_ACTIVE_LENGTH 8
124 #define TDM_N_SAMPLES_DMA_READ 800
127 #define TDM_DMA_READ_SIZE TDM_N_SAMPLES_DMA_READ * TDM_SLOTS_PER_FRAME/2
129 #define STM32_SAI_BASE SAI1_Block_A
141 #if (INTERFACE_MODE == SPI_INTERRUPT_MODE)
142 #define FS_CONFIG_VALUE 20
143 #elif (INTERFACE_MODE == SPI_DMA_MODE)
144 #define FS_CONFIG_VALUE 1
146 #define FS_CONFIG_VALUE 1
149 #define TICKER_INTERRUPT_PERIOD_uSEC (0)
152 #define AD4170_MAX_SPI_SPEED 22500000
168 #if !defined (TARGET_SDP_K1)
169 extern UART_HandleTypeDef
huart3;
171 extern UART_HandleTypeDef
huart5;
186 extern struct stm32_spi_desc*
sdesc;
188 #if (INTERFACE_MODE == SPI_DMA_MODE)
190 extern struct no_os_dma_init_param ad4170_dma_init_param;
struct no_os_pwm_desc * pwm_desc
Definition: app_config.c:106
UART_HandleTypeDef huart5
struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params
Definition: app_config_stm32.c:35
struct stm32_dma_channel txdma_channel
Definition: app_config_stm32.c:29
DMA_HandleTypeDef hdma_tim8_ch1
struct stm32_dma_channel rxdma_channel
Definition: app_config_stm32.c:39
uint32_t rxdma_ndtr
Definition: app_config_stm32.c:159
void stm32_system_init(void)
Initialize the STM32 system peripherals.
Definition: app_config_stm32.c:111
void tim8_config(void)
Configure Tx Trigger timer.
Definition: app_config_stm32.c:412
int dma_cycle_count
Definition: app_config_stm32.c:156
struct stm32_pwm_init_param stm32_tx_trigger_extra_init_params
Definition: app_config_stm32.c:135
int stm32_abort_dma_transfer(void)
Abort ongoing SPI RX DMA transfer.
Definition: app_config_stm32.c:380
struct stm32_uart_init_param stm32_uart_extra_init_params
Definition: app_config_stm32.c:49
DMA_HandleTypeDef hdma_spi1_rx
void stm32_timer_stop(void)
Stops generating timer signals.
Definition: app_config_stm32.c:285
void update_buff(uint32_t *local_buf, uint32_t *buf_start_addr)
Update buffer index.
Definition: app_config_stm32.c:253
struct stm32_spi_init_param stm32_spi_extra_init_params
Definition: app_config_stm32.c:54
uint8_t local_buf[MAX_LOCAL_BUF_SIZE]
Definition: ad405x_iio.c:177
struct stm32_gpio_init_param stm32_csb_gpio_extra_init_params
Definition: app_config_stm32.c:93
struct stm32_gpio_init_param stm32_sync_inb_gpio_extra_init_params
Definition: app_config_stm32.c:73
volatile struct iio_device_data * iio_dev_data_g
Definition: ad405x_iio.c:331
uint32_t nb_of_samples_g
Definition: ad405x_iio.c:334
struct stm32_tdm_init_param stm32_tdm_extra_init_params
Definition: app_config_stm32.c:52
void ad4170_dma_rx_half_cplt(SAI_HandleTypeDef *hsai)
SAI DMA Receive Half Complete Callback function.
Definition: app_config_stm32.c:193
struct stm32_gpio_init_param stm32_dig_aux2_gpio_extra_init_params
Definition: app_config_stm32.c:67
volatile bool ad4170_dma_buff_full
struct stm32_i2c_init_param stm32_i2c_extra_init_params
Definition: app_config_stm32.c:99
void ad4170_spi_dma_rx_half_cplt_callback(DMA_HandleTypeDef *hdma)
Callback function to flag the capture of Half the number of requested samples.
Definition: app_config_stm32.c:289
struct iio_device_data * ad4170_iio_dev_data
Definition: ad4170_iio.c:317
struct stm32_spi_desc * sdesc
Definition: app_config_stm32.c:147
void tim8_init(struct no_os_pwm_desc *pwm_desc)
Initialize Tx trigger advanced PWM parameters.
Definition: app_config_stm32.c:383
uint8_t num_of_active_channels
Definition: ad4170_iio.c:181
void ad4170_spi_dma_rx_cplt_callback(DMA_HandleTypeDef *hdma)
Callback function to flag the capture of number of requested samples.
Definition: app_config_stm32.c:252
bool data_capture_operation
Definition: ad4170_iio.c:335
volatile bool tdm_read_started
Definition: ad4170_iio.c:328
UART_HandleTypeDef huart3
struct stm32_gpio_init_param stm32_dig_aux1_gpio_extra_init_params
Definition: app_config_stm32.c:61
volatile uint32_t * buff_start_addr
Definition: ad405x_iio.c:174
int32_t data_read
Definition: ad405x_iio.c:337
struct stm32_gpio_init_param stm32_trigger_gpio_extra_init_params
Definition: app_config_stm32.c:55
void ad4170_dma_rx_cplt(SAI_HandleTypeDef *hsai)
SAI DMA Receive Complete Callback function.
Definition: app_config_stm32.c:210
Configuration file of nanodac firmware example program.