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

Source file for STM32 platform configurations. More...

#include <stdbool.h>
#include "app_config_stm32.h"
#include "ad4692.h"
#include "app_config.h"
#include "no_os_error.h"
#include "ad4692_user_config.h"
Include dependency graph for app_config_stm32.c:

Functions

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 stm32_abort_dma_transfer (void)
 Abort DMA Transfers.
 
void update_buff (uint8_t *local_buf, uint8_t *buf_start_addr)
 Update buffer index.
 
void ad4692_spi_dma_rx_half_cplt_callback (DMA_HandleTypeDef *hdma)
 Callback function to flag the capture of number of requested samples.
 
void ad4692_spi_dma_rx_cplt_callback (DMA_HandleTypeDef *hdma)
 Callback function to flag the capture of number of requested samples.
 
void DMA2_Stream0_IRQHandler (void)
 DMA2 Stream0 IRQ Handler.
 
void tim8_init (void)
 Initialize Tx trigger advanced PWM parameters.
 
void EXTI0_IRQHandler (void)
 GPIO IRQ handler for the interrupt trigger.
 
void EXTI15_10_IRQHandler (void)
 GPIO15-10 IRQ handler for the interrupt trigger.
 
void stm32_tim4_init (void)
 Initialize Timer 4.
 

Variables

struct stm32_spi_init_param stm32_spi_extra_init_params
 
struct stm32_gpio_init_param stm32_gpio_cnv_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_pwm_init_param stm32_pwm_spi_burst_extra_init_params
 
struct stm32_gpio_init_param stm32_spi_burst_pwm_gpio_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_i2c_init_param stm32_i2c_extra_init_params
 
struct stm32_dma_channel txdma_channel
 
struct stm32_dma_channel rxdma_channel
 
struct stm32_pwm_init_param stm32_tx_trigger_extra_init_params
 
struct stm32_gpio_init_param stm32_csb_gpio_extra_init_params
 
struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
 
struct stm32_uart_init_param stm32_uart_extra_init_params
 
uint32_t rxdma_ndtr
 
uint32_t dma_cycle_count = 0
 
uint8_t * iio_buf_start_idx
 
uint8_t * dma_buf_start_idx
 
uint8_t * iio_buf_current_idx
 
uint8_t * dma_buf_current_idx
 
struct stm32_spi_desc * sdesc
 

Detailed Description

Source 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.

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:

◆ DMA2_Stream0_IRQHandler()

void DMA2_Stream0_IRQHandler ( void  )

DMA2 Stream0 IRQ Handler.

Parameters
None
Returns
None

◆ EXTI0_IRQHandler()

void EXTI0_IRQHandler ( void  )

GPIO IRQ handler for the interrupt trigger.

Returns
None

◆ EXTI15_10_IRQHandler()

void EXTI15_10_IRQHandler ( void  )

GPIO15-10 IRQ handler for the interrupt trigger.

Returns
None

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

◆ tim8_init()

void tim8_init ( void  )

Initialize Tx trigger advanced PWM parameters.

Returns
None
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[in]- Local Buffer
buf_start_addr[in]- Buffer start addr
Returns
None

Variable Documentation

◆ dma_buf_current_idx

uint8_t* dma_buf_current_idx

◆ dma_buf_start_idx

uint8_t* dma_buf_start_idx

◆ dma_cycle_count

uint32_t dma_cycle_count = 0

◆ iio_buf_current_idx

uint8_t* iio_buf_current_idx

◆ iio_buf_start_idx

uint8_t* iio_buf_start_idx

◆ rxdma_channel

struct stm32_dma_channel rxdma_channel
Initial value:
= {
.hdma = &hdma_spi1_rx,
.mem_increment = true,
.mem_data_alignment = DATA_ALIGN_BYTE,
.per_data_alignment = DATA_ALIGN_BYTE,
.dma_mode = DMA_CIRCULAR_MODE,
}
DMA_HandleTypeDef hdma_spi1_rx
#define AD4692_RxDMA_CHANNEL_NUM
Definition app_config_stm32.h:123

◆ rxdma_ndtr

uint32_t rxdma_ndtr

◆ sdesc

struct stm32_spi_desc* sdesc

◆ stm32_cnv_pwm_gpio_extra_init_params

struct stm32_gpio_init_param stm32_cnv_pwm_gpio_extra_init_params
Initial value:
= {
.mode = GPIO_MODE_AF_PP,
.speed = GPIO_SPEED_FREQ_VERY_HIGH,
.alternate = GPIO_AF1_TIM1
}

◆ stm32_csb_gpio_extra_init_params

struct stm32_gpio_init_param stm32_csb_gpio_extra_init_params
Initial value:
= {
.mode = GPIO_MODE_OUTPUT_PP,
.speed = GPIO_SPEED_FREQ_VERY_HIGH,
}

◆ stm32_gpio_bsy_extra_init_params

struct stm32_gpio_init_param stm32_gpio_bsy_extra_init_params
Initial value:
= {
.mode = GPIO_MODE_INPUT,
.speed = GPIO_SPEED_FREQ_VERY_HIGH,
}

◆ stm32_gpio_cnv_extra_init_params

struct stm32_gpio_init_param stm32_gpio_cnv_extra_init_params
Initial value:
= {
.mode = GPIO_MODE_OUTPUT_PP,
.speed = GPIO_SPEED_FREQ_VERY_HIGH,
}

◆ stm32_gpio_irq_extra_init_params

struct stm32_gpio_irq_init_param stm32_gpio_irq_extra_init_params
Initial value:
= {
.port_nb = BSY_PORT_NUM,
}
#define BSY_PORT_NUM
Definition app_config_stm32.h:59

◆ stm32_gpio_reset_extra_init_params

struct stm32_gpio_init_param stm32_gpio_reset_extra_init_params
Initial value:
= {
.mode = GPIO_MODE_OUTPUT_PP,
.speed = GPIO_SPEED_FREQ_VERY_HIGH,
}

◆ stm32_i2c_extra_init_params

struct stm32_i2c_init_param stm32_i2c_extra_init_params
Initial value:
= {
.i2c_timing = I2C_TIMING
}
#define I2C_TIMING
Definition app_config_stm32.h:60

◆ stm32_pwm_cnv_extra_init_params

struct stm32_pwm_init_param stm32_pwm_cnv_extra_init_params
Initial value:
= {
.htimer = &CNV_TIMER_HANDLE,
.prescaler = TIMER_1_PRESCALER,
.timer_autoreload = true,
.mode = TIM_OC_PWM1,
.timer_chn = TIMER_CHANNEL_3,
.complementary_channel = false,
.get_timer_clock = HAL_RCC_GetPCLK2Freq,
.clock_divider = TIMER_1_CLK_DIVIDER
}
#define TIMER_1_PRESCALER
Definition app_config_stm32.h:98
#define TIMER_CHANNEL_3
Definition app_config_stm32.h:109
#define TIMER_1_CLK_DIVIDER
Definition app_config_stm32.h:99
#define CNV_TIMER_HANDLE
Definition app_config_stm32.h:100

◆ stm32_pwm_spi_burst_extra_init_params

struct stm32_pwm_init_param stm32_pwm_spi_burst_extra_init_params
Initial value:
= {
.prescaler = TIMER_4_PRESCALER,
.timer_autoreload = true,
.mode = TIM_OC_PWM1,
.timer_chn = TIMER_CHANNEL_1,
.complementary_channel = false,
.get_timer_clock = HAL_RCC_GetPCLK2Freq,
.clock_divider = TIMER_4_CLK_DIVIDER
}
#define TIMER_CHANNEL_1
Definition app_config_stm32.h:83
#define TIMER_4_CLK_DIVIDER
Definition app_config_stm32.h:105
#define TIMER_4_PRESCALER
Definition app_config_stm32.h:104
#define SPI_BURST_TIMER_HANDLE
Definition app_config_stm32.h:106

◆ stm32_spi_burst_pwm_gpio_extra_init_params

struct stm32_gpio_init_param stm32_spi_burst_pwm_gpio_extra_init_params
Initial value:
= {
.mode = GPIO_MODE_AF_PP,
.speed = GPIO_SPEED_FREQ_VERY_HIGH,
.alternate = GPIO_AF2_TIM4
}

◆ stm32_spi_extra_init_params

struct stm32_spi_init_param stm32_spi_extra_init_params
Initial value:
= {
.chip_select_port = SPI_CS_PORT_NUM,
.get_input_clock = HAL_RCC_GetPCLK2Freq
}
#define SPI_CS_PORT_NUM
Definition app_config_stm32.h:79

◆ stm32_tx_trigger_extra_init_params

struct stm32_pwm_init_param stm32_tx_trigger_extra_init_params
Initial value:
= {
.prescaler = TIMER_8_PRESCALER,
.timer_autoreload = true,
.mode = TIM_OC_PWM1,
.timer_chn = TIMER_CHANNEL_1,
.complementary_channel = false,
.get_timer_clock = HAL_RCC_GetPCLK1Freq,
.clock_divider = TIMER_8_CLK_DIVIDER,
.trigger_output = PWM_TRGO_UPDATE,
.dma_enable = true,
.repetitions = BYTES_PER_SAMPLE - 1,
.onepulse_enable = true
}
#define BYTES_PER_SAMPLE
Definition ad2s1210_iio.c:67
#define TIMER_8_CLK_DIVIDER
Definition app_config_stm32.h:82
#define TIMER_8_PRESCALER
Definition app_config_stm32.h:81
#define TX_TRIGGER_TIMER_HANDLE
Definition app_config_stm32.h:118

◆ stm32_uart_extra_init_params

struct stm32_uart_init_param stm32_uart_extra_init_params
Initial value:
= {
.huart = &huart5,
}
UART_HandleTypeDef huart5

◆ stm32_vcom_extra_init_params

struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
Initial value:
= {
.husbdevice = &hUsbDeviceHS,
}
USBD_HandleTypeDef hUsbDeviceHS

◆ txdma_channel

struct stm32_dma_channel txdma_channel
Initial value:
= {
.hdma = &hdma_tim8_ch1,
.mem_increment = true,
.mem_data_alignment = DATA_ALIGN_BYTE,
.per_data_alignment = DATA_ALIGN_BYTE,
.dma_mode = DMA_CIRCULAR_MODE
}
DMA_HandleTypeDef hdma_tim8_ch1
#define AD4692_TxDMA_CHANNEL_NUM
Definition app_config_stm32.h:122