DEVEL activate button B1, correct some line endings

This commit is contained in:
Tom Kuschel
2022-05-27 21:29:56 +02:00
parent 136191111f
commit efdf1e0764
7 changed files with 990 additions and 908 deletions

View File

@ -82,7 +82,7 @@ const osSemaphoreAttr_t si5351_attributes = {
.name = "si5351"
};
/* USER CODE BEGIN PV */
int leds_on = 1;
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
@ -286,7 +286,7 @@ void SystemClock_Config(void)
/** Configure LSE Drive Capability
*/
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_HIGH);
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
@ -315,11 +315,11 @@ void SystemClock_Config(void)
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV8;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV4;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
{
Error_Handler();
}
@ -342,7 +342,7 @@ static void MX_I2C1_Init(void)
/* USER CODE END I2C1_Init 1 */
hi2c1.Instance = I2C1;
hi2c1.Init.Timing = 0x00505B89;
hi2c1.Init.Timing = 0x00000001;
hi2c1.Init.OwnAddress1 = 0;
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
@ -513,17 +513,11 @@ static void MX_GPIO_Init(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
/*Configure GPIO pins : PC13 PC0 PC1 PC2
PC3 PC4 PC5 PC6
PC8 PC9 PC10 PC11
PC12 */
GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2
|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6
|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
|GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pin : B1_Pin */
GPIO_InitStruct.Pin = B1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : PF0 PF1 PF2 PF3
PF4 PF5 PF6 PF7
@ -543,6 +537,16 @@ static void MX_GPIO_Init(void)
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
/*Configure GPIO pins : PC0 PC1 PC2 PC3
PC4 PC5 PC6 PC8
PC9 PC10 PC11 PC12 */
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_8
|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pins : PA0 PA1 PA2 PA3
PA4 PA5 PA6 PA7
PA15 */
@ -656,11 +660,12 @@ void make_di_dah(si5351_inst_t inst, unsigned int dah, uint32_t delay, uint8_t c
#define SEMAPHORE 0
/* inner function, no need to check inst, clk, nor delay */
#if 1
if (clk==0)
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_SET);
else
HAL_GPIO_WritePin(LD3_GPIO_Port, LD3_Pin, GPIO_PIN_SET);
if (leds_on) {
if (clk==0)
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_SET);
else
HAL_GPIO_WritePin(LD3_GPIO_Port, LD3_Pin, GPIO_PIN_SET);
}
#endif
#if SEMAPHORE
osSemaphoreAcquire(si5351Handle, osWaitForever);
@ -781,17 +786,24 @@ void morse(si5351_inst_t inst, char * s, uint32_t delay, uint8_t clk) {
/* USER CODE END Header_StartDefaultTask */
void StartDefaultTask(void *argument)
{
/* USER CODE BEGIN 5 */
/* USER CODE BEGIN 5 */
(void) argument; //unused argument
int sw, sw_last = GPIO_PIN_RESET;
/* Infinite loop */
for(;;) {
// HAL_GPIO_TogglePin(LD1_GPIO_Port, LD1_Pin);
HAL_GPIO_WritePin(LD1_GPIO_Port, LD1_Pin, GPIO_PIN_SET);
osDelay(5);
HAL_GPIO_WritePin(LD1_GPIO_Port, LD1_Pin, GPIO_PIN_RESET);
osDelay(2000);
// HAL_GPIO_TogglePin(LD1_GPIO_Port, LD1_Pin);
HAL_GPIO_WritePin(LD1_GPIO_Port, LD1_Pin, GPIO_PIN_SET);
osDelay(5);
HAL_GPIO_WritePin(LD1_GPIO_Port, LD1_Pin, GPIO_PIN_RESET);
sw = HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin);
if (sw_last == GPIO_PIN_RESET && sw == GPIO_PIN_SET) {
leds_on = !leds_on;
}
sw_last = sw;
osDelay(2000);
}
/* USER CODE END 5 */
/* USER CODE END 5 */
}
/* USER CODE BEGIN Header_start_terminal_task */
@ -834,7 +846,7 @@ void start_terminal_task(void *argument)
void start_morse_task(void *argument)
{
/* USER CODE BEGIN start_morse_task */
static const uint32_t delay = 10;
static const uint32_t delay = 100;
static const uint8_t clk = 0;
si5351_inst_t inst = argument;
int i = 0;
@ -866,7 +878,7 @@ void start_morse_task(void *argument)
void start_clk2_task(void *argument)
{
/* USER CODE BEGIN start_clk2_task */
static const uint32_t delay = 10;
static const uint32_t delay = 100;
static const uint8_t clk =2;
si5351_inst_t inst = argument;
int i = 0;

View File

@ -1,8 +1,8 @@
/**
******************************************************************************
* @file stm32_si5351.c
* @brief STM32 library/driver for the Si5351 clock chip
from Skyworks Solutions, Inc. (former SiLabs)
* @file stm32_si5351.c
* @brief STM32 library/driver for the Si5351 clock chip
from Skyworks Solutions, Inc. (former SiLabs)
******************************************************************************
* @author: Thomas Kuschel KW4NZ
* created 2022-05-11
@ -130,7 +130,7 @@ int si5351_set_synthesis(si5351_inst_t inst, synthesis_t *synth, uint8_t clk);
/** @brief Give better error numbers based on the Linux error_no.h
* @param i2c_handle the handle of the I2C bus from HAL function, e.g. hi2c1
* @param xtal_frequency either the XTAL frequency (25/27 MHz) or CLock-In
* from 10 MHz to 100 MHz entered in Hz
* from 10 MHz to 100 MHz entered in Hz
* @param i2c_address I2C bus address of the device from datasheet typically 0x60 (or 0x61)
* @param datasize reserve an extra area of data space in bytes, access with function si5351_read_data() and si5351_write_data()
* @return si5351_handle Pointer to the si5351 handle, NULL if error, see si5351_errno
@ -221,7 +221,7 @@ si5351_HandleTypeDef *si5351_initialize(void * i2c_handle) {
/** @brief Initialize the device Si5351 with the main parameters
* @param i2c_handle the handle of the I2C bus from HAL function, e.g. hi2c1
* @param xtal_frequency either the XTAL frequency (25/27 MHz) or CLock-In
* from 10 MHz to 100 MHz entered in Hz
* from 10 MHz to 100 MHz entered in Hz
* @param i2c_address I2C bus address of the device from datasheet typically 0x60 (or 0x61)
* @param datasize reserve an extra area of data space in bytes, access with function si5351_read_data() and si5351_write_data()
* @return si5351_handle Pointer to the si5351 handle, NULL if error, see si5351_errno
@ -423,21 +423,22 @@ int si5351_program(si5351_inst_t inst) {
*/
int band_select(uint32_t frequency, band_t *band) {
static const band_t sband[] = { { "80", 3000000, 4500000, 200, 0},
{ "40", 5625000, 7500000, 120, 0},
{ "30", 7500000,11250000, 80, 0},
{ "20",11250000,15000000, 60, 0},
{ "15",15000000,22500000, 40, 0},
{ "10",22500000,32142000, 28, 0},
{ "8",32142000,45000000, 20, 0},
{ "6",45000000,64285000, 14, 0},
{ "4",64285000,76000000, 10, 0},
{ "3",76000000,11250000, 8, 0},
{ "2",11250000,15000000, 6, 0},
{"180", 1500000, 2250000, 400, 0},
{"120", 2250000, 3000000, 300, 0},
{ "60", 4500000, 5625000, 160, 0},
};
static const band_t sband[] = {
{ "80", 3000000, 4500000, 200, 0},
{ "40", 5625000, 7500000, 120, 0},
{ "30", 7500000,11250000, 80, 0},
{ "20",11250000,15000000, 60, 0},
{ "15",15000000,22500000, 40, 0},
{ "10",22500000,32142000, 28, 0},
{ "8",32142000,45000000, 20, 0},
{ "6",45000000,64285000, 14, 0},
{ "4",64285000,76000000, 10, 0},
{ "3",76000000,11250000, 8, 0},
{ "2",11250000,15000000, 6, 0},
{"180", 1500000, 2250000, 400, 0},
{"120", 2250000, 3000000, 300, 0},
{ "60", 4500000, 5625000, 160, 0},
};
for (uint32_t i = 0; i < (sizeof(sband) / sizeof(sband[0])); i++) {
if (frequency > sband[i].qrg_min && frequency <= sband[i].qrg_max) {
@ -477,39 +478,39 @@ int calculation(uint32_t frequency, uint32_t xtal, synthesis_t *synth) {
return 0;
}
synth->out_r_divider = 0;
if (frequency < 81000000) {
// Valid for frequ in 0.5..112.5 MHz range 9000
// However an error is > 6 Hz above 81 MHz
// synth->pll_multiplier = 36; // PLL runs @ 900 MHz with XTAL 25 MHz, more flexible using the formular:
// making an even integer multiplier with
synth->pll_multiplier = (900000000 / xtal);
synth->pll_multiplier &= ~0x01u; // make it even
synth->pll_numerator = 0;
synth->pll_denominator = 1;
uint32_t Fpll = synth->pll_multiplier * xtal; // this was set to 900000000
synth->out_multiplier = Fpll / frequency;
t = (frequency >> 20) + 1;
synth->out_numerator = (Fpll % frequency) / t;
synth->out_denominator = frequency / t;
} else {
// Valid for Fclk in 75..160 MHz range
if(frequency >= 150000000) {
synth->out_multiplier = 4;
} else if (frequency >= 100000000) {
synth->out_multiplier = 6;
} else {
synth->out_multiplier = 8;
}
synth->out_numerator = 0;
synth->out_denominator = 1;
if (frequency < 81000000) {
// Valid for frequ in 0.5..112.5 MHz range 9000
// However an error is > 6 Hz above 81 MHz
// synth->pll_multiplier = 36; // PLL runs @ 900 MHz with XTAL 25 MHz, more flexible using the formular:
// making an even integer multiplier with
synth->pll_multiplier = (900000000 / xtal);
synth->pll_multiplier &= ~0x01u; // make it even
synth->pll_numerator = 0;
synth->pll_denominator = 1;
uint32_t Fpll = synth->pll_multiplier * xtal; // this was set to 900000000
synth->out_multiplier = Fpll / frequency;
t = (frequency >> 20) + 1;
synth->out_numerator = (Fpll % frequency) / t;
synth->out_denominator = frequency / t;
} else {
// Valid for Fclk in 75..160 MHz range
if(frequency >= 150000000) {
synth->out_multiplier = 4;
} else if (frequency >= 100000000) {
synth->out_multiplier = 6;
} else {
synth->out_multiplier = 8;
}
synth->out_numerator = 0;
synth->out_denominator = 1;
uint32_t numerator = synth->out_multiplier*frequency;
synth->pll_multiplier = numerator / xtal;
t = (xtal >> 20) + 1;
synth->pll_numerator = (numerator % xtal) / t;
synth->pll_denominator = xtal / t;
}
return 0;
uint32_t numerator = synth->out_multiplier*frequency;
synth->pll_multiplier = numerator / xtal;
t = (xtal >> 20) + 1;
synth->pll_numerator = (numerator % xtal) / t;
synth->pll_denominator = xtal / t;
}
return 0;
}
/** @brief Enables the CLK output of the si5351 (after programming and setting the synthesis)
@ -579,8 +580,8 @@ int si5351_set_clk0(si5351_inst_t inst, uint32_t frequency) {
do {
if(!inst->programmed) {
rv = si5351_program(inst);
if (!rv)
break;
if (!rv)
break;
}
(void)calculation(frequency, inst->xtal_frequency, &synth);
rv = si5351_set_synthesis(inst, &synth, 0);
@ -615,8 +616,8 @@ int si5351_set_clk(si5351_inst_t inst, uint32_t frequency, uint8_t clk, si5351_p
do {
if(!inst->programmed) {
rv = si5351_program(inst);
if (rv)
break;
if (rv)
break;
}
(void)calculation(frequency, inst->xtal_frequency, &synth);
rv = si5351_set_synthesis(inst, &synth, clk);
@ -624,8 +625,16 @@ int si5351_set_clk(si5351_inst_t inst, uint32_t frequency, uint8_t clk, si5351_p
return rv;
}
/** @brief Sets the MSNx and MSx parameter registers of the Si5351
* @param si5351_instance Given si5351 device handle
* @param synth synthesis_t struct
* @param clk The CLK ouput to drive and disable 0...CLK0, 1...CLK1, 2...CLK2, ...
* @return 0 on success
* @retval -EINVAL when given a NULL handle
* @retval -ETIMEDOUT when HAL_TIMEOUT
* @retval -EIO when HAL_ERROR
* @retval -EBUSY when HAL_BUSY
*/
int si5351_set_synthesis(si5351_inst_t inst, synthesis_t *synth, uint8_t clk) {
uint32_t MSNx_P1, MSNx_P2, MSNx_P3;
@ -680,7 +689,7 @@ int si5351_set_synthesis(si5351_inst_t inst, synthesis_t *synth, uint8_t clk) {
/* write MSNx registers dependent of SI5351_PLLA or SI5351_PLLB */
regaddr = (inst->clk_is_pllb & (1u << clk)) ? SI5351_MULTISYNTH_NB_PARAMETER_3_HI : SI5351_MULTISYNTH_NA_PARAMETER_3_HI;
rv = si5351_write(inst, regaddr, ms_data, sizeof(ms_data) / sizeof(ms_data[0]));
if (rv != 0)
if (rv)
return rv;
/* write MSx registers dependent of CLK # */
ms_data[0] = (uint8_t) (MSx_P3 >> 8);
@ -693,7 +702,7 @@ int si5351_set_synthesis(si5351_inst_t inst, synthesis_t *synth, uint8_t clk) {
ms_data[7] = (uint8_t) MSx_P2;
regaddr = SI5351_MULTISYNTH0_PARAMETER_3_HI + (uint8_t)(clk * sizeof(ms_data) / sizeof(ms_data[0]));
rv = si5351_write(inst, regaddr, ms_data, sizeof(ms_data) / sizeof(ms_data[0]));
if (rv != 0)
if (rv)
return rv;
if ((synth->out_numerator == 0) && ((synth->out_multiplier & 0x01) == 0))
@ -704,12 +713,12 @@ int si5351_set_synthesis(si5351_inst_t inst, synthesis_t *synth, uint8_t clk) {
ms_data[0] = (uint8_t)(MSx_INT << 6 | MSx_SRC << 5 | SI5351_CLK_SRC_MS0 | SI5351_CLK_8_MA); //SI5351_CLK_6_MA; //SI5351_CLK_4_MA;
regaddr = SI5351_CLK0_CONTROL + clk;
rv = si5351_write(inst, regaddr, ms_data, 1);
if (rv!=0)
if (rv)
return rv;
ms_data[0] = SI5351_PLL_RESET_VALUE;
rv = si5351_write(inst, SI5351_PLL_RESET, ms_data, 1);
if (rv != 0)
if (rv)
return rv;
#if AUTOMATICALLY_ENABLE_OUTPUT
@ -719,6 +728,12 @@ int si5351_set_synthesis(si5351_inst_t inst, synthesis_t *synth, uint8_t clk) {
return rv;
}
#if SI5351_DEBUG
/** @brief With this function, you can read the debug message for test purposes
* @param si5351_instance Given si5351 device handle
* @return * char as message for printing
* @retval NULL when not found
*/
char * si5351_read_debug_msg(si5351_inst_t inst) {
if (!inst && !(inst=first_handle))
@ -746,7 +761,7 @@ int si5351_read_data(si5351_inst_t inst, void * data) {
memcpy(data, inst->data, inst->datasize);
return (int)inst->datasize;
}
#endif
/*!
* @brief Output the value in binary representation and in groups of
@ -779,6 +794,14 @@ int __snprintb(char *buf, size_t n, void *value, size_t size)
return cx;
}
/** @brief Function to read any register with binary and hex representation
* @param si5351_instance Given si5351 device handle
* @param buffer for printing typically 33 bytes char
* @param size of the buffer for printing typically 33 bytes
* @param register address
* @return * char as message for printing
* @retval NULL when not found
*/
char * si5351_read_register_debug(si5351_inst_t inst, char *buf, size_t bufsize, uint8_t regaddr) {
uint8_t data;

View File

@ -1,179 +1,178 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file stm32l4xx_it.c
* @brief Interrupt Service Routines.
******************************************************************************
* @attention
*
* Copyright (c) 2022 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32l4xx_it.h"
/* Private includes ----------------------------------------------------------*/
#include <stdio.h>
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN TD */
/* USER CODE END TD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
/* External variables --------------------------------------------------------*/
extern TIM_HandleTypeDef htim6;
/* USER CODE BEGIN EV */
/* USER CODE END EV */
/******************************************************************************/
/* Cortex-M4 Processor Interruption and Exception Handlers */
/******************************************************************************/
/**
* @brief This function handles Non maskable interrupt.
*/
void NMI_Handler(void)
{
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
/* USER CODE END NonMaskableInt_IRQn 0 */
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
while (1)
{
}
/* USER CODE END NonMaskableInt_IRQn 1 */
}
/**
* @brief This function handles Hard fault interrupt.
*/
void HardFault_Handler(void)
{
/* USER CODE BEGIN HardFault_IRQn 0 */
printf("something went wrong -> HardFault_Handler called\n");
/* USER CODE END HardFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
/* USER CODE END W1_HardFault_IRQn 0 */
}
}
/**
* @brief This function handles Memory management fault.
*/
void MemManage_Handler(void)
{
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
/* USER CODE END MemoryManagement_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
/* USER CODE END W1_MemoryManagement_IRQn 0 */
}
}
/**
* @brief This function handles Prefetch fault, memory access fault.
*/
void BusFault_Handler(void)
{
/* USER CODE BEGIN BusFault_IRQn 0 */
/* USER CODE END BusFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_BusFault_IRQn 0 */
/* USER CODE END W1_BusFault_IRQn 0 */
}
}
/**
* @brief This function handles Undefined instruction or illegal state.
*/
void UsageFault_Handler(void)
{
/* USER CODE BEGIN UsageFault_IRQn 0 */
/* USER CODE END UsageFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_UsageFault_IRQn 0 */
/* USER CODE END W1_UsageFault_IRQn 0 */
}
}
/**
* @brief This function handles Debug monitor.
*/
void DebugMon_Handler(void)
{
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
/* USER CODE END DebugMonitor_IRQn 0 */
/* USER CODE BEGIN DebugMonitor_IRQn 1 */
/* USER CODE END DebugMonitor_IRQn 1 */
}
/******************************************************************************/
/* STM32L4xx Peripheral Interrupt Handlers */
/* Add here the Interrupt Handlers for the used peripherals. */
/* For the available peripheral interrupt handler names, */
/* please refer to the startup file (startup_stm32l4xx.s). */
/******************************************************************************/
/**
* @brief This function handles TIM6 global interrupt, DAC channel1 and channel2 underrun error interrupts.
*/
void TIM6_DAC_IRQHandler(void)
{
/* USER CODE BEGIN TIM6_DAC_IRQn 0 */
/* USER CODE END TIM6_DAC_IRQn 0 */
HAL_TIM_IRQHandler(&htim6);
/* USER CODE BEGIN TIM6_DAC_IRQn 1 */
/* USER CODE END TIM6_DAC_IRQn 1 */
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file stm32l4xx_it.c
* @brief Interrupt Service Routines.
******************************************************************************
* @attention
*
* Copyright (c) 2022 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32l4xx_it.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN TD */
/* USER CODE END TD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
/* External variables --------------------------------------------------------*/
extern TIM_HandleTypeDef htim6;
/* USER CODE BEGIN EV */
/* USER CODE END EV */
/******************************************************************************/
/* Cortex-M4 Processor Interruption and Exception Handlers */
/******************************************************************************/
/**
* @brief This function handles Non maskable interrupt.
*/
void NMI_Handler(void)
{
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
/* USER CODE END NonMaskableInt_IRQn 0 */
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
while (1)
{
}
/* USER CODE END NonMaskableInt_IRQn 1 */
}
/**
* @brief This function handles Hard fault interrupt.
*/
void HardFault_Handler(void)
{
/* USER CODE BEGIN HardFault_IRQn 0 */
printf("something went wrong -> HardFault_Handler called\n");
/* USER CODE END HardFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
/* USER CODE END W1_HardFault_IRQn 0 */
}
}
/**
* @brief This function handles Memory management fault.
*/
void MemManage_Handler(void)
{
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
/* USER CODE END MemoryManagement_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
/* USER CODE END W1_MemoryManagement_IRQn 0 */
}
}
/**
* @brief This function handles Prefetch fault, memory access fault.
*/
void BusFault_Handler(void)
{
/* USER CODE BEGIN BusFault_IRQn 0 */
/* USER CODE END BusFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_BusFault_IRQn 0 */
/* USER CODE END W1_BusFault_IRQn 0 */
}
}
/**
* @brief This function handles Undefined instruction or illegal state.
*/
void UsageFault_Handler(void)
{
/* USER CODE BEGIN UsageFault_IRQn 0 */
/* USER CODE END UsageFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_UsageFault_IRQn 0 */
/* USER CODE END W1_UsageFault_IRQn 0 */
}
}
/**
* @brief This function handles Debug monitor.
*/
void DebugMon_Handler(void)
{
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
/* USER CODE END DebugMonitor_IRQn 0 */
/* USER CODE BEGIN DebugMonitor_IRQn 1 */
/* USER CODE END DebugMonitor_IRQn 1 */
}
/******************************************************************************/
/* STM32L4xx Peripheral Interrupt Handlers */
/* Add here the Interrupt Handlers for the used peripherals. */
/* For the available peripheral interrupt handler names, */
/* please refer to the startup file (startup_stm32l4xx.s). */
/******************************************************************************/
/**
* @brief This function handles TIM6 global interrupt, DAC channel1 and channel2 underrun error interrupts.
*/
void TIM6_DAC_IRQHandler(void)
{
/* USER CODE BEGIN TIM6_DAC_IRQn 0 */
/* USER CODE END TIM6_DAC_IRQn 0 */
HAL_TIM_IRQHandler(&htim6);
/* USER CODE BEGIN TIM6_DAC_IRQn 1 */
/* USER CODE END TIM6_DAC_IRQn 1 */
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */