precision-converters-firmware
Macros | Functions | Variables
app_config_stm32.h File Reference

Header file for STM32 platform configurations. More...

#include <stdint.h>
#include "stm32_uart.h"
#include "stm32_spi.h"
#include "stm32_gpio.h"
#include "stm32_irq.h"
#include "stm32_pwm.h"
#include "stm32_i2c.h"
#include "stm32_gpio_irq.h"
#include "stm32_dma.h"
#include "stm32_usb_uart.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 TARGET_NAME   SDP_K1
 
#define APP_UART_HANDLE   &huart5
 
#define UART_IRQ_ID   UART5_IRQn
 
#define APP_UART_USB_HANDLE   &hUsbDeviceHS
 
#define RESET_PIN   9
 
#define RESET_PORT   6
 
#define CNV_PIN   10
 
#define CNV_PORT   0
 
#define BSY_PIN   7
 
#define BSY_PORT   6
 
#define GPIO_TRIGGER_INT_PORT   BSY_PORT
 
#define SPI_CSB   15
 
#define STM32_SPI_CS_PORT   0
 
#define SPI_CS_PORT_NUM   0
 
#define SPI_CS_PIN_NUM   15
 
#define UART_ID   5
 
#define I2C_DEVICE_ID   1
 
#define SPI_DEVICE_ID   1
 
#define I2C_TIMING   0
 
#define TRIGGER_INT_ID   BSY_PIN
 
#define trigger_gpio_handle   0
 
#define BSY_GPIO_PRIORITY   1
 
#define CNV_PWM_ID   1
 
#define CNV_PWM_CHANNEL   3
 
#define CNV_PWM_CLK_DIVIDER   2
 
#define PWM_GPIO_PORT   CNV_PORT
 
#define PWM_GPIO_PIN   CNV_PIN
 
#define CS_TIMER_ID   2
 
#define CS_TIMER_PRESCALER   0
 
#define CS_TIMER_CHANNEL   1
 
#define TIMER_2_CLK_DIVIDER   2
 
#define TIMER8_ID   8
 
#define TIMER_8_PRESCALER   0
 
#define TIMER_8_CLK_DIVIDER   2
 
#define TIMER_CHANNEL_1   1
 
#define Rx_DMA_IRQ_ID   DMA2_Stream0_IRQn
 
#define TxDMA_CHANNEL_NUM   DMA_CHANNEL_7
 
#define RxDMA_CHANNEL_NUM   DMA_CHANNEL_3
 
#define AD7091R_DMA_NUM_CHANNELS   2
 
#define spi_extra_init_params   stm32_spi_init_params
 
#define uart_extra_init_params   stm32_uart_init_params
 
#define i2c_extra_init_params   stm32_i2c_init_params
 
#define pwm_extra_init_params   stm32_cnv_pwm_init_params
 
#define cnv_gpio_extra_init_param   stm32_gpio_cnv_init_params
 
#define reset_gpio_extra_init_param   stm32_gpio_reset_init_params
 
#define trigger_gpio_irq_extra_params   stm32_trigger_gpio_irq_init_params
 
#define pwm_gpio_extra_init_params   stm32_pwm_cnv_gpio_init_params
 
#define alt_bsy_gpio_extra_init_params   stm32_gpio_gp0_extra_init_params
 
#define tx_trigger_extra_init_params   stm32_tx_trigger_extra_init_params
 
#define cs_extra_init_params   stm32_cs_extra_init_params
 
#define cs_pwm_gpio_extra_init_params   stm32_cs_pwm_gpio_extra_init_params
 
#define vcom_extra_init_params   stm32_vcom_extra_init_params
 
#define trigger_gpio_irq_ops   stm32_gpio_irq_ops
 
#define gpio_ops   stm32_gpio_ops
 
#define spi_ops   stm32_spi_ops
 
#define pwm_ops   stm32_pwm_ops
 
#define uart_ops   stm32_uart_ops
 
#define i2c_ops   stm32_i2c_ops
 
#define dma_ops   stm32_dma_ops
 
#define vcom_ops   stm32_usb_uart_ops
 
#define MAX_SPI_SCLK   40000000
 
#define MAX_SAMPLING_RATE   830000
 
#define CHIP_SELECT_DUTY_CYCLE_NS   530
 
#define CNV_PWM_PRESCALER   1
 
#define PWM_DUTY_CYCLE_NSEC   250
 
#define TX_TRIGGER_PERIOD   400
 
#define TX_TRIGGER_DUTY_CYCLE_NS   30
 

Functions

void receivecomplete_callback (DMA_HandleTypeDef *hdma)
 Callback function to flag the capture of number of requested samples. More...
 
void halfcmplt_callback (DMA_HandleTypeDef *hdma)
 Callback function to flag the capture of half the number of requested samples. More...
 
void update_buff (uint32_t *local_buf, uint32_t *buf_start_addr)
 Update buffer index. More...
 
void stm32_cs_output_gpio_config (bool is_gpio)
 Configures the chip select pin as output mode. More...
 
void tim8_config (void)
 Configure Tx Trigger timer. More...
 
void tim2_config (void)
 Configure CS timer. More...
 
void stm32_timer_stop (void)
 Stops generating timer signals. More...
 
void stm32_timer_enable (void)
 Starts the timer signal generation for PWM and OC channels all at once. More...
 
void stm32_abort_dma_transfer (void)
 Abort ongoing SPI RX DMA transfer. More...
 
void stm32_system_init (void)
 Initialize the STM32 system peripherals. More...
 
void ad7091r8_pulse_convst_stm (void)
 Pull the CONVST line down then up. More...
 
int ad7091r8_read_one_stm (uint8_t channel, uint16_t *read_val)
 Read one sample. More...
 
void configure_intr_priority (void)
 Prioritizes the UART1 interrupt over the other peripheral interrupts. More...
 

Variables

struct stm32_uart_init_param stm32_uart_init_params
 
struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params
 
struct stm32_spi_init_param stm32_spi_init_params
 
struct stm32_i2c_init_param stm32_i2c_init_params
 
struct stm32_gpio_init_param stm32_gpio_cnv_init_params
 
struct stm32_gpio_init_param stm32_gpio_reset_init_params
 
struct stm32_pwm_init_param stm32_cnv_pwm_init_params
 
struct stm32_gpio_init_param stm32_pwm_cnv_gpio_init_params
 
struct stm32_gpio_init_param stm32_gpio_gp0_extra_init_params
 
UART_HandleTypeDef huart5
 
TIM_HandleTypeDef htim1
 
TIM_HandleTypeDef htim2
 
USBD_HandleTypeDef hUsbDeviceHS
 
DMA_HandleTypeDef hdma_tim8_ch1
 
DMA_HandleTypeDef hdma_spi1_rx
 
uint32_t rxdma_ndtr
 
uint32_t dma_cycle_count
 
struct stm32_pwm_init_param stm32_cs_extra_init_params
 
struct stm32_pwm_init_param stm32_tx_trigger_extra_init_params
 
struct stm32_dma_channel rxdma_channel
 
struct stm32_dma_channel txdma_channel
 
struct stm32_gpio_init_param stm32_cs_pwm_gpio_extra_init_params
 
struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
 

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

◆ AD7091R_DMA_NUM_CHANNELS

#define AD7091R_DMA_NUM_CHANNELS   2

◆ alt_bsy_gpio_extra_init_params

#define alt_bsy_gpio_extra_init_params   stm32_gpio_gp0_extra_init_params

◆ APP_UART_HANDLE

#define APP_UART_HANDLE   &huart5

◆ APP_UART_USB_HANDLE

#define APP_UART_USB_HANDLE   &hUsbDeviceHS

◆ BSY_GPIO_PRIORITY

#define BSY_GPIO_PRIORITY   1

◆ BSY_PIN

#define BSY_PIN   7

◆ BSY_PORT

#define BSY_PORT   6

◆ CHIP_SELECT_DUTY_CYCLE_NS

#define CHIP_SELECT_DUTY_CYCLE_NS   530

◆ cnv_gpio_extra_init_param

#define cnv_gpio_extra_init_param   stm32_gpio_cnv_init_params

◆ CNV_PIN

#define CNV_PIN   10

◆ CNV_PORT

#define CNV_PORT   0

◆ CNV_PWM_CHANNEL

#define CNV_PWM_CHANNEL   3

◆ CNV_PWM_CLK_DIVIDER

#define CNV_PWM_CLK_DIVIDER   2

◆ CNV_PWM_ID

#define CNV_PWM_ID   1

◆ CNV_PWM_PRESCALER

#define CNV_PWM_PRESCALER   1

◆ cs_extra_init_params

#define cs_extra_init_params   stm32_cs_extra_init_params

◆ cs_pwm_gpio_extra_init_params

#define cs_pwm_gpio_extra_init_params   stm32_cs_pwm_gpio_extra_init_params

◆ CS_TIMER_CHANNEL

#define CS_TIMER_CHANNEL   1

◆ CS_TIMER_ID

#define CS_TIMER_ID   2

◆ CS_TIMER_PRESCALER

#define CS_TIMER_PRESCALER   0

◆ dma_ops

#define dma_ops   stm32_dma_ops

◆ gpio_ops

#define gpio_ops   stm32_gpio_ops

◆ GPIO_TRIGGER_INT_PORT

#define GPIO_TRIGGER_INT_PORT   BSY_PORT

◆ I2C_DEVICE_ID

#define I2C_DEVICE_ID   1

◆ i2c_extra_init_params

#define i2c_extra_init_params   stm32_i2c_init_params

◆ i2c_ops

#define i2c_ops   stm32_i2c_ops

◆ I2C_TIMING

#define I2C_TIMING   0

◆ MAX_SAMPLING_RATE

#define MAX_SAMPLING_RATE   830000

◆ MAX_SPI_SCLK

#define MAX_SPI_SCLK   40000000

◆ PWM_DUTY_CYCLE_NSEC

#define PWM_DUTY_CYCLE_NSEC   250

◆ pwm_extra_init_params

#define pwm_extra_init_params   stm32_cnv_pwm_init_params

◆ pwm_gpio_extra_init_params

#define pwm_gpio_extra_init_params   stm32_pwm_cnv_gpio_init_params

◆ PWM_GPIO_PIN

#define PWM_GPIO_PIN   CNV_PIN

◆ PWM_GPIO_PORT

#define PWM_GPIO_PORT   CNV_PORT

◆ pwm_ops

#define pwm_ops   stm32_pwm_ops

◆ reset_gpio_extra_init_param

#define reset_gpio_extra_init_param   stm32_gpio_reset_init_params

◆ RESET_PIN

#define RESET_PIN   9

◆ RESET_PORT

#define RESET_PORT   6

◆ Rx_DMA_IRQ_ID

#define Rx_DMA_IRQ_ID   DMA2_Stream0_IRQn

◆ RxDMA_CHANNEL_NUM

#define RxDMA_CHANNEL_NUM   DMA_CHANNEL_3

◆ SPI_CS_PIN_NUM

#define SPI_CS_PIN_NUM   15

◆ 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_init_params

◆ spi_ops

#define spi_ops   stm32_spi_ops

◆ STM32_SPI_CS_PORT

#define STM32_SPI_CS_PORT   0

◆ TARGET_NAME

#define TARGET_NAME   SDP_K1

◆ TIMER8_ID

#define TIMER8_ID   8

◆ TIMER_2_CLK_DIVIDER

#define TIMER_2_CLK_DIVIDER   2

◆ 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

◆ trigger_gpio_handle

#define trigger_gpio_handle   0

◆ trigger_gpio_irq_extra_params

#define trigger_gpio_irq_extra_params   stm32_trigger_gpio_irq_init_params

◆ trigger_gpio_irq_ops

#define trigger_gpio_irq_ops   stm32_gpio_irq_ops

◆ TRIGGER_INT_ID

#define TRIGGER_INT_ID   BSY_PIN

◆ TX_TRIGGER_DUTY_CYCLE_NS

#define TX_TRIGGER_DUTY_CYCLE_NS   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

◆ TxDMA_CHANNEL_NUM

#define TxDMA_CHANNEL_NUM   DMA_CHANNEL_7

◆ uart_extra_init_params

#define uart_extra_init_params   stm32_uart_init_params

◆ UART_ID

#define UART_ID   5

◆ UART_IRQ_ID

#define UART_IRQ_ID   UART5_IRQn

◆ 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

◆ ad7091r8_pulse_convst_stm()

void ad7091r8_pulse_convst_stm ( void  )

Pull the CONVST line down then up.

Returns
none.
Here is the caller graph for this function:

◆ ad7091r8_read_one_stm()

int ad7091r8_read_one_stm ( uint8_t  channel,
uint16_t *  read_val 
)

Read one sample.

Parameters
channel[in]- Channel.
read_val[out]- Value.
Returns
0 in case of success, negative error code otherwise.

◆ configure_intr_priority()

void configure_intr_priority ( void  )

Prioritizes the UART1 interrupt over the other peripheral interrupts.

Returns
None

◆ halfcmplt_callback()

void halfcmplt_callback ( DMA_HandleTypeDef *  hdma)

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

Parameters
hdma- DMA Handler (Unused)
Returns
None

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

Parameters
hdma- DMA Handler (Unused)
Returns
None

◆ receivecomplete_callback()

void receivecomplete_callback ( DMA_HandleTypeDef *  hdma)

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

Parameters
hdma- DMA handler (Unused)
Returns
None
None
None
Parameters
hdma- DMA Handler (Unused)
Returns
None
Here is the caller graph for this function:

◆ stm32_abort_dma_transfer()

void stm32_abort_dma_transfer ( void  )

Abort ongoing SPI RX DMA transfer.

Returns
None

Abort ongoing SPI RX DMA transfer.

Returns
None

◆ stm32_cs_output_gpio_config()

void stm32_cs_output_gpio_config ( bool  is_gpio)

Configures the chip select pin as output mode.

Parameters
is_gpio[in]- Mode of the Pin
Returns
None
Parameters
is_gpio[in]Mode of the Pin
Returns
None

◆ stm32_system_init()

void stm32_system_init ( void  )

Initialize the STM32 system peripherals.

Returns
None

◆ stm32_timer_enable()

void stm32_timer_enable ( void  )

Starts the timer signal generation for PWM and OC channels all at once.

Returns
None

◆ stm32_timer_stop()

void stm32_timer_stop ( void  )

Stops generating timer signals.

Returns
None

Stops generating timer signals.

Returns
None

◆ tim2_config()

void tim2_config ( void  )

Configure CS timer.

Returns
None

◆ tim8_config()

void tim8_config ( void  )

Configure Tx Trigger timer.

Returns
None
None
Note
Tx timer acts as a slave for External Trigger (ETR1) in one-pulse mode to generate DMA requests

◆ update_buff()

void update_buff ( uint32_t *  local_buf,
uint32_t *  buf_start_addr 
)

Update buffer index.

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

Variable Documentation

◆ 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

◆ htim2

TIM_HandleTypeDef htim2
extern

◆ huart5

UART_HandleTypeDef huart5
extern

◆ hUsbDeviceHS

USBD_HandleTypeDef hUsbDeviceHS
extern

◆ rxdma_channel

struct stm32_dma_channel rxdma_channel
extern

◆ rxdma_ndtr

uint32_t rxdma_ndtr
extern

◆ stm32_cnv_pwm_init_params

struct stm32_pwm_init_param stm32_cnv_pwm_init_params
extern

◆ stm32_cs_extra_init_params

struct stm32_pwm_init_param stm32_cs_extra_init_params
extern

◆ stm32_cs_pwm_gpio_extra_init_params

struct stm32_gpio_init_param stm32_cs_pwm_gpio_extra_init_params
extern

◆ stm32_gpio_cnv_init_params

struct stm32_gpio_init_param stm32_gpio_cnv_init_params
extern

◆ stm32_gpio_gp0_extra_init_params

struct stm32_gpio_init_param stm32_gpio_gp0_extra_init_params
extern

◆ stm32_gpio_reset_init_params

struct stm32_gpio_init_param stm32_gpio_reset_init_params
extern

◆ stm32_i2c_init_params

struct stm32_i2c_init_param stm32_i2c_init_params
extern

◆ stm32_pwm_cnv_gpio_init_params

struct stm32_gpio_init_param stm32_pwm_cnv_gpio_init_params
extern

◆ stm32_spi_init_params

struct stm32_spi_init_param stm32_spi_init_params
extern

◆ stm32_trigger_gpio_irq_init_params

struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params
extern

◆ stm32_tx_trigger_extra_init_params

struct stm32_pwm_init_param stm32_tx_trigger_extra_init_params
extern

◆ stm32_uart_init_params

struct stm32_uart_init_param stm32_uart_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