precision-converters-firmware
Loading...
Searching...
No Matches
Macros | Functions | Variables
app_config_stm32.h File Reference

Header file for STM32 platform configurations. More...

#include <stdint.h>
#include "stm32_hal.h"
#include "stm32_i2c.h"
#include "stm32_irq.h"
#include "stm32_gpio_irq.h"
#include "stm32_spi.h"
#include "stm32_gpio.h"
#include "stm32_uart.h"
#include "stm32_pwm.h"
#include "stm32_dma.h"
#include "stm32_usb_uart.h"
#include "ad4692_iio.h"
#include "app_config.h"
Include dependency graph for app_config_stm32.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HW_CARRIER_NAME   SDP_K1
 
#define I2C_DEV_ID   1
 
#define UART_MODULE   5
 
#define UART_IRQ   OTG_HS_IRQn
 
#define CONSOLE_IRQ   UART5_IRQn
 
#define SPI_DEVICE_ID   1
 
#define SPI_CSB   15
 
#define SPI_CS_PORT_BASE   GPIOA
 
#define SPI_CS_PORT_NUM   0
 
#define CNV_PIN_NUM   10
 
#define CNV_PORT_NUM   0
 
#define CNV_PORT_BASE   GPIOA
 
#define BSY_PIN_NUM   0
 
#define BSY_PORT_NUM   0
 
#define RESET_PIN_NUM   9
 
#define RESET_PORT_NUM   6
 
#define TRIGGER_INT_ID   BSY_PIN_NUM
 
#define TRIGGER_GPIO_PORT   0
 
#define TRIGGER_GPIO_PIN   GP0_PIN_NUM
 
#define MAX_SPI_BAUDRATE   22500000
 
#define SPI_BURST_PWM_ID   12
 
#define SPI_BURST_PWM_PORT   3
 
#define gpio_ops   stm32_gpio_ops
 
#define spi_ops   stm32_spi_ops
 
#define i2c_ops   stm32_i2c_ops
 
#define vcom_ops   stm32_usb_uart_ops
 
#define uart_ops   stm32_uart_ops
 
#define pwm_ops   stm32_pwm_ops
 
#define dma_ops   stm32_dma_ops
 
#define trigger_gpio_irq_ops   stm32_gpio_irq_ops
 
#define trigger_gpio_handle   0
 
#define vcom_extra_init_params   stm32_vcom_extra_init_params
 
#define uart_extra_init_params   stm32_uart_extra_init_params
 
#define spi_extra_init_params   stm32_spi_extra_init_params
 
#define bsy_extra_init_params   stm32_gpio_bsy_extra_init_params
 
#define cnv_extra_init_params   stm32_gpio_cnv_extra_init_params
 
#define reset_extra_init_params   stm32_gpio_reset_extra_init_params
 
#define pwm_cnv_extra_init_params   stm32_pwm_cnv_extra_init_params
 
#define pwm_spi_burst_extra_init_params   stm32_pwm_spi_burst_extra_init_params
 
#define trigger_gpio_irq_extra_params   stm32_gpio_irq_extra_init_params
 
#define cnv_pwm_gpio_extra_init_params   stm32_cnv_pwm_gpio_extra_init_params
 
#define tx_trigger_extra_init_params   stm32_tx_trigger_extra_init_params
 
#define csb_gpio_extra_init_params   stm32_csb_gpio_extra_init_params
 
#define i2c_extra_init_params   stm32_i2c_extra_init_params
 
#define spi_burst_extra_init_params   stm32_spi_burst_pwm_gpio_extra_init_params
 
#define CNV_TIMER_ID   1
 
#define TIMER_1_PRESCALER   1
 
#define TIMER_1_CLK_DIVIDER   2
 
#define CNV_TIMER_HANDLE   htim1
 
#define SPI_BURST_TIMER_ID   4
 
#define TIMER_4_PRESCALER   1
 
#define TIMER_4_CLK_DIVIDER   1
 
#define SPI_BURST_TIMER_HANDLE   htim4
 
#define TIMER_CHANNEL_3   3
 
#define TX_TRIGGER_TIMER_ID   8
 
#define TX_TRIGGER_PERIOD   400
 
#define TX_TRIGGER_DUTY_RATIO   30
 
#define TIMER_8_PRESCALER   0
 
#define TIMER_8_CLK_DIVIDER   2
 
#define TIMER_CHANNEL_1   1
 
#define TX_TRIGGER_TIMER_HANDLE   htim8
 
#define AD4692_DMA_NUM_CHANNELS   2
 
#define Rx_DMA_IRQ_ID   DMA2_Stream0_IRQn
 
#define AD4692_TxDMA_CHANNEL_NUM   DMA_CHANNEL_7
 
#define AD4692_RxDMA_CHANNEL_NUM   DMA_CHANNEL_3
 
#define I2C_TIMING   0
 
#define GPIO_IRQ_PRIORITY   1
 
#define S_RATE_MANUAL_DMA   (800000)
 
#define S_RATE_MANUAL_INTR   (50000)
 
#define S_RATE_CNV_CLOCK_INTR_STD_AVG   (6250)
 
#define S_RATE_CNV_BURST_STD_AVG   (5750)
 
#define S_RATE_SPI_BURST_STD_AVG   (5750)
 
#define S_RATE_CNV_CLOCK_INTR_STD_ACC   (5500)
 
#define S_RATE_CNV_BURST_STD_ACC   (5000)
 
#define S_RATE_SPI_BURST_STD_ACC   (5000)
 
#define S_RATE_CNV_CLOCK_INTR_ADV_AVG   (6250)
 
#define S_RATE_CNV_BURST_ADV_AVG   (4500)
 
#define S_RATE_SPI_BURST_ADV_AVG   (4500)
 
#define S_RATE_CNV_CLOCK_INTR_ADV_ACC   (5500)
 
#define S_RATE_CNV_BURST_ADV_ACC   (4000)
 
#define S_RATE_SPI_BURST_ADV_ACC   (4000)
 

Functions

void MX_USB_DEVICE_Init (void)
 
void stm32_system_init (void)
 Initialize the STM32 system peripherals.
 
int ad4692_config_and_start_pwm (struct ad4692_desc *desc)
 Configure and start PWM.
 
void ad4692_stop_timer (void)
 Stop timers and DMA transfers.
 
void ad4692_spi_dma_rx_cplt_callback (DMA_HandleTypeDef *hdma)
 Callback function to flag the capture of number of requested samples.
 
void ad4692_spi_dma_rx_half_cplt_callback (DMA_HandleTypeDef *hdma)
 Callback function to flag the capture of number of requested samples.
 
void stm32_abort_dma_transfer (void)
 Abort DMA Transfers.
 
void update_buff (uint8_t *local_buf, uint8_t *buf_start_addr)
 Update buffer index.
 
void SystemClock_Config (void)
 
void tim8_init (void)
 Initialize Tx trigger advanced PWM parameters.
 
int32_t tx_trigger_init (void)
 Initialize Tx Trigger Timer.
 
void stm32_tim4_init (void)
 Initialize Timer 4.
 

Variables

DMA_HandleTypeDef hdma_spi1_rx
 
DMA_HandleTypeDef hdma_tim8_ch1
 
TIM_HandleTypeDef htim1
 
TIM_HandleTypeDef htim8
 
TIM_HandleTypeDef htim4
 
struct stm32_uart_init_param stm32_uart_extra_init_params
 
struct stm32_spi_init_param stm32_spi_extra_init_params
 
struct stm32_gpio_init_param stm32_gpio_reset_extra_init_params
 
struct stm32_gpio_init_param stm32_gpio_bsy_extra_init_params
 
struct stm32_gpio_irq_init_param stm32_gpio_irq_extra_init_params
 
struct stm32_gpio_init_param stm32_gpio_cnv_extra_init_params
 
struct stm32_pwm_init_param stm32_pwm_cnv_extra_init_params
 
struct stm32_gpio_init_param stm32_cnv_pwm_gpio_extra_init_params
 
struct stm32_pwm_init_param stm32_tx_trigger_extra_init_params
 
struct stm32_gpio_init_param stm32_csb_gpio_extra_init_params
 
struct stm32_i2c_init_param stm32_i2c_extra_init_params
 
struct no_os_dma_init_param ad4692_dma_init_param
 
struct stm32_dma_channel rxdma_channel
 
struct stm32_dma_channel txdma_channel
 
struct stm32_pwm_init_param stm32_pwm_spi_burst_extra_init_params
 
struct stm32_gpio_init_param stm32_spi_burst_pwm_gpio_extra_init_params
 
struct iio_device_data * ad4692_iio_dev_data
 
uint8_t num_of_active_channels
 
volatile struct iio_device_data * iio_dev_data_g
 
uint32_t nb_of_samples_g
 
volatile uint32_t * buff_start_addr
 
uint32_t data_read
 
uint32_t rxdma_ndtr
 
volatile bool ad4692_dma_buff_full
 
uint32_t dma_cycle_count
 
struct no_os_gpio_desc * csb_gpio_desc
 
uint32_t callback_count
 
USBD_HandleTypeDef hUsbDeviceHS
 
struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
 
UART_HandleTypeDef huart5
 

Detailed Description

Header file for STM32 platform configurations.

Copyright (c) 2024 Analog Devices, Inc. All rights reserved.

This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.

Macro Definition Documentation

◆ AD4692_DMA_NUM_CHANNELS

#define AD4692_DMA_NUM_CHANNELS   2

◆ AD4692_RxDMA_CHANNEL_NUM

#define AD4692_RxDMA_CHANNEL_NUM   DMA_CHANNEL_3

◆ AD4692_TxDMA_CHANNEL_NUM

#define AD4692_TxDMA_CHANNEL_NUM   DMA_CHANNEL_7

◆ bsy_extra_init_params

#define bsy_extra_init_params   stm32_gpio_bsy_extra_init_params

◆ BSY_PIN_NUM

#define BSY_PIN_NUM   0

◆ BSY_PORT_NUM

#define BSY_PORT_NUM   0

◆ cnv_extra_init_params

#define cnv_extra_init_params   stm32_gpio_cnv_extra_init_params

◆ CNV_PIN_NUM

#define CNV_PIN_NUM   10

◆ CNV_PORT_BASE

#define CNV_PORT_BASE   GPIOA

◆ CNV_PORT_NUM

#define CNV_PORT_NUM   0

◆ cnv_pwm_gpio_extra_init_params

#define cnv_pwm_gpio_extra_init_params   stm32_cnv_pwm_gpio_extra_init_params

◆ CNV_TIMER_HANDLE

#define CNV_TIMER_HANDLE   htim1

◆ CNV_TIMER_ID

#define CNV_TIMER_ID   1

◆ CONSOLE_IRQ

#define CONSOLE_IRQ   UART5_IRQn

◆ csb_gpio_extra_init_params

#define csb_gpio_extra_init_params   stm32_csb_gpio_extra_init_params

◆ dma_ops

#define dma_ops   stm32_dma_ops

◆ GPIO_IRQ_PRIORITY

#define GPIO_IRQ_PRIORITY   1

◆ gpio_ops

#define gpio_ops   stm32_gpio_ops

◆ HW_CARRIER_NAME

#define HW_CARRIER_NAME   SDP_K1

◆ I2C_DEV_ID

#define I2C_DEV_ID   1

◆ i2c_extra_init_params

#define i2c_extra_init_params   stm32_i2c_extra_init_params

◆ i2c_ops

#define i2c_ops   stm32_i2c_ops

◆ I2C_TIMING

#define I2C_TIMING   0

◆ MAX_SPI_BAUDRATE

#define MAX_SPI_BAUDRATE   22500000

◆ pwm_cnv_extra_init_params

#define pwm_cnv_extra_init_params   stm32_pwm_cnv_extra_init_params

◆ pwm_ops

#define pwm_ops   stm32_pwm_ops

◆ pwm_spi_burst_extra_init_params

#define pwm_spi_burst_extra_init_params   stm32_pwm_spi_burst_extra_init_params

◆ reset_extra_init_params

#define reset_extra_init_params   stm32_gpio_reset_extra_init_params

◆ RESET_PIN_NUM

#define RESET_PIN_NUM   9

◆ RESET_PORT_NUM

#define RESET_PORT_NUM   6

◆ Rx_DMA_IRQ_ID

#define Rx_DMA_IRQ_ID   DMA2_Stream0_IRQn

◆ S_RATE_CNV_BURST_ADV_ACC

#define S_RATE_CNV_BURST_ADV_ACC   (4000)

◆ S_RATE_CNV_BURST_ADV_AVG

#define S_RATE_CNV_BURST_ADV_AVG   (4500)

◆ S_RATE_CNV_BURST_STD_ACC

#define S_RATE_CNV_BURST_STD_ACC   (5000)

◆ S_RATE_CNV_BURST_STD_AVG

#define S_RATE_CNV_BURST_STD_AVG   (5750)

◆ S_RATE_CNV_CLOCK_INTR_ADV_ACC

#define S_RATE_CNV_CLOCK_INTR_ADV_ACC   (5500)

◆ S_RATE_CNV_CLOCK_INTR_ADV_AVG

#define S_RATE_CNV_CLOCK_INTR_ADV_AVG   (6250)

◆ S_RATE_CNV_CLOCK_INTR_STD_ACC

#define S_RATE_CNV_CLOCK_INTR_STD_ACC   (5500)

◆ S_RATE_CNV_CLOCK_INTR_STD_AVG

#define S_RATE_CNV_CLOCK_INTR_STD_AVG   (6250)

◆ S_RATE_MANUAL_DMA

#define S_RATE_MANUAL_DMA   (800000)

◆ S_RATE_MANUAL_INTR

#define S_RATE_MANUAL_INTR   (50000)

◆ S_RATE_SPI_BURST_ADV_ACC

#define S_RATE_SPI_BURST_ADV_ACC   (4000)

◆ S_RATE_SPI_BURST_ADV_AVG

#define S_RATE_SPI_BURST_ADV_AVG   (4500)

◆ S_RATE_SPI_BURST_STD_ACC

#define S_RATE_SPI_BURST_STD_ACC   (5000)

◆ S_RATE_SPI_BURST_STD_AVG

#define S_RATE_SPI_BURST_STD_AVG   (5750)

◆ spi_burst_extra_init_params

#define spi_burst_extra_init_params   stm32_spi_burst_pwm_gpio_extra_init_params

◆ SPI_BURST_PWM_ID

#define SPI_BURST_PWM_ID   12

◆ SPI_BURST_PWM_PORT

#define SPI_BURST_PWM_PORT   3

◆ SPI_BURST_TIMER_HANDLE

#define SPI_BURST_TIMER_HANDLE   htim4

◆ SPI_BURST_TIMER_ID

#define SPI_BURST_TIMER_ID   4

◆ SPI_CS_PORT_BASE

#define SPI_CS_PORT_BASE   GPIOA

◆ SPI_CS_PORT_NUM

#define SPI_CS_PORT_NUM   0

◆ SPI_CSB

#define SPI_CSB   15

◆ SPI_DEVICE_ID

#define SPI_DEVICE_ID   1

◆ spi_extra_init_params

#define spi_extra_init_params   stm32_spi_extra_init_params

◆ spi_ops

#define spi_ops   stm32_spi_ops

◆ TIMER_1_CLK_DIVIDER

#define TIMER_1_CLK_DIVIDER   2

◆ TIMER_1_PRESCALER

#define TIMER_1_PRESCALER   1

◆ TIMER_4_CLK_DIVIDER

#define TIMER_4_CLK_DIVIDER   1

◆ TIMER_4_PRESCALER

#define TIMER_4_PRESCALER   1

◆ TIMER_8_CLK_DIVIDER

#define TIMER_8_CLK_DIVIDER   2

◆ TIMER_8_PRESCALER

#define TIMER_8_PRESCALER   0

◆ TIMER_CHANNEL_1

#define TIMER_CHANNEL_1   1

◆ TIMER_CHANNEL_3

#define TIMER_CHANNEL_3   3

◆ trigger_gpio_handle

#define trigger_gpio_handle   0

◆ trigger_gpio_irq_extra_params

#define trigger_gpio_irq_extra_params   stm32_gpio_irq_extra_init_params

◆ trigger_gpio_irq_ops

#define trigger_gpio_irq_ops   stm32_gpio_irq_ops

◆ TRIGGER_GPIO_PIN

#define TRIGGER_GPIO_PIN   GP0_PIN_NUM

◆ TRIGGER_GPIO_PORT

#define TRIGGER_GPIO_PORT   0

◆ TRIGGER_INT_ID

#define TRIGGER_INT_ID   BSY_PIN_NUM

◆ TX_TRIGGER_DUTY_RATIO

#define TX_TRIGGER_DUTY_RATIO   30

◆ tx_trigger_extra_init_params

#define tx_trigger_extra_init_params   stm32_tx_trigger_extra_init_params

◆ TX_TRIGGER_PERIOD

#define TX_TRIGGER_PERIOD   400

◆ TX_TRIGGER_TIMER_HANDLE

#define TX_TRIGGER_TIMER_HANDLE   htim8

◆ TX_TRIGGER_TIMER_ID

#define TX_TRIGGER_TIMER_ID   8

◆ uart_extra_init_params

#define uart_extra_init_params   stm32_uart_extra_init_params

◆ UART_IRQ

#define UART_IRQ   OTG_HS_IRQn

◆ UART_MODULE

#define UART_MODULE   5

◆ uart_ops

#define uart_ops   stm32_uart_ops

◆ vcom_extra_init_params

#define vcom_extra_init_params   stm32_vcom_extra_init_params

◆ vcom_ops

#define vcom_ops   stm32_usb_uart_ops

Function Documentation

◆ ad4692_config_and_start_pwm()

int ad4692_config_and_start_pwm ( struct ad4692_desc *  desc)

Configure and start PWM.

Parameters
desc[in]- Device descriptor
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad4692_spi_dma_rx_cplt_callback()

void ad4692_spi_dma_rx_cplt_callback ( DMA_HandleTypeDef *  hdma)

Callback function to flag the capture of number of requested samples.

Parameters
hdma- DMA handler (Unused)
Returns
None

◆ ad4692_spi_dma_rx_half_cplt_callback()

void ad4692_spi_dma_rx_half_cplt_callback ( DMA_HandleTypeDef *  hdma)

Callback function to flag the capture of number of requested samples.

Parameters
hdma- DMA handler (Unused)
Returns
None

◆ ad4692_stop_timer()

void ad4692_stop_timer ( void  )

Stop timers and DMA transfers.

Returns
None
Here is the caller graph for this function:

◆ MX_USB_DEVICE_Init()

void MX_USB_DEVICE_Init ( void  )
Here is the caller graph for this function:

◆ stm32_abort_dma_transfer()

void stm32_abort_dma_transfer ( void  )

Abort DMA Transfers.

Returns
None

◆ stm32_system_init()

void stm32_system_init ( void  )

Initialize the STM32 system peripherals.

Returns
None

◆ stm32_tim4_init()

void stm32_tim4_init ( void  )

Initialize Timer 4.

Returns
None
Here is the caller graph for this function:

◆ SystemClock_Config()

void SystemClock_Config ( void  )

◆ tim8_init()

void tim8_init ( void  )

Initialize Tx trigger advanced PWM parameters.

Returns
None
Here is the caller graph for this function:

◆ tx_trigger_init()

int32_t tx_trigger_init ( void  )

Initialize Tx Trigger Timer.

Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ update_buff()

void update_buff ( uint8_t *  local_buf,
uint8_t *  buf_start_addr 
)

Update buffer index.

Parameters
local_buf[out]- Local Buffer
buf_start_addr[out]- Buffer start addr
Returns
None
Parameters
local_buf[in]- Local Buffer
buf_start_addr[in]- Buffer start addr
Returns
None

Variable Documentation

◆ ad4692_dma_buff_full

volatile bool ad4692_dma_buff_full
extern

◆ ad4692_dma_init_param

struct no_os_dma_init_param ad4692_dma_init_param
extern

◆ ad4692_iio_dev_data

struct iio_device_data* ad4692_iio_dev_data
extern

◆ buff_start_addr

volatile uint32_t* buff_start_addr
extern

◆ callback_count

uint32_t callback_count
extern

◆ csb_gpio_desc

struct no_os_gpio_desc* csb_gpio_desc
extern

◆ data_read

uint32_t data_read
extern

◆ dma_cycle_count

uint32_t dma_cycle_count
extern

◆ hdma_spi1_rx

DMA_HandleTypeDef hdma_spi1_rx
extern

◆ hdma_tim8_ch1

DMA_HandleTypeDef hdma_tim8_ch1
extern

◆ htim1

TIM_HandleTypeDef htim1
extern

◆ htim4

TIM_HandleTypeDef htim4
extern

◆ htim8

TIM_HandleTypeDef htim8
extern

◆ huart5

UART_HandleTypeDef huart5
extern

◆ hUsbDeviceHS

USBD_HandleTypeDef hUsbDeviceHS
extern

◆ iio_dev_data_g

volatile struct iio_device_data* iio_dev_data_g
extern

◆ nb_of_samples_g

uint32_t nb_of_samples_g
extern

◆ num_of_active_channels

uint8_t num_of_active_channels
extern

◆ rxdma_channel

struct stm32_dma_channel rxdma_channel
extern

◆ rxdma_ndtr

uint32_t rxdma_ndtr
extern

◆ stm32_cnv_pwm_gpio_extra_init_params

struct stm32_gpio_init_param stm32_cnv_pwm_gpio_extra_init_params
extern

◆ stm32_csb_gpio_extra_init_params

struct stm32_gpio_init_param stm32_csb_gpio_extra_init_params
extern

◆ stm32_gpio_bsy_extra_init_params

struct stm32_gpio_init_param stm32_gpio_bsy_extra_init_params
extern

◆ stm32_gpio_cnv_extra_init_params

struct stm32_gpio_init_param stm32_gpio_cnv_extra_init_params
extern

◆ stm32_gpio_irq_extra_init_params

struct stm32_gpio_irq_init_param stm32_gpio_irq_extra_init_params
extern

◆ stm32_gpio_reset_extra_init_params

struct stm32_gpio_init_param stm32_gpio_reset_extra_init_params
extern

◆ stm32_i2c_extra_init_params

struct stm32_i2c_init_param stm32_i2c_extra_init_params
extern

◆ stm32_pwm_cnv_extra_init_params

struct stm32_pwm_init_param stm32_pwm_cnv_extra_init_params
extern

◆ stm32_pwm_spi_burst_extra_init_params

struct stm32_pwm_init_param stm32_pwm_spi_burst_extra_init_params
extern

◆ stm32_spi_burst_pwm_gpio_extra_init_params

struct stm32_gpio_init_param stm32_spi_burst_pwm_gpio_extra_init_params
extern

◆ stm32_spi_extra_init_params

struct stm32_spi_init_param stm32_spi_extra_init_params
extern

◆ stm32_tx_trigger_extra_init_params

struct stm32_pwm_init_param stm32_tx_trigger_extra_init_params
extern

◆ stm32_uart_extra_init_params

struct stm32_uart_init_param stm32_uart_extra_init_params
extern

◆ stm32_vcom_extra_init_params

struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
extern

◆ txdma_channel

struct stm32_dma_channel txdma_channel
extern