precision-converters-firmware
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_dma.h"
#include "stm32_pwm.h"
#include "stm32_usb_uart.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 I2C_DEV_ID   1
 
#define UART_MODULE   5
 
#define UART_IRQ   UART5_IRQn
 
#define SPI_DEVICE_ID   1
 
#define SPI_CS_PIN_NUM   15
 
#define STM32_SPI_CS_PORT_BASE   GPIOA
 
#define STM32_SPI_CS_PORT_NUM   0
 
#define CNV_PIN_NUM   10
 
#define CNV_PORT_NUM   0
 
#define GP0_PIN_NUM   15
 
#define GP0_PORT_NUM   1
 
#define GP1_PIN_NUM   11
 
#define GP1_PORT_NUM   6
 
#define STM32_GP1_IRQ   EXTI15_10_IRQn
 
#define STM32_DMA_CONT_HANDLE   hdma_tim1_ch2
 
#define STM32_DMA_CONT_TRIGGER   DMA2_Stream2_IRQn
 
#define STM32_DMA_SPI_RX_TRIGGER   DMA2_Stream0_IRQn
 
#define TIMER_1_PRESCALER   7
 
#define TIMER_2_PRESCALER   3
 
#define TIMER_1_CLK_DIVIDER   2
 
#define TIMER_2_CLK_DIVIDER   2
 
#define TIMER_CHANNEL_1   1
 
#define TIMER_CHANNEL_2   2
 
#define TIMER_CHANNEL_3   3
 
#define TIMER_8_PRESCALER   0
 
#define TIMER_8_CLK_DIVIDER   2
 
#define TRIGGER_GPIO_PORT   0
 
#define TRIGGER_GPIO_PIN   PWM_TRIGGER
 
#define TIMER1_ID   1
 
#define TIMER2_ID   2
 
#define TIMER8_ID   8
 
#define AD405x_DMA_NUM_CHANNELS   2
 
#define AD405x_TxDMA_CHANNEL_NUM   DMA_CHANNEL_7
 
#define AD405x_RxDMA_CHANNEL_NUM   DMA_CHANNEL_3
 
#define Rx_DMA_IRQ_ID   DMA2_Stream0_IRQn
 
#define uart_extra_init_params   stm32_uart_extra_init_params
 
#define spi_extra_init_params   stm32_spi_extra_init_params
 
#define cnv_extra_init_params   stm32_gpio_cnv_extra_init_params
 
#define pwm_extra_init_params   stm32_pwm_cnv_extra_init_params
 
#define pwm_gpio_extra_init_params   stm32_pwm_gpio_extra_init_params
 
#define gp0_extra_init_params   stm32_gpio_gp0_extra_init_params
 
#define gp1_extra_init_params   stm32_gpio_gp1_extra_init_params
 
#define trigger_gpio_irq_extra_params   stm32_gpio_irq_extra_init_params
 
#define dma_extra_init_params   stm32_dma_extra_init_params
 
#define cs_extra_init_params   stm32_cs_extra_init_params
 
#define tx_trigger_extra_init_params   stm32_tx_trigger_extra_init_params
 
#define vcom_extra_init_params   stm32_vcom_extra_init_params
 
#define gpio_ops   stm32_gpio_ops
 
#define spi_ops   stm32_spi_ops
 
#define i2c_ops   stm32_i2c_ops
 
#define uart_ops   stm32_uart_ops
 
#define pwm_ops   stm32_pwm_ops
 
#define trigger_gpio_irq_ops   stm32_gpio_irq_ops
 
#define dma_ops   stm32_dma_ops
 
#define vcom_ops   stm32_usb_uart_ops
 
#define MAX_SPI_SCLK   22500000
 
#define MAX_SPI_SCLK_45MHz   45000000
 
#define SAMPLING_RATE   62500
 
#define CONV_TRIGGER_DUTY_CYCLE_NSEC(x)   (x / 10)
 
#define CONV_TRIGGER_PERIOD_NSEC(x)   (((float)(1.0 / x) * 1000000) * 1000)
 

Functions

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_system_init (void)
 Initialize the STM32 system peripherals. More...
 
void stm32_timer_enable (void)
 Starts the timer signal generation for PWM and OC channels all at once. More...
 
void stm32_timer_stop (void)
 Stops generating timer signals. More...
 
void stm32_cs_output_gpio_config (bool is_gpio)
 Configures the chip select pin as output mode. More...
 
void stm32_cnv_output_gpio_config (bool is_gpio)
 Configures the conversion pin as output mode. More...
 
void stm32_configure_spi_dma (struct no_os_spi_init_param *spi_init_par, struct no_os_spi_desc *spi_desc, bool is_dma_mode)
 
int stm32_abort_dma_transfer (void)
 Abort ongoing SPI RX DMA transfer. More...
 
void receivecomplete_callback (DMA_HandleTypeDef *hdma)
 Callback function to flag the capture of number of requested samples. More...
 

Variables

I2C_HandleTypeDef hi2c1
 
SPI_HandleTypeDef hspi1
 
DMA_HandleTypeDef hdma_spi1_rx
 
TIM_HandleTypeDef htim1
 
TIM_HandleTypeDef htim2
 
DMA_HandleTypeDef hdma_tim1_ch3
 
DMA_HandleTypeDef hdma_tim1_ch2
 
DMA_HandleTypeDef hdma_tim8_ch1
 
UART_HandleTypeDef huart5
 
USBD_HandleTypeDef hUsbDeviceHS
 
volatile bool data_ready
 
struct stm32_uart_init_param stm32_uart_extra_init_params
 
struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
 
struct stm32_spi_init_param stm32_spi_extra_init_params
 
struct stm32_gpio_init_param stm32_pwm_gpio_extra_init_params
 
struct stm32_gpio_init_param stm32_gpio_cnv_extra_init_params
 
struct stm32_gpio_init_param stm32_gpio_gp0_extra_init_params
 
struct stm32_gpio_init_param stm32_gpio_gp1_extra_init_params
 
struct stm32_gpio_init_param stm32_cs_pwm_gpio_extra_init_params
 
struct stm32_gpio_irq_init_param stm32_gpio_irq_extra_init_params
 
struct stm32_pwm_init_param stm32_pwm_cnv_extra_init_params
 
struct stm32_pwm_init_param stm32_dma_extra_init_params
 
struct stm32_pwm_init_param stm32_oc_extra_init_params
 
struct stm32_pwm_init_param stm32_cs_extra_init_params
 
struct stm32_pwm_init_param stm32_tx_trigger_extra_init_params
 
volatile bool ad405x_conversion_flag
 
struct stm32_dma_init_param stm32_spi_dma_extra_init_params
 
struct stm32_dma_channel rxdma_channel
 
struct stm32_dma_channel txdma_channel
 
uint32_t rxdma_ndtr
 
int dma_cycle_count
 
uint32_t callback_count
 

Detailed Description

Header file for STM32 platform configurations.

Copyright (c) 2023-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

◆ AD405x_DMA_NUM_CHANNELS

#define AD405x_DMA_NUM_CHANNELS   2

◆ AD405x_RxDMA_CHANNEL_NUM

#define AD405x_RxDMA_CHANNEL_NUM   DMA_CHANNEL_3

◆ AD405x_TxDMA_CHANNEL_NUM

#define AD405x_TxDMA_CHANNEL_NUM   DMA_CHANNEL_7

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

#define CNV_PORT_NUM   0

◆ CONV_TRIGGER_DUTY_CYCLE_NSEC

#define CONV_TRIGGER_DUTY_CYCLE_NSEC (   x)    (x / 10)

◆ CONV_TRIGGER_PERIOD_NSEC

#define CONV_TRIGGER_PERIOD_NSEC (   x)    (((float)(1.0 / x) * 1000000) * 1000)

◆ cs_extra_init_params

#define cs_extra_init_params   stm32_cs_extra_init_params

◆ dma_extra_init_params

#define dma_extra_init_params   stm32_dma_extra_init_params

◆ dma_ops

#define dma_ops   stm32_dma_ops

◆ gp0_extra_init_params

#define gp0_extra_init_params   stm32_gpio_gp0_extra_init_params

◆ GP0_PIN_NUM

#define GP0_PIN_NUM   15

◆ GP0_PORT_NUM

#define GP0_PORT_NUM   1

◆ gp1_extra_init_params

#define gp1_extra_init_params   stm32_gpio_gp1_extra_init_params

◆ GP1_PIN_NUM

#define GP1_PIN_NUM   11

◆ GP1_PORT_NUM

#define GP1_PORT_NUM   6

◆ gpio_ops

#define gpio_ops   stm32_gpio_ops

◆ I2C_DEV_ID

#define I2C_DEV_ID   1

◆ i2c_ops

#define i2c_ops   stm32_i2c_ops

◆ MAX_SPI_SCLK

#define MAX_SPI_SCLK   22500000

◆ MAX_SPI_SCLK_45MHz

#define MAX_SPI_SCLK_45MHz   45000000

◆ pwm_extra_init_params

#define pwm_extra_init_params   stm32_pwm_cnv_extra_init_params

◆ pwm_gpio_extra_init_params

#define pwm_gpio_extra_init_params   stm32_pwm_gpio_extra_init_params

◆ pwm_ops

#define pwm_ops   stm32_pwm_ops

◆ Rx_DMA_IRQ_ID

#define Rx_DMA_IRQ_ID   DMA2_Stream0_IRQn

◆ SAMPLING_RATE

#define SAMPLING_RATE   62500

◆ SPI_CS_PIN_NUM

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

◆ STM32_DMA_CONT_HANDLE

#define STM32_DMA_CONT_HANDLE   hdma_tim1_ch2

◆ STM32_DMA_CONT_TRIGGER

#define STM32_DMA_CONT_TRIGGER   DMA2_Stream2_IRQn

◆ STM32_DMA_SPI_RX_TRIGGER

#define STM32_DMA_SPI_RX_TRIGGER   DMA2_Stream0_IRQn

◆ STM32_GP1_IRQ

#define STM32_GP1_IRQ   EXTI15_10_IRQn

◆ STM32_SPI_CS_PORT_BASE

#define STM32_SPI_CS_PORT_BASE   GPIOA

◆ STM32_SPI_CS_PORT_NUM

#define STM32_SPI_CS_PORT_NUM   0

◆ TARGET_NAME

#define TARGET_NAME   SDP_K1

◆ TIMER1_ID

#define TIMER1_ID   1

◆ TIMER2_ID

#define TIMER2_ID   2

◆ TIMER8_ID

#define TIMER8_ID   8

◆ TIMER_1_CLK_DIVIDER

#define TIMER_1_CLK_DIVIDER   2

◆ TIMER_1_PRESCALER

#define TIMER_1_PRESCALER   7

◆ TIMER_2_CLK_DIVIDER

#define TIMER_2_CLK_DIVIDER   2

◆ TIMER_2_PRESCALER

#define TIMER_2_PRESCALER   3

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

#define TIMER_CHANNEL_2   2

◆ TIMER_CHANNEL_3

#define TIMER_CHANNEL_3   3

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

◆ TRIGGER_GPIO_PORT

#define TRIGGER_GPIO_PORT   0

◆ tx_trigger_extra_init_params

#define tx_trigger_extra_init_params   stm32_tx_trigger_extra_init_params

◆ uart_extra_init_params

#define uart_extra_init_params   stm32_uart_extra_init_params

◆ UART_IRQ

#define UART_IRQ   UART5_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

◆ 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
Parameters
hdma- DMA Handler (Unused)
Returns
None

◆ stm32_abort_dma_transfer()

int stm32_abort_dma_transfer ( void  )

Abort ongoing SPI RX DMA transfer.

Returns
None

Abort ongoing SPI RX DMA transfer.

Returns
None

◆ stm32_cnv_output_gpio_config()

void stm32_cnv_output_gpio_config ( bool  is_gpio)

Configures the conversion pin as output mode.

Parameters
is_gpio[in]Mode of the Pin
Returns
None

◆ stm32_configure_spi_dma()

void stm32_configure_spi_dma ( struct no_os_spi_init_param *  spi_init_par,
struct no_os_spi_desc *  spi_desc,
bool  is_dma_mode 
)

◆ 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

◆ 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

◆ ad405x_conversion_flag

volatile bool ad405x_conversion_flag
extern

◆ callback_count

uint32_t callback_count
extern

◆ data_ready

volatile bool data_ready
extern

◆ dma_cycle_count

int dma_cycle_count
extern

◆ hdma_spi1_rx

DMA_HandleTypeDef hdma_spi1_rx
extern

◆ hdma_tim1_ch2

DMA_HandleTypeDef hdma_tim1_ch2
extern

◆ hdma_tim1_ch3

DMA_HandleTypeDef hdma_tim1_ch3
extern

◆ hdma_tim8_ch1

DMA_HandleTypeDef hdma_tim8_ch1
extern

◆ hi2c1

I2C_HandleTypeDef hi2c1
extern

◆ hspi1

SPI_HandleTypeDef hspi1
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_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_dma_extra_init_params

struct stm32_pwm_init_param stm32_dma_extra_init_params
extern

◆ stm32_gpio_cnv_extra_init_params

struct stm32_gpio_init_param stm32_gpio_cnv_extra_init_params
extern

◆ stm32_gpio_gp0_extra_init_params

struct stm32_gpio_init_param stm32_gpio_gp0_extra_init_params
extern

◆ stm32_gpio_gp1_extra_init_params

struct stm32_gpio_init_param stm32_gpio_gp1_extra_init_params
extern

◆ stm32_gpio_irq_extra_init_params

struct stm32_gpio_irq_init_param stm32_gpio_irq_extra_init_params
extern

◆ stm32_oc_extra_init_params

struct stm32_pwm_init_param stm32_oc_extra_init_params
extern

◆ stm32_pwm_cnv_extra_init_params

struct stm32_pwm_init_param stm32_pwm_cnv_extra_init_params
extern

◆ stm32_pwm_gpio_extra_init_params

struct stm32_gpio_init_param stm32_pwm_gpio_extra_init_params
extern

◆ stm32_spi_dma_extra_init_params

struct stm32_dma_init_param stm32_spi_dma_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