Merge branch 'can' into dev
This commit is contained in:
5
firmware/components/CAN/MainCAN/.gitignore
vendored
5
firmware/components/CAN/MainCAN/.gitignore
vendored
@@ -1,5 +0,0 @@
|
|||||||
.pio
|
|
||||||
.vscode/.browse.c_cpp.db*
|
|
||||||
.vscode/c_cpp_properties.json
|
|
||||||
.vscode/launch.json
|
|
||||||
.vscode/ipch
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
[env:bluepill_F103C8]
|
|
||||||
platform = ststm32
|
|
||||||
board = genericSTM32F103C8
|
|
||||||
framework = stm32cube
|
|
||||||
upload_protocol = stlink
|
|
||||||
upload_flags = -c CPUTAPID 0x2ba01477
|
|
||||||
build_src_filter = +<*> .<EWARM>
|
|
||||||
build_flags =
|
|
||||||
-Isrc/Core/Inc
|
|
||||||
-Isrc/USB_DEVICE/App
|
|
||||||
-Isrc/USB_DEVICE/Target
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,154 +0,0 @@
|
|||||||
#include "main.h"
|
|
||||||
#include "usb_device.h"
|
|
||||||
|
|
||||||
CAN_HandleTypeDef hcan;
|
|
||||||
|
|
||||||
void SystemClock_Config(void);
|
|
||||||
static void MX_GPIO_Init(void);
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
HAL_Init();
|
|
||||||
SystemClock_Config();
|
|
||||||
MX_GPIO_Init();
|
|
||||||
MX_CAN_Init();
|
|
||||||
MX_USB_DEVICE_Init();
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
uint8_t buf[] = "USB Serial Test!";
|
|
||||||
HAL_Delay(1000);
|
|
||||||
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief System Clock Configuration
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void SystemClock_Config(void)
|
|
||||||
{
|
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
|
||||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
|
||||||
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
|
|
||||||
|
|
||||||
/** Initializes the RCC Oscillators according to the specified parameters
|
|
||||||
* in the RCC_OscInitTypeDef structure.
|
|
||||||
*/
|
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
|
||||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
|
||||||
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
|
|
||||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
|
||||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
|
||||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
|
||||||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;
|
|
||||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
|
||||||
{
|
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Initializes the CPU, AHB and APB buses clocks
|
|
||||||
*/
|
|
||||||
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.APB1CLKDivider = RCC_HCLK_DIV2;
|
|
||||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
|
||||||
|
|
||||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
|
|
||||||
{
|
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB;
|
|
||||||
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL;
|
|
||||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
|
|
||||||
{
|
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief CAN Initialization Function
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
static void MX_CAN_Init(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
/* USER CODE BEGIN CAN_Init 0 */
|
|
||||||
|
|
||||||
/* USER CODE END CAN_Init 0 */
|
|
||||||
|
|
||||||
/* USER CODE BEGIN CAN_Init 1 */
|
|
||||||
|
|
||||||
/* USER CODE END CAN_Init 1 */
|
|
||||||
hcan.Instance = CAN1;
|
|
||||||
hcan.Init.Prescaler = 15;
|
|
||||||
hcan.Init.Mode = CAN_MODE_NORMAL;
|
|
||||||
hcan.Init.SyncJumpWidth = CAN_SJW_1TQ;
|
|
||||||
hcan.Init.TimeSeg1 = CAN_BS1_1TQ;
|
|
||||||
hcan.Init.TimeSeg2 = CAN_BS2_1TQ;
|
|
||||||
hcan.Init.TimeTriggeredMode = DISABLE;
|
|
||||||
hcan.Init.AutoBusOff = DISABLE;
|
|
||||||
hcan.Init.AutoWakeUp = DISABLE;
|
|
||||||
hcan.Init.AutoRetransmission = DISABLE;
|
|
||||||
hcan.Init.ReceiveFifoLocked = DISABLE;
|
|
||||||
hcan.Init.TransmitFifoPriority = DISABLE;
|
|
||||||
if (HAL_CAN_Init(&hcan) != HAL_OK)
|
|
||||||
{
|
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
/* USER CODE BEGIN CAN_Init 2 */
|
|
||||||
|
|
||||||
/* USER CODE END CAN_Init 2 */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GPIO Initialization Function
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
static void MX_GPIO_Init(void)
|
|
||||||
{
|
|
||||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
||||||
/* USER CODE BEGIN MX_GPIO_Init_1 */
|
|
||||||
/* USER CODE END MX_GPIO_Init_1 */
|
|
||||||
|
|
||||||
/* GPIO Ports Clock Enable */
|
|
||||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
|
||||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
|
||||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
|
||||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
|
||||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);
|
|
||||||
|
|
||||||
/*Configure GPIO pin : PC13 */
|
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_13;
|
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
||||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
/* USER CODE BEGIN MX_GPIO_Init_2 */
|
|
||||||
/* USER CODE END MX_GPIO_Init_2 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function is executed in case of error occurrence.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void Error_Handler(void)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN Error_Handler_Debug */
|
|
||||||
/* User can add his own implementation to report the HAL error return state */
|
|
||||||
__disable_irq();
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
/* USER CODE END Error_Handler_Debug */
|
|
||||||
}
|
|
||||||
@@ -1,172 +0,0 @@
|
|||||||
/* USER CODE BEGIN Header */
|
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32f1xx_hal_msp.c
|
|
||||||
* @brief This file provides code for the MSP Initialization
|
|
||||||
* and de-Initialization codes.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 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"
|
|
||||||
/* USER CODE BEGIN Includes */
|
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
|
||||||
/* USER CODE BEGIN TD */
|
|
||||||
|
|
||||||
/* USER CODE END TD */
|
|
||||||
|
|
||||||
/* Private define ------------------------------------------------------------*/
|
|
||||||
/* USER CODE BEGIN Define */
|
|
||||||
|
|
||||||
/* USER CODE END Define */
|
|
||||||
|
|
||||||
/* Private macro -------------------------------------------------------------*/
|
|
||||||
/* USER CODE BEGIN Macro */
|
|
||||||
|
|
||||||
/* USER CODE END Macro */
|
|
||||||
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/* USER CODE BEGIN PV */
|
|
||||||
|
|
||||||
/* USER CODE END PV */
|
|
||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
|
||||||
/* USER CODE BEGIN PFP */
|
|
||||||
|
|
||||||
/* USER CODE END PFP */
|
|
||||||
|
|
||||||
/* External functions --------------------------------------------------------*/
|
|
||||||
/* USER CODE BEGIN ExternalFunctions */
|
|
||||||
|
|
||||||
/* USER CODE END ExternalFunctions */
|
|
||||||
|
|
||||||
/* USER CODE BEGIN 0 */
|
|
||||||
|
|
||||||
/* USER CODE END 0 */
|
|
||||||
/**
|
|
||||||
* Initializes the Global MSP.
|
|
||||||
*/
|
|
||||||
void HAL_MspInit(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
/* USER CODE BEGIN MspInit 0 */
|
|
||||||
|
|
||||||
/* USER CODE END MspInit 0 */
|
|
||||||
|
|
||||||
__HAL_RCC_AFIO_CLK_ENABLE();
|
|
||||||
__HAL_RCC_PWR_CLK_ENABLE();
|
|
||||||
|
|
||||||
/* System interrupt init*/
|
|
||||||
|
|
||||||
/** NOJTAG: JTAG-DP Disabled and SW-DP Enabled
|
|
||||||
*/
|
|
||||||
__HAL_AFIO_REMAP_SWJ_NOJTAG();
|
|
||||||
|
|
||||||
/* USER CODE BEGIN MspInit 1 */
|
|
||||||
|
|
||||||
/* USER CODE END MspInit 1 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief CAN MSP Initialization
|
|
||||||
* This function configures the hardware resources used in this example
|
|
||||||
* @param hcan: CAN handle pointer
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan)
|
|
||||||
{
|
|
||||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
||||||
if(hcan->Instance==CAN1)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN CAN1_MspInit 0 */
|
|
||||||
|
|
||||||
/* USER CODE END CAN1_MspInit 0 */
|
|
||||||
/* Peripheral clock enable */
|
|
||||||
__HAL_RCC_CAN1_CLK_ENABLE();
|
|
||||||
|
|
||||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
|
||||||
/**CAN GPIO Configuration
|
|
||||||
PB8 ------> CAN_RX
|
|
||||||
PB9 ------> CAN_TX
|
|
||||||
*/
|
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_8;
|
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_9;
|
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
__HAL_AFIO_REMAP_CAN1_2();
|
|
||||||
|
|
||||||
/* CAN1 interrupt Init */
|
|
||||||
HAL_NVIC_SetPriority(USB_LP_CAN1_RX0_IRQn, 0, 0);
|
|
||||||
HAL_NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn);
|
|
||||||
HAL_NVIC_SetPriority(CAN1_RX1_IRQn, 0, 0);
|
|
||||||
HAL_NVIC_EnableIRQ(CAN1_RX1_IRQn);
|
|
||||||
/* USER CODE BEGIN CAN1_MspInit 1 */
|
|
||||||
|
|
||||||
/* USER CODE END CAN1_MspInit 1 */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief CAN MSP De-Initialization
|
|
||||||
* This function freeze the hardware resources used in this example
|
|
||||||
* @param hcan: CAN handle pointer
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan)
|
|
||||||
{
|
|
||||||
if(hcan->Instance==CAN1)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN CAN1_MspDeInit 0 */
|
|
||||||
|
|
||||||
/* USER CODE END CAN1_MspDeInit 0 */
|
|
||||||
/* Peripheral clock disable */
|
|
||||||
__HAL_RCC_CAN1_CLK_DISABLE();
|
|
||||||
|
|
||||||
/**CAN GPIO Configuration
|
|
||||||
PB8 ------> CAN_RX
|
|
||||||
PB9 ------> CAN_TX
|
|
||||||
*/
|
|
||||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8|GPIO_PIN_9);
|
|
||||||
|
|
||||||
/* CAN1 interrupt DeInit */
|
|
||||||
/* USER CODE BEGIN CAN1:USB_LP_CAN1_RX0_IRQn disable */
|
|
||||||
/**
|
|
||||||
* Uncomment the line below to disable the "USB_LP_CAN1_RX0_IRQn" interrupt
|
|
||||||
* Be aware, disabling shared interrupt may affect other IPs
|
|
||||||
*/
|
|
||||||
/* HAL_NVIC_DisableIRQ(USB_LP_CAN1_RX0_IRQn); */
|
|
||||||
/* USER CODE END CAN1:USB_LP_CAN1_RX0_IRQn disable */
|
|
||||||
|
|
||||||
HAL_NVIC_DisableIRQ(CAN1_RX1_IRQn);
|
|
||||||
/* USER CODE BEGIN CAN1_MspDeInit 1 */
|
|
||||||
|
|
||||||
/* USER CODE END CAN1_MspDeInit 1 */
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* USER CODE BEGIN 1 */
|
|
||||||
|
|
||||||
/* USER CODE END 1 */
|
|
||||||
@@ -1,406 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file system_stm32f1xx.c
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Source File.
|
|
||||||
*
|
|
||||||
* 1. This file provides two functions and one global variable to be called from
|
|
||||||
* user application:
|
|
||||||
* - SystemInit(): Setups the system clock (System clock source, PLL Multiplier
|
|
||||||
* factors, AHB/APBx prescalers and Flash settings).
|
|
||||||
* This function is called at startup just after reset and
|
|
||||||
* before branch to main program. This call is made inside
|
|
||||||
* the "startup_stm32f1xx_xx.s" file.
|
|
||||||
*
|
|
||||||
* - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
|
|
||||||
* by the user application to setup the SysTick
|
|
||||||
* timer or configure other parameters.
|
|
||||||
*
|
|
||||||
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
|
|
||||||
* be called whenever the core clock is changed
|
|
||||||
* during program execution.
|
|
||||||
*
|
|
||||||
* 2. After each device reset the HSI (8 MHz) is used as system clock source.
|
|
||||||
* Then SystemInit() function is called, in "startup_stm32f1xx_xx.s" file, to
|
|
||||||
* configure the system clock before to branch to main program.
|
|
||||||
*
|
|
||||||
* 4. The default value of HSE crystal is set to 8 MHz (or 25 MHz, depending on
|
|
||||||
* the product used), refer to "HSE_VALUE".
|
|
||||||
* When HSE is used as system clock source, directly or through PLL, and you
|
|
||||||
* are using different crystal you have to adapt the HSE value to your own
|
|
||||||
* configuration.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017-2021 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.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup CMSIS
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup stm32f1xx_system
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32F1xx_System_Private_Includes
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "stm32f1xx.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32F1xx_System_Private_TypesDefinitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32F1xx_System_Private_Defines
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined (HSE_VALUE)
|
|
||||||
#define HSE_VALUE 8000000U /*!< Default value of the External oscillator in Hz.
|
|
||||||
This value can be provided and adapted by the user application. */
|
|
||||||
#endif /* HSE_VALUE */
|
|
||||||
|
|
||||||
#if !defined (HSI_VALUE)
|
|
||||||
#define HSI_VALUE 8000000U /*!< Default value of the Internal oscillator in Hz.
|
|
||||||
This value can be provided and adapted by the user application. */
|
|
||||||
#endif /* HSI_VALUE */
|
|
||||||
|
|
||||||
/*!< Uncomment the following line if you need to use external SRAM */
|
|
||||||
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
|
|
||||||
/* #define DATA_IN_ExtSRAM */
|
|
||||||
#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */
|
|
||||||
|
|
||||||
/* Note: Following vector table addresses must be defined in line with linker
|
|
||||||
configuration. */
|
|
||||||
/*!< Uncomment the following line if you need to relocate the vector table
|
|
||||||
anywhere in Flash or Sram, else the vector table is kept at the automatic
|
|
||||||
remap of boot address selected */
|
|
||||||
/* #define USER_VECT_TAB_ADDRESS */
|
|
||||||
|
|
||||||
#if defined(USER_VECT_TAB_ADDRESS)
|
|
||||||
/*!< Uncomment the following line if you need to relocate your vector Table
|
|
||||||
in Sram else user remap will be done in Flash. */
|
|
||||||
/* #define VECT_TAB_SRAM */
|
|
||||||
#if defined(VECT_TAB_SRAM)
|
|
||||||
#define VECT_TAB_BASE_ADDRESS SRAM_BASE /*!< Vector Table base address field.
|
|
||||||
This value must be a multiple of 0x200. */
|
|
||||||
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
|
|
||||||
This value must be a multiple of 0x200. */
|
|
||||||
#else
|
|
||||||
#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
|
|
||||||
This value must be a multiple of 0x200. */
|
|
||||||
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
|
|
||||||
This value must be a multiple of 0x200. */
|
|
||||||
#endif /* VECT_TAB_SRAM */
|
|
||||||
#endif /* USER_VECT_TAB_ADDRESS */
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32F1xx_System_Private_Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32F1xx_System_Private_Variables
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This variable is updated in three ways:
|
|
||||||
1) by calling CMSIS function SystemCoreClockUpdate()
|
|
||||||
2) by calling HAL API function HAL_RCC_GetHCLKFreq()
|
|
||||||
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
|
||||||
Note: If you use this function to configure the system clock; then there
|
|
||||||
is no need to call the 2 first functions listed above, since SystemCoreClock
|
|
||||||
variable is updated automatically.
|
|
||||||
*/
|
|
||||||
uint32_t SystemCoreClock = 8000000;
|
|
||||||
const uint8_t AHBPrescTable[16U] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
|
||||||
const uint8_t APBPrescTable[8U] = {0, 0, 0, 0, 1, 2, 3, 4};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32F1xx_System_Private_FunctionPrototypes
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
|
|
||||||
#ifdef DATA_IN_ExtSRAM
|
|
||||||
static void SystemInit_ExtMemCtl(void);
|
|
||||||
#endif /* DATA_IN_ExtSRAM */
|
|
||||||
#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32F1xx_System_Private_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Setup the microcontroller system
|
|
||||||
* Initialize the Embedded Flash Interface, the PLL and update the
|
|
||||||
* SystemCoreClock variable.
|
|
||||||
* @note This function should be used only after reset.
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void SystemInit (void)
|
|
||||||
{
|
|
||||||
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
|
|
||||||
#ifdef DATA_IN_ExtSRAM
|
|
||||||
SystemInit_ExtMemCtl();
|
|
||||||
#endif /* DATA_IN_ExtSRAM */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Configure the Vector Table location -------------------------------------*/
|
|
||||||
#if defined(USER_VECT_TAB_ADDRESS)
|
|
||||||
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM. */
|
|
||||||
#endif /* USER_VECT_TAB_ADDRESS */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Update SystemCoreClock variable according to Clock Register Values.
|
|
||||||
* The SystemCoreClock variable contains the core clock (HCLK), it can
|
|
||||||
* be used by the user application to setup the SysTick timer or configure
|
|
||||||
* other parameters.
|
|
||||||
*
|
|
||||||
* @note Each time the core clock (HCLK) changes, this function must be called
|
|
||||||
* to update SystemCoreClock variable value. Otherwise, any configuration
|
|
||||||
* based on this variable will be incorrect.
|
|
||||||
*
|
|
||||||
* @note - The system frequency computed by this function is not the real
|
|
||||||
* frequency in the chip. It is calculated based on the predefined
|
|
||||||
* constant and the selected clock source:
|
|
||||||
*
|
|
||||||
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
|
|
||||||
*
|
|
||||||
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
|
|
||||||
*
|
|
||||||
* - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
|
|
||||||
* or HSI_VALUE(*) multiplied by the PLL factors.
|
|
||||||
*
|
|
||||||
* (*) HSI_VALUE is a constant defined in stm32f1xx.h file (default value
|
|
||||||
* 8 MHz) but the real value may vary depending on the variations
|
|
||||||
* in voltage and temperature.
|
|
||||||
*
|
|
||||||
* (**) HSE_VALUE is a constant defined in stm32f1xx.h file (default value
|
|
||||||
* 8 MHz or 25 MHz, depending on the product used), user has to ensure
|
|
||||||
* that HSE_VALUE is same as the real frequency of the crystal used.
|
|
||||||
* Otherwise, this function may have wrong result.
|
|
||||||
*
|
|
||||||
* - The result of this function could be not correct when using fractional
|
|
||||||
* value for HSE crystal.
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void SystemCoreClockUpdate (void)
|
|
||||||
{
|
|
||||||
uint32_t tmp = 0U, pllmull = 0U, pllsource = 0U;
|
|
||||||
|
|
||||||
#if defined(STM32F105xC) || defined(STM32F107xC)
|
|
||||||
uint32_t prediv1source = 0U, prediv1factor = 0U, prediv2factor = 0U, pll2mull = 0U;
|
|
||||||
#endif /* STM32F105xC */
|
|
||||||
|
|
||||||
#if defined(STM32F100xB) || defined(STM32F100xE)
|
|
||||||
uint32_t prediv1factor = 0U;
|
|
||||||
#endif /* STM32F100xB or STM32F100xE */
|
|
||||||
|
|
||||||
/* Get SYSCLK source -------------------------------------------------------*/
|
|
||||||
tmp = RCC->CFGR & RCC_CFGR_SWS;
|
|
||||||
|
|
||||||
switch (tmp)
|
|
||||||
{
|
|
||||||
case 0x00U: /* HSI used as system clock */
|
|
||||||
SystemCoreClock = HSI_VALUE;
|
|
||||||
break;
|
|
||||||
case 0x04U: /* HSE used as system clock */
|
|
||||||
SystemCoreClock = HSE_VALUE;
|
|
||||||
break;
|
|
||||||
case 0x08U: /* PLL used as system clock */
|
|
||||||
|
|
||||||
/* Get PLL clock source and multiplication factor ----------------------*/
|
|
||||||
pllmull = RCC->CFGR & RCC_CFGR_PLLMULL;
|
|
||||||
pllsource = RCC->CFGR & RCC_CFGR_PLLSRC;
|
|
||||||
|
|
||||||
#if !defined(STM32F105xC) && !defined(STM32F107xC)
|
|
||||||
pllmull = ( pllmull >> 18U) + 2U;
|
|
||||||
|
|
||||||
if (pllsource == 0x00U)
|
|
||||||
{
|
|
||||||
/* HSI oscillator clock divided by 2 selected as PLL clock entry */
|
|
||||||
SystemCoreClock = (HSI_VALUE >> 1U) * pllmull;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if defined(STM32F100xB) || defined(STM32F100xE)
|
|
||||||
prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1U;
|
|
||||||
/* HSE oscillator clock selected as PREDIV1 clock entry */
|
|
||||||
SystemCoreClock = (HSE_VALUE / prediv1factor) * pllmull;
|
|
||||||
#else
|
|
||||||
/* HSE selected as PLL clock entry */
|
|
||||||
if ((RCC->CFGR & RCC_CFGR_PLLXTPRE) != (uint32_t)RESET)
|
|
||||||
{/* HSE oscillator clock divided by 2 */
|
|
||||||
SystemCoreClock = (HSE_VALUE >> 1U) * pllmull;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SystemCoreClock = HSE_VALUE * pllmull;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
pllmull = pllmull >> 18U;
|
|
||||||
|
|
||||||
if (pllmull != 0x0DU)
|
|
||||||
{
|
|
||||||
pllmull += 2U;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ /* PLL multiplication factor = PLL input clock * 6.5 */
|
|
||||||
pllmull = 13U / 2U;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pllsource == 0x00U)
|
|
||||||
{
|
|
||||||
/* HSI oscillator clock divided by 2 selected as PLL clock entry */
|
|
||||||
SystemCoreClock = (HSI_VALUE >> 1U) * pllmull;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{/* PREDIV1 selected as PLL clock entry */
|
|
||||||
|
|
||||||
/* Get PREDIV1 clock source and division factor */
|
|
||||||
prediv1source = RCC->CFGR2 & RCC_CFGR2_PREDIV1SRC;
|
|
||||||
prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1U;
|
|
||||||
|
|
||||||
if (prediv1source == 0U)
|
|
||||||
{
|
|
||||||
/* HSE oscillator clock selected as PREDIV1 clock entry */
|
|
||||||
SystemCoreClock = (HSE_VALUE / prediv1factor) * pllmull;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{/* PLL2 clock selected as PREDIV1 clock entry */
|
|
||||||
|
|
||||||
/* Get PREDIV2 division factor and PLL2 multiplication factor */
|
|
||||||
prediv2factor = ((RCC->CFGR2 & RCC_CFGR2_PREDIV2) >> 4U) + 1U;
|
|
||||||
pll2mull = ((RCC->CFGR2 & RCC_CFGR2_PLL2MUL) >> 8U) + 2U;
|
|
||||||
SystemCoreClock = (((HSE_VALUE / prediv2factor) * pll2mull) / prediv1factor) * pllmull;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* STM32F105xC */
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
SystemCoreClock = HSI_VALUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Compute HCLK clock frequency ----------------*/
|
|
||||||
/* Get HCLK prescaler */
|
|
||||||
tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4U)];
|
|
||||||
/* HCLK clock frequency */
|
|
||||||
SystemCoreClock >>= tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
|
|
||||||
/**
|
|
||||||
* @brief Setup the external memory controller. Called in startup_stm32f1xx.s
|
|
||||||
* before jump to __main
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#ifdef DATA_IN_ExtSRAM
|
|
||||||
/**
|
|
||||||
* @brief Setup the external memory controller.
|
|
||||||
* Called in startup_stm32f1xx_xx.s/.c before jump to main.
|
|
||||||
* This function configures the external SRAM mounted on STM3210E-EVAL
|
|
||||||
* board (STM32 High density devices). This SRAM will be used as program
|
|
||||||
* data memory (including heap and stack).
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void SystemInit_ExtMemCtl(void)
|
|
||||||
{
|
|
||||||
__IO uint32_t tmpreg;
|
|
||||||
/*!< FSMC Bank1 NOR/SRAM3 is used for the STM3210E-EVAL, if another Bank is
|
|
||||||
required, then adjust the Register Addresses */
|
|
||||||
|
|
||||||
/* Enable FSMC clock */
|
|
||||||
RCC->AHBENR = 0x00000114U;
|
|
||||||
|
|
||||||
/* Delay after an RCC peripheral clock enabling */
|
|
||||||
tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_FSMCEN);
|
|
||||||
|
|
||||||
/* Enable GPIOD, GPIOE, GPIOF and GPIOG clocks */
|
|
||||||
RCC->APB2ENR = 0x000001E0U;
|
|
||||||
|
|
||||||
/* Delay after an RCC peripheral clock enabling */
|
|
||||||
tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_IOPDEN);
|
|
||||||
|
|
||||||
(void)(tmpreg);
|
|
||||||
|
|
||||||
/* --------------- SRAM Data lines, NOE and NWE configuration ---------------*/
|
|
||||||
/*---------------- SRAM Address lines configuration -------------------------*/
|
|
||||||
/*---------------- NOE and NWE configuration --------------------------------*/
|
|
||||||
/*---------------- NE3 configuration ----------------------------------------*/
|
|
||||||
/*---------------- NBL0, NBL1 configuration ---------------------------------*/
|
|
||||||
|
|
||||||
GPIOD->CRL = 0x44BB44BBU;
|
|
||||||
GPIOD->CRH = 0xBBBBBBBBU;
|
|
||||||
|
|
||||||
GPIOE->CRL = 0xB44444BBU;
|
|
||||||
GPIOE->CRH = 0xBBBBBBBBU;
|
|
||||||
|
|
||||||
GPIOF->CRL = 0x44BBBBBBU;
|
|
||||||
GPIOF->CRH = 0xBBBB4444U;
|
|
||||||
|
|
||||||
GPIOG->CRL = 0x44BBBBBBU;
|
|
||||||
GPIOG->CRH = 0x444B4B44U;
|
|
||||||
|
|
||||||
/*---------------- FSMC Configuration ---------------------------------------*/
|
|
||||||
/*---------------- Enable FSMC Bank1_SRAM Bank ------------------------------*/
|
|
||||||
|
|
||||||
FSMC_Bank1->BTCR[4U] = 0x00001091U;
|
|
||||||
FSMC_Bank1->BTCR[5U] = 0x00110212U;
|
|
||||||
}
|
|
||||||
#endif /* DATA_IN_ExtSRAM */
|
|
||||||
#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<workspace>
|
|
||||||
<project>
|
|
||||||
<path>$WS_DIR$\MainCAN.ewp</path>
|
|
||||||
</project>
|
|
||||||
<batchBuild />
|
|
||||||
</workspace>
|
|
||||||
@@ -1,390 +0,0 @@
|
|||||||
;******************** (C) COPYRIGHT 2017 STMicroelectronics ********************
|
|
||||||
;* File Name : startup_stm32f103xb.s
|
|
||||||
;* Author : MCD Application Team
|
|
||||||
;* Description : STM32F103xB Performance Line Devices vector table for
|
|
||||||
;* EWARM toolchain.
|
|
||||||
;* This module performs:
|
|
||||||
;* - Set the initial SP
|
|
||||||
;* - Configure the clock system
|
|
||||||
;* - Set the initial PC == __iar_program_start,
|
|
||||||
;* - Set the vector table entries with the exceptions ISR
|
|
||||||
;* address.
|
|
||||||
;* After Reset the Cortex-M3 processor is in Thread mode,
|
|
||||||
;* priority is Privileged, and the Stack is set to Main.
|
|
||||||
;********************************************************************************
|
|
||||||
;*
|
|
||||||
;* Copyright (c) 2017-2021 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.
|
|
||||||
;
|
|
||||||
;*******************************************************************************
|
|
||||||
;
|
|
||||||
;
|
|
||||||
; The modules in this file are included in the libraries, and may be replaced
|
|
||||||
; by any user-defined modules that define the PUBLIC symbol _program_start or
|
|
||||||
; a user defined start symbol.
|
|
||||||
; To override the cstartup defined in the library, simply add your modified
|
|
||||||
; version to the workbench project.
|
|
||||||
;
|
|
||||||
; The vector table is normally located at address 0.
|
|
||||||
; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
|
|
||||||
; The name "__vector_table" has special meaning for C-SPY:
|
|
||||||
; it is where the SP start value is found, and the NVIC vector
|
|
||||||
; table register (VTOR) is initialized to this address if != 0.
|
|
||||||
;
|
|
||||||
; Cortex-M version
|
|
||||||
;
|
|
||||||
|
|
||||||
MODULE ?cstartup
|
|
||||||
|
|
||||||
;; Forward declaration of sections.
|
|
||||||
SECTION CSTACK:DATA:NOROOT(3)
|
|
||||||
|
|
||||||
SECTION .intvec:CODE:NOROOT(2)
|
|
||||||
|
|
||||||
EXTERN __iar_program_start
|
|
||||||
EXTERN SystemInit
|
|
||||||
PUBLIC __vector_table
|
|
||||||
|
|
||||||
DATA
|
|
||||||
__vector_table
|
|
||||||
DCD sfe(CSTACK)
|
|
||||||
DCD Reset_Handler ; Reset Handler
|
|
||||||
DCD NMI_Handler ; NMI Handler
|
|
||||||
DCD HardFault_Handler ; Hard Fault Handler
|
|
||||||
DCD MemManage_Handler ; MPU Fault Handler
|
|
||||||
DCD BusFault_Handler ; Bus Fault Handler
|
|
||||||
DCD UsageFault_Handler ; Usage Fault Handler
|
|
||||||
DCD 0 ; Reserved
|
|
||||||
DCD 0 ; Reserved
|
|
||||||
DCD 0 ; Reserved
|
|
||||||
DCD 0 ; Reserved
|
|
||||||
DCD SVC_Handler ; SVCall Handler
|
|
||||||
DCD DebugMon_Handler ; Debug Monitor Handler
|
|
||||||
DCD 0 ; Reserved
|
|
||||||
DCD PendSV_Handler ; PendSV Handler
|
|
||||||
DCD SysTick_Handler ; SysTick Handler
|
|
||||||
|
|
||||||
; External Interrupts
|
|
||||||
DCD WWDG_IRQHandler ; Window Watchdog
|
|
||||||
DCD PVD_IRQHandler ; PVD through EXTI Line detect
|
|
||||||
DCD TAMPER_IRQHandler ; Tamper
|
|
||||||
DCD RTC_IRQHandler ; RTC
|
|
||||||
DCD FLASH_IRQHandler ; Flash
|
|
||||||
DCD RCC_IRQHandler ; RCC
|
|
||||||
DCD EXTI0_IRQHandler ; EXTI Line 0
|
|
||||||
DCD EXTI1_IRQHandler ; EXTI Line 1
|
|
||||||
DCD EXTI2_IRQHandler ; EXTI Line 2
|
|
||||||
DCD EXTI3_IRQHandler ; EXTI Line 3
|
|
||||||
DCD EXTI4_IRQHandler ; EXTI Line 4
|
|
||||||
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
|
|
||||||
DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
|
|
||||||
DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
|
|
||||||
DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
|
|
||||||
DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
|
|
||||||
DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
|
|
||||||
DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
|
|
||||||
DCD ADC1_2_IRQHandler ; ADC1 & ADC2
|
|
||||||
DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
|
|
||||||
DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
|
|
||||||
DCD CAN1_RX1_IRQHandler ; CAN1 RX1
|
|
||||||
DCD CAN1_SCE_IRQHandler ; CAN1 SCE
|
|
||||||
DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
|
|
||||||
DCD TIM1_BRK_IRQHandler ; TIM1 Break
|
|
||||||
DCD TIM1_UP_IRQHandler ; TIM1 Update
|
|
||||||
DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
|
|
||||||
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
|
|
||||||
DCD TIM2_IRQHandler ; TIM2
|
|
||||||
DCD TIM3_IRQHandler ; TIM3
|
|
||||||
DCD TIM4_IRQHandler ; TIM4
|
|
||||||
DCD I2C1_EV_IRQHandler ; I2C1 Event
|
|
||||||
DCD I2C1_ER_IRQHandler ; I2C1 Error
|
|
||||||
DCD I2C2_EV_IRQHandler ; I2C2 Event
|
|
||||||
DCD I2C2_ER_IRQHandler ; I2C2 Error
|
|
||||||
DCD SPI1_IRQHandler ; SPI1
|
|
||||||
DCD SPI2_IRQHandler ; SPI2
|
|
||||||
DCD USART1_IRQHandler ; USART1
|
|
||||||
DCD USART2_IRQHandler ; USART2
|
|
||||||
DCD USART3_IRQHandler ; USART3
|
|
||||||
DCD EXTI15_10_IRQHandler ; EXTI Line 15..10
|
|
||||||
DCD RTC_Alarm_IRQHandler ; RTC Alarm through EXTI Line
|
|
||||||
DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;;
|
|
||||||
;; Default interrupt handlers.
|
|
||||||
;;
|
|
||||||
THUMB
|
|
||||||
|
|
||||||
PUBWEAK Reset_Handler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(2)
|
|
||||||
Reset_Handler
|
|
||||||
LDR R0, =SystemInit
|
|
||||||
BLX R0
|
|
||||||
LDR R0, =__iar_program_start
|
|
||||||
BX R0
|
|
||||||
|
|
||||||
PUBWEAK NMI_Handler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
NMI_Handler
|
|
||||||
B NMI_Handler
|
|
||||||
|
|
||||||
PUBWEAK HardFault_Handler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
HardFault_Handler
|
|
||||||
B HardFault_Handler
|
|
||||||
|
|
||||||
PUBWEAK MemManage_Handler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
MemManage_Handler
|
|
||||||
B MemManage_Handler
|
|
||||||
|
|
||||||
PUBWEAK BusFault_Handler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
BusFault_Handler
|
|
||||||
B BusFault_Handler
|
|
||||||
|
|
||||||
PUBWEAK UsageFault_Handler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
UsageFault_Handler
|
|
||||||
B UsageFault_Handler
|
|
||||||
|
|
||||||
PUBWEAK SVC_Handler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
SVC_Handler
|
|
||||||
B SVC_Handler
|
|
||||||
|
|
||||||
PUBWEAK DebugMon_Handler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
DebugMon_Handler
|
|
||||||
B DebugMon_Handler
|
|
||||||
|
|
||||||
PUBWEAK PendSV_Handler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
PendSV_Handler
|
|
||||||
B PendSV_Handler
|
|
||||||
|
|
||||||
PUBWEAK SysTick_Handler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
SysTick_Handler
|
|
||||||
B SysTick_Handler
|
|
||||||
|
|
||||||
PUBWEAK WWDG_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
WWDG_IRQHandler
|
|
||||||
B WWDG_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK PVD_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
PVD_IRQHandler
|
|
||||||
B PVD_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK TAMPER_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
TAMPER_IRQHandler
|
|
||||||
B TAMPER_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK RTC_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
RTC_IRQHandler
|
|
||||||
B RTC_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK FLASH_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
FLASH_IRQHandler
|
|
||||||
B FLASH_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK RCC_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
RCC_IRQHandler
|
|
||||||
B RCC_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK EXTI0_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
EXTI0_IRQHandler
|
|
||||||
B EXTI0_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK EXTI1_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
EXTI1_IRQHandler
|
|
||||||
B EXTI1_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK EXTI2_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
EXTI2_IRQHandler
|
|
||||||
B EXTI2_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK EXTI3_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
EXTI3_IRQHandler
|
|
||||||
B EXTI3_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK EXTI4_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
EXTI4_IRQHandler
|
|
||||||
B EXTI4_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK DMA1_Channel1_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
DMA1_Channel1_IRQHandler
|
|
||||||
B DMA1_Channel1_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK DMA1_Channel2_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
DMA1_Channel2_IRQHandler
|
|
||||||
B DMA1_Channel2_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK DMA1_Channel3_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
DMA1_Channel3_IRQHandler
|
|
||||||
B DMA1_Channel3_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK DMA1_Channel4_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
DMA1_Channel4_IRQHandler
|
|
||||||
B DMA1_Channel4_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK DMA1_Channel5_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
DMA1_Channel5_IRQHandler
|
|
||||||
B DMA1_Channel5_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK DMA1_Channel6_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
DMA1_Channel6_IRQHandler
|
|
||||||
B DMA1_Channel6_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK DMA1_Channel7_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
DMA1_Channel7_IRQHandler
|
|
||||||
B DMA1_Channel7_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK ADC1_2_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
ADC1_2_IRQHandler
|
|
||||||
B ADC1_2_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK USB_HP_CAN1_TX_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
USB_HP_CAN1_TX_IRQHandler
|
|
||||||
B USB_HP_CAN1_TX_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK USB_LP_CAN1_RX0_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
USB_LP_CAN1_RX0_IRQHandler
|
|
||||||
B USB_LP_CAN1_RX0_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK CAN1_RX1_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
CAN1_RX1_IRQHandler
|
|
||||||
B CAN1_RX1_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK CAN1_SCE_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
CAN1_SCE_IRQHandler
|
|
||||||
B CAN1_SCE_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK EXTI9_5_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
EXTI9_5_IRQHandler
|
|
||||||
B EXTI9_5_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK TIM1_BRK_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
TIM1_BRK_IRQHandler
|
|
||||||
B TIM1_BRK_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK TIM1_UP_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
TIM1_UP_IRQHandler
|
|
||||||
B TIM1_UP_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK TIM1_TRG_COM_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
TIM1_TRG_COM_IRQHandler
|
|
||||||
B TIM1_TRG_COM_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK TIM1_CC_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
TIM1_CC_IRQHandler
|
|
||||||
B TIM1_CC_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK TIM2_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
TIM2_IRQHandler
|
|
||||||
B TIM2_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK TIM3_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
TIM3_IRQHandler
|
|
||||||
B TIM3_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK TIM4_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
TIM4_IRQHandler
|
|
||||||
B TIM4_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK I2C1_EV_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
I2C1_EV_IRQHandler
|
|
||||||
B I2C1_EV_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK I2C1_ER_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
I2C1_ER_IRQHandler
|
|
||||||
B I2C1_ER_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK I2C2_EV_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
I2C2_EV_IRQHandler
|
|
||||||
B I2C2_EV_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK I2C2_ER_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
I2C2_ER_IRQHandler
|
|
||||||
B I2C2_ER_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK SPI1_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
SPI1_IRQHandler
|
|
||||||
B SPI1_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK SPI2_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
SPI2_IRQHandler
|
|
||||||
B SPI2_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK USART1_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
USART1_IRQHandler
|
|
||||||
B USART1_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK USART2_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
USART2_IRQHandler
|
|
||||||
B USART2_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK USART3_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
USART3_IRQHandler
|
|
||||||
B USART3_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK EXTI15_10_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
EXTI15_10_IRQHandler
|
|
||||||
B EXTI15_10_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK RTC_Alarm_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
RTC_Alarm_IRQHandler
|
|
||||||
B RTC_Alarm_IRQHandler
|
|
||||||
|
|
||||||
PUBWEAK USBWakeUp_IRQHandler
|
|
||||||
SECTION .text:CODE:REORDER:NOROOT(1)
|
|
||||||
USBWakeUp_IRQHandler
|
|
||||||
B USBWakeUp_IRQHandler
|
|
||||||
|
|
||||||
END
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
|
||||||
/*-Editor annotation file-*/
|
|
||||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
|
|
||||||
/*-Specials-*/
|
|
||||||
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
|
|
||||||
/*-Memory Regions-*/
|
|
||||||
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000 ;
|
|
||||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF;
|
|
||||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
|
||||||
define symbol __ICFEDIT_region_RAM_end__ = 0x20004FFF;
|
|
||||||
/*-Sizes-*/
|
|
||||||
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
|
||||||
define symbol __ICFEDIT_size_heap__ = 0x200;
|
|
||||||
/**** End of ICF editor section. ###ICF###*/
|
|
||||||
|
|
||||||
|
|
||||||
define memory mem with size = 4G;
|
|
||||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
|
||||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
|
||||||
|
|
||||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
|
||||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
|
||||||
|
|
||||||
initialize by copy { readwrite };
|
|
||||||
do not initialize { section .noinit };
|
|
||||||
|
|
||||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
|
||||||
|
|
||||||
place in ROM_region { readonly };
|
|
||||||
place in RAM_region { readwrite,
|
|
||||||
block CSTACK, block HEAP };
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
|
||||||
/*-Editor annotation file-*/
|
|
||||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
|
|
||||||
/*-Specials-*/
|
|
||||||
define symbol __ICFEDIT_intvec_start__ = 0x20000000;
|
|
||||||
/*-Memory Regions-*/
|
|
||||||
define symbol __ICFEDIT_region_ROM_start__ = 0x20000000 ;
|
|
||||||
define symbol __ICFEDIT_region_ROM_end__ = 0x200013FF;
|
|
||||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20001400;
|
|
||||||
define symbol __ICFEDIT_region_RAM_end__ = 0x20004FFF;
|
|
||||||
/*-Sizes-*/
|
|
||||||
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
|
||||||
define symbol __ICFEDIT_size_heap__ = 0x200;
|
|
||||||
/**** End of ICF editor section. ###ICF###*/
|
|
||||||
|
|
||||||
|
|
||||||
define memory mem with size = 4G;
|
|
||||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
|
||||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
|
||||||
|
|
||||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
|
||||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
|
||||||
|
|
||||||
initialize by copy { readwrite };
|
|
||||||
do not initialize { section .noinit };
|
|
||||||
|
|
||||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
|
||||||
|
|
||||||
place in ROM_region { readonly };
|
|
||||||
place in RAM_region { readwrite,
|
|
||||||
block CSTACK, block HEAP };
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
/* USER CODE BEGIN Header */
|
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file : usb_device.c
|
|
||||||
* @version : v2.0_Cube
|
|
||||||
* @brief : This file implements the USB Device
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 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 "usb_device.h"
|
|
||||||
#include "usbd_core.h"
|
|
||||||
#include "usbd_desc.h"
|
|
||||||
#include "usbd_cdc.h"
|
|
||||||
#include "usbd_cdc_if.h"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Includes */
|
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* USER CODE END PV */
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PFP */
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
|
||||||
|
|
||||||
/* USER CODE END PFP */
|
|
||||||
|
|
||||||
/* USB Device Core handle declaration. */
|
|
||||||
USBD_HandleTypeDef hUsbDeviceFS;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* -- Insert your variables declaration here --
|
|
||||||
*/
|
|
||||||
/* USER CODE BEGIN 0 */
|
|
||||||
|
|
||||||
/* USER CODE END 0 */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* -- Insert your external function declaration here --
|
|
||||||
*/
|
|
||||||
/* USER CODE BEGIN 1 */
|
|
||||||
|
|
||||||
/* USER CODE END 1 */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Init USB device Library, add supported class and start the library
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void MX_USB_DEVICE_Init(void)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN USB_DEVICE_Init_PreTreatment */
|
|
||||||
|
|
||||||
/* USER CODE END USB_DEVICE_Init_PreTreatment */
|
|
||||||
|
|
||||||
/* Init Device Library, add supported class and start the library. */
|
|
||||||
if (USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS) != USBD_OK)
|
|
||||||
{
|
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
if (USBD_RegisterClass(&hUsbDeviceFS, &USBD_CDC) != USBD_OK)
|
|
||||||
{
|
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
if (USBD_CDC_RegisterInterface(&hUsbDeviceFS, &USBD_Interface_fops_FS) != USBD_OK)
|
|
||||||
{
|
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
if (USBD_Start(&hUsbDeviceFS) != USBD_OK)
|
|
||||||
{
|
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* USER CODE BEGIN USB_DEVICE_Init_PostTreatment */
|
|
||||||
|
|
||||||
/* USER CODE END USB_DEVICE_Init_PostTreatment */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
/* USER CODE BEGIN Header */
|
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file : usb_device.h
|
|
||||||
* @version : v2.0_Cube
|
|
||||||
* @brief : Header for usb_device.c file.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 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 */
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __USB_DEVICE__H__
|
|
||||||
#define __USB_DEVICE__H__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32f1xx.h"
|
|
||||||
#include "stm32f1xx_hal.h"
|
|
||||||
#include "usbd_def.h"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN INCLUDE */
|
|
||||||
|
|
||||||
/* USER CODE END INCLUDE */
|
|
||||||
|
|
||||||
/** @addtogroup USBD_OTG_DRIVER
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DEVICE USBD_DEVICE
|
|
||||||
* @brief Device file for Usb otg low level driver.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DEVICE_Exported_Variables USBD_DEVICE_Exported_Variables
|
|
||||||
* @brief Public variables.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/* USER CODE BEGIN PV */
|
|
||||||
|
|
||||||
/* USER CODE END PV */
|
|
||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
|
||||||
/* USER CODE BEGIN PFP */
|
|
||||||
|
|
||||||
/* USER CODE END PFP */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* -- Insert your variables declaration here --
|
|
||||||
*/
|
|
||||||
/* USER CODE BEGIN VARIABLES */
|
|
||||||
|
|
||||||
/* USER CODE END VARIABLES */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DEVICE_Exported_FunctionsPrototype USBD_DEVICE_Exported_FunctionsPrototype
|
|
||||||
* @brief Declaration of public functions for Usb device.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** USB Device initialization function. */
|
|
||||||
void MX_USB_DEVICE_Init(void);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* -- Insert functions declaration here --
|
|
||||||
*/
|
|
||||||
/* USER CODE BEGIN FD */
|
|
||||||
|
|
||||||
/* USER CODE END FD */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __USB_DEVICE__H__ */
|
|
||||||
@@ -1,303 +0,0 @@
|
|||||||
/* USER CODE BEGIN Header */
|
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file : usbd_cdc_if.c
|
|
||||||
* @version : v2.0_Cube
|
|
||||||
* @brief : Usb device for Virtual Com Port.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 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 "usbd_cdc_if.h"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN INCLUDE */
|
|
||||||
|
|
||||||
/* USER CODE END INCLUDE */
|
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
|
||||||
/* Private define ------------------------------------------------------------*/
|
|
||||||
/* Private macro -------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* USER CODE END PV */
|
|
||||||
|
|
||||||
/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
|
|
||||||
* @brief Usb device library.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup USBD_CDC_IF
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_IF_Private_TypesDefinitions USBD_CDC_IF_Private_TypesDefinitions
|
|
||||||
* @brief Private types.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PRIVATE_TYPES */
|
|
||||||
|
|
||||||
/* USER CODE END PRIVATE_TYPES */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_IF_Private_Defines USBD_CDC_IF_Private_Defines
|
|
||||||
* @brief Private defines.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
|
||||||
/* USER CODE END PRIVATE_DEFINES */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_IF_Private_Macros USBD_CDC_IF_Private_Macros
|
|
||||||
* @brief Private macros.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PRIVATE_MACRO */
|
|
||||||
|
|
||||||
/* USER CODE END PRIVATE_MACRO */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_IF_Private_Variables USBD_CDC_IF_Private_Variables
|
|
||||||
* @brief Private variables.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Create buffer for reception and transmission */
|
|
||||||
/* It's up to user to redefine and/or remove those define */
|
|
||||||
/** Received data over USB are stored in this buffer */
|
|
||||||
uint8_t UserRxBufferFS[APP_RX_DATA_SIZE];
|
|
||||||
|
|
||||||
/** Data to send over USB CDC are stored in this buffer */
|
|
||||||
uint8_t UserTxBufferFS[APP_TX_DATA_SIZE];
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PRIVATE_VARIABLES */
|
|
||||||
|
|
||||||
/* USER CODE END PRIVATE_VARIABLES */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_IF_Exported_Variables USBD_CDC_IF_Exported_Variables
|
|
||||||
* @brief Public variables.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern USBD_HandleTypeDef hUsbDeviceFS;
|
|
||||||
|
|
||||||
/* USER CODE BEGIN EXPORTED_VARIABLES */
|
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_VARIABLES */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_IF_Private_FunctionPrototypes USBD_CDC_IF_Private_FunctionPrototypes
|
|
||||||
* @brief Private functions declaration.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int8_t CDC_Init_FS(void);
|
|
||||||
static int8_t CDC_DeInit_FS(void);
|
|
||||||
static int8_t CDC_Control_FS(uint8_t cmd, uint8_t* pbuf, uint16_t length);
|
|
||||||
static int8_t CDC_Receive_FS(uint8_t* pbuf, uint32_t *Len);
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PRIVATE_FUNCTIONS_DECLARATION */
|
|
||||||
|
|
||||||
/* USER CODE END PRIVATE_FUNCTIONS_DECLARATION */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
USBD_CDC_ItfTypeDef USBD_Interface_fops_FS =
|
|
||||||
{
|
|
||||||
CDC_Init_FS,
|
|
||||||
CDC_DeInit_FS,
|
|
||||||
CDC_Control_FS,
|
|
||||||
CDC_Receive_FS
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Private functions ---------------------------------------------------------*/
|
|
||||||
/**
|
|
||||||
* @brief Initializes the CDC media low layer over the FS USB IP
|
|
||||||
* @retval USBD_OK if all operations are OK else USBD_FAIL
|
|
||||||
*/
|
|
||||||
static int8_t CDC_Init_FS(void)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN 3 */
|
|
||||||
/* Set Application Buffers */
|
|
||||||
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, UserTxBufferFS, 0);
|
|
||||||
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, UserRxBufferFS);
|
|
||||||
return (USBD_OK);
|
|
||||||
/* USER CODE END 3 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief DeInitializes the CDC media low layer
|
|
||||||
* @retval USBD_OK if all operations are OK else USBD_FAIL
|
|
||||||
*/
|
|
||||||
static int8_t CDC_DeInit_FS(void)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN 4 */
|
|
||||||
return (USBD_OK);
|
|
||||||
/* USER CODE END 4 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Manage the CDC class requests
|
|
||||||
* @param cmd: Command code
|
|
||||||
* @param pbuf: Buffer containing command data (request parameters)
|
|
||||||
* @param length: Number of data to be sent (in bytes)
|
|
||||||
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
|
|
||||||
*/
|
|
||||||
static int8_t CDC_Control_FS(uint8_t cmd, uint8_t* pbuf, uint16_t length)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN 5 */
|
|
||||||
switch(cmd)
|
|
||||||
{
|
|
||||||
case CDC_SEND_ENCAPSULATED_COMMAND:
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CDC_GET_ENCAPSULATED_RESPONSE:
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CDC_SET_COMM_FEATURE:
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CDC_GET_COMM_FEATURE:
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CDC_CLEAR_COMM_FEATURE:
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
/*******************************************************************************/
|
|
||||||
/* Line Coding Structure */
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/* Offset | Field | Size | Value | Description */
|
|
||||||
/* 0 | dwDTERate | 4 | Number |Data terminal rate, in bits per second*/
|
|
||||||
/* 4 | bCharFormat | 1 | Number | Stop bits */
|
|
||||||
/* 0 - 1 Stop bit */
|
|
||||||
/* 1 - 1.5 Stop bits */
|
|
||||||
/* 2 - 2 Stop bits */
|
|
||||||
/* 5 | bParityType | 1 | Number | Parity */
|
|
||||||
/* 0 - None */
|
|
||||||
/* 1 - Odd */
|
|
||||||
/* 2 - Even */
|
|
||||||
/* 3 - Mark */
|
|
||||||
/* 4 - Space */
|
|
||||||
/* 6 | bDataBits | 1 | Number Data bits (5, 6, 7, 8 or 16). */
|
|
||||||
/*******************************************************************************/
|
|
||||||
case CDC_SET_LINE_CODING:
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CDC_GET_LINE_CODING:
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CDC_SET_CONTROL_LINE_STATE:
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CDC_SEND_BREAK:
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (USBD_OK);
|
|
||||||
/* USER CODE END 5 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Data received over USB OUT endpoint are sent over CDC interface
|
|
||||||
* through this function.
|
|
||||||
*
|
|
||||||
* @note
|
|
||||||
* This function will issue a NAK packet on any OUT packet received on
|
|
||||||
* USB endpoint until exiting this function. If you exit this function
|
|
||||||
* before transfer is complete on CDC interface (ie. using DMA controller)
|
|
||||||
* it will result in receiving more data while previous ones are still
|
|
||||||
* not sent.
|
|
||||||
*
|
|
||||||
* @param Buf: Buffer of data to be received
|
|
||||||
* @param Len: Number of data received (in bytes)
|
|
||||||
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
|
|
||||||
*/
|
|
||||||
static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN 6 */
|
|
||||||
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
|
|
||||||
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
|
|
||||||
return (USBD_OK);
|
|
||||||
/* USER CODE END 6 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief CDC_Transmit_FS
|
|
||||||
* Data to send over USB IN endpoint are sent over CDC interface
|
|
||||||
* through this function.
|
|
||||||
* @note
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param Buf: Buffer of data to be sent
|
|
||||||
* @param Len: Number of data to be sent (in bytes)
|
|
||||||
* @retval USBD_OK if all operations are OK else USBD_FAIL or USBD_BUSY
|
|
||||||
*/
|
|
||||||
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
|
|
||||||
{
|
|
||||||
uint8_t result = USBD_OK;
|
|
||||||
/* USER CODE BEGIN 7 */
|
|
||||||
USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData;
|
|
||||||
if (hcdc->TxState != 0){
|
|
||||||
return USBD_BUSY;
|
|
||||||
}
|
|
||||||
USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);
|
|
||||||
result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);
|
|
||||||
/* USER CODE END 7 */
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PRIVATE_FUNCTIONS_IMPLEMENTATION */
|
|
||||||
|
|
||||||
/* USER CODE END PRIVATE_FUNCTIONS_IMPLEMENTATION */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
/* USER CODE BEGIN Header */
|
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file : usbd_cdc_if.h
|
|
||||||
* @version : v2.0_Cube
|
|
||||||
* @brief : Header for usbd_cdc_if.c file.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 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 */
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __USBD_CDC_IF_H__
|
|
||||||
#define __USBD_CDC_IF_H__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "usbd_cdc.h"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN INCLUDE */
|
|
||||||
|
|
||||||
/* USER CODE END INCLUDE */
|
|
||||||
|
|
||||||
/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
|
|
||||||
* @brief For Usb device.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_IF USBD_CDC_IF
|
|
||||||
* @brief Usb VCP device module
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_IF_Exported_Defines USBD_CDC_IF_Exported_Defines
|
|
||||||
* @brief Defines.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Define size for the receive and transmit buffer over CDC */
|
|
||||||
#define APP_RX_DATA_SIZE 1024
|
|
||||||
#define APP_TX_DATA_SIZE 1024
|
|
||||||
/* USER CODE BEGIN EXPORTED_DEFINES */
|
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_DEFINES */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_IF_Exported_Types USBD_CDC_IF_Exported_Types
|
|
||||||
* @brief Types.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN EXPORTED_TYPES */
|
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_TYPES */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_IF_Exported_Macros USBD_CDC_IF_Exported_Macros
|
|
||||||
* @brief Aliases.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN EXPORTED_MACRO */
|
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_MACRO */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_IF_Exported_Variables USBD_CDC_IF_Exported_Variables
|
|
||||||
* @brief Public variables.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** CDC Interface callback. */
|
|
||||||
extern USBD_CDC_ItfTypeDef USBD_Interface_fops_FS;
|
|
||||||
|
|
||||||
/* USER CODE BEGIN EXPORTED_VARIABLES */
|
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_VARIABLES */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CDC_IF_Exported_FunctionsPrototype USBD_CDC_IF_Exported_FunctionsPrototype
|
|
||||||
* @brief Public functions declaration.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len);
|
|
||||||
|
|
||||||
/* USER CODE BEGIN EXPORTED_FUNCTIONS */
|
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_FUNCTIONS */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __USBD_CDC_IF_H__ */
|
|
||||||
|
|
||||||
@@ -1,394 +0,0 @@
|
|||||||
/* USER CODE BEGIN Header */
|
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file : App/usbd_desc.c
|
|
||||||
* @version : v2.0_Cube
|
|
||||||
* @brief : This file implements the USB device descriptors.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 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 "usbd_core.h"
|
|
||||||
#include "usbd_desc.h"
|
|
||||||
#include "usbd_conf.h"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN INCLUDE */
|
|
||||||
|
|
||||||
/* USER CODE END INCLUDE */
|
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
|
||||||
/* Private define ------------------------------------------------------------*/
|
|
||||||
/* Private macro -------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* USER CODE END PV */
|
|
||||||
|
|
||||||
/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup USBD_DESC
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Private_TypesDefinitions USBD_DESC_Private_TypesDefinitions
|
|
||||||
* @brief Private types.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PRIVATE_TYPES */
|
|
||||||
|
|
||||||
/* USER CODE END PRIVATE_TYPES */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Private_Defines USBD_DESC_Private_Defines
|
|
||||||
* @brief Private defines.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define USBD_VID 1155
|
|
||||||
#define USBD_LANGID_STRING 1033
|
|
||||||
#define USBD_MANUFACTURER_STRING "STMicroelectronics"
|
|
||||||
#define USBD_PID_FS 22336
|
|
||||||
#define USBD_PRODUCT_STRING_FS "Modular Keyboard - Main Board"
|
|
||||||
#define USBD_CONFIGURATION_STRING_FS "CDC Config"
|
|
||||||
#define USBD_INTERFACE_STRING_FS "CDC Interface"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PRIVATE_DEFINES */
|
|
||||||
|
|
||||||
/* USER CODE END PRIVATE_DEFINES */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN 0 */
|
|
||||||
|
|
||||||
/* USER CODE END 0 */
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Private_Macros USBD_DESC_Private_Macros
|
|
||||||
* @brief Private macros.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PRIVATE_MACRO */
|
|
||||||
|
|
||||||
/* USER CODE END PRIVATE_MACRO */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
|
||||||
* @brief Private functions declaration.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void Get_SerialNum(void);
|
|
||||||
static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
|
||||||
* @brief Private functions declaration for FS.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint8_t * USBD_FS_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
|
||||||
uint8_t * USBD_FS_LangIDStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
|
||||||
uint8_t * USBD_FS_ManufacturerStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
|
||||||
uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
|
||||||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
|
||||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
|
||||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Private_Variables USBD_DESC_Private_Variables
|
|
||||||
* @brief Private variables.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
USBD_DescriptorsTypeDef FS_Desc =
|
|
||||||
{
|
|
||||||
USBD_FS_DeviceDescriptor
|
|
||||||
, USBD_FS_LangIDStrDescriptor
|
|
||||||
, USBD_FS_ManufacturerStrDescriptor
|
|
||||||
, USBD_FS_ProductStrDescriptor
|
|
||||||
, USBD_FS_SerialStrDescriptor
|
|
||||||
, USBD_FS_ConfigStrDescriptor
|
|
||||||
, USBD_FS_InterfaceStrDescriptor
|
|
||||||
};
|
|
||||||
|
|
||||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
|
||||||
#pragma data_alignment=4
|
|
||||||
#endif /* defined ( __ICCARM__ ) */
|
|
||||||
/** USB standard device descriptor. */
|
|
||||||
__ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
|
||||||
{
|
|
||||||
0x12, /*bLength */
|
|
||||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
|
||||||
0x00, /*bcdUSB */
|
|
||||||
0x02,
|
|
||||||
0x02, /*bDeviceClass*/
|
|
||||||
0x02, /*bDeviceSubClass*/
|
|
||||||
0x00, /*bDeviceProtocol*/
|
|
||||||
USB_MAX_EP0_SIZE, /*bMaxPacketSize*/
|
|
||||||
LOBYTE(USBD_VID), /*idVendor*/
|
|
||||||
HIBYTE(USBD_VID), /*idVendor*/
|
|
||||||
LOBYTE(USBD_PID_FS), /*idProduct*/
|
|
||||||
HIBYTE(USBD_PID_FS), /*idProduct*/
|
|
||||||
0x00, /*bcdDevice rel. 2.00*/
|
|
||||||
0x02,
|
|
||||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
|
||||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
|
||||||
USBD_IDX_SERIAL_STR, /*Index of serial number string*/
|
|
||||||
USBD_MAX_NUM_CONFIGURATION /*bNumConfigurations*/
|
|
||||||
};
|
|
||||||
|
|
||||||
/* USB_DeviceDescriptor */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Private_Variables USBD_DESC_Private_Variables
|
|
||||||
* @brief Private variables.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
|
||||||
#pragma data_alignment=4
|
|
||||||
#endif /* defined ( __ICCARM__ ) */
|
|
||||||
|
|
||||||
/** USB lang identifier descriptor. */
|
|
||||||
__ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_LEN_LANGID_STR_DESC] __ALIGN_END =
|
|
||||||
{
|
|
||||||
USB_LEN_LANGID_STR_DESC,
|
|
||||||
USB_DESC_TYPE_STRING,
|
|
||||||
LOBYTE(USBD_LANGID_STRING),
|
|
||||||
HIBYTE(USBD_LANGID_STRING)
|
|
||||||
};
|
|
||||||
|
|
||||||
#if defined ( __ICCARM__ ) /* IAR Compiler */
|
|
||||||
#pragma data_alignment=4
|
|
||||||
#endif /* defined ( __ICCARM__ ) */
|
|
||||||
/* Internal string descriptor. */
|
|
||||||
__ALIGN_BEGIN uint8_t USBD_StrDesc[USBD_MAX_STR_DESC_SIZ] __ALIGN_END;
|
|
||||||
|
|
||||||
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
|
|
||||||
#pragma data_alignment=4
|
|
||||||
#endif
|
|
||||||
__ALIGN_BEGIN uint8_t USBD_StringSerial[USB_SIZ_STRING_SERIAL] __ALIGN_END = {
|
|
||||||
USB_SIZ_STRING_SERIAL,
|
|
||||||
USB_DESC_TYPE_STRING,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Private_Functions USBD_DESC_Private_Functions
|
|
||||||
* @brief Private functions.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the device descriptor
|
|
||||||
* @param speed : Current device speed
|
|
||||||
* @param length : Pointer to data length variable
|
|
||||||
* @retval Pointer to descriptor buffer
|
|
||||||
*/
|
|
||||||
uint8_t * USBD_FS_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|
||||||
{
|
|
||||||
UNUSED(speed);
|
|
||||||
*length = sizeof(USBD_FS_DeviceDesc);
|
|
||||||
return USBD_FS_DeviceDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the LangID string descriptor
|
|
||||||
* @param speed : Current device speed
|
|
||||||
* @param length : Pointer to data length variable
|
|
||||||
* @retval Pointer to descriptor buffer
|
|
||||||
*/
|
|
||||||
uint8_t * USBD_FS_LangIDStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|
||||||
{
|
|
||||||
UNUSED(speed);
|
|
||||||
*length = sizeof(USBD_LangIDDesc);
|
|
||||||
return USBD_LangIDDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the product string descriptor
|
|
||||||
* @param speed : Current device speed
|
|
||||||
* @param length : Pointer to data length variable
|
|
||||||
* @retval Pointer to descriptor buffer
|
|
||||||
*/
|
|
||||||
uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|
||||||
{
|
|
||||||
if(speed == 0)
|
|
||||||
{
|
|
||||||
USBD_GetString((uint8_t *)USBD_PRODUCT_STRING_FS, USBD_StrDesc, length);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
USBD_GetString((uint8_t *)USBD_PRODUCT_STRING_FS, USBD_StrDesc, length);
|
|
||||||
}
|
|
||||||
return USBD_StrDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the manufacturer string descriptor
|
|
||||||
* @param speed : Current device speed
|
|
||||||
* @param length : Pointer to data length variable
|
|
||||||
* @retval Pointer to descriptor buffer
|
|
||||||
*/
|
|
||||||
uint8_t * USBD_FS_ManufacturerStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|
||||||
{
|
|
||||||
UNUSED(speed);
|
|
||||||
USBD_GetString((uint8_t *)USBD_MANUFACTURER_STRING, USBD_StrDesc, length);
|
|
||||||
return USBD_StrDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the serial number string descriptor
|
|
||||||
* @param speed : Current device speed
|
|
||||||
* @param length : Pointer to data length variable
|
|
||||||
* @retval Pointer to descriptor buffer
|
|
||||||
*/
|
|
||||||
uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|
||||||
{
|
|
||||||
UNUSED(speed);
|
|
||||||
*length = USB_SIZ_STRING_SERIAL;
|
|
||||||
|
|
||||||
/* Update the serial number string descriptor with the data from the unique
|
|
||||||
* ID */
|
|
||||||
Get_SerialNum();
|
|
||||||
/* USER CODE BEGIN USBD_FS_SerialStrDescriptor */
|
|
||||||
|
|
||||||
/* USER CODE END USBD_FS_SerialStrDescriptor */
|
|
||||||
return (uint8_t *) USBD_StringSerial;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the configuration string descriptor
|
|
||||||
* @param speed : Current device speed
|
|
||||||
* @param length : Pointer to data length variable
|
|
||||||
* @retval Pointer to descriptor buffer
|
|
||||||
*/
|
|
||||||
uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|
||||||
{
|
|
||||||
if(speed == USBD_SPEED_HIGH)
|
|
||||||
{
|
|
||||||
USBD_GetString((uint8_t *)USBD_CONFIGURATION_STRING_FS, USBD_StrDesc, length);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
USBD_GetString((uint8_t *)USBD_CONFIGURATION_STRING_FS, USBD_StrDesc, length);
|
|
||||||
}
|
|
||||||
return USBD_StrDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the interface string descriptor
|
|
||||||
* @param speed : Current device speed
|
|
||||||
* @param length : Pointer to data length variable
|
|
||||||
* @retval Pointer to descriptor buffer
|
|
||||||
*/
|
|
||||||
uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|
||||||
{
|
|
||||||
if(speed == 0)
|
|
||||||
{
|
|
||||||
USBD_GetString((uint8_t *)USBD_INTERFACE_STRING_FS, USBD_StrDesc, length);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
USBD_GetString((uint8_t *)USBD_INTERFACE_STRING_FS, USBD_StrDesc, length);
|
|
||||||
}
|
|
||||||
return USBD_StrDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Create the serial number string descriptor
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
static void Get_SerialNum(void)
|
|
||||||
{
|
|
||||||
uint32_t deviceserial0;
|
|
||||||
uint32_t deviceserial1;
|
|
||||||
uint32_t deviceserial2;
|
|
||||||
|
|
||||||
deviceserial0 = *(uint32_t *) DEVICE_ID1;
|
|
||||||
deviceserial1 = *(uint32_t *) DEVICE_ID2;
|
|
||||||
deviceserial2 = *(uint32_t *) DEVICE_ID3;
|
|
||||||
|
|
||||||
deviceserial0 += deviceserial2;
|
|
||||||
|
|
||||||
if (deviceserial0 != 0)
|
|
||||||
{
|
|
||||||
IntToUnicode(deviceserial0, &USBD_StringSerial[2], 8);
|
|
||||||
IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Convert Hex 32Bits value into char
|
|
||||||
* @param value: value to convert
|
|
||||||
* @param pbuf: pointer to the buffer
|
|
||||||
* @param len: buffer length
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len)
|
|
||||||
{
|
|
||||||
uint8_t idx = 0;
|
|
||||||
|
|
||||||
for (idx = 0; idx < len; idx++)
|
|
||||||
{
|
|
||||||
if (((value >> 28)) < 0xA)
|
|
||||||
{
|
|
||||||
pbuf[2 * idx] = (value >> 28) + '0';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pbuf[2 * idx] = (value >> 28) + 'A' - 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
value = value << 4;
|
|
||||||
|
|
||||||
pbuf[2 * idx + 1] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@@ -1,143 +0,0 @@
|
|||||||
/* USER CODE BEGIN Header */
|
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file : usbd_desc.c
|
|
||||||
* @version : v2.0_Cube
|
|
||||||
* @brief : Header for usbd_conf.c file.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 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 */
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __USBD_DESC__C__
|
|
||||||
#define __USBD_DESC__C__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "usbd_def.h"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN INCLUDE */
|
|
||||||
|
|
||||||
/* USER CODE END INCLUDE */
|
|
||||||
|
|
||||||
/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC USBD_DESC
|
|
||||||
* @brief Usb device descriptors module.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Exported_Constants USBD_DESC_Exported_Constants
|
|
||||||
* @brief Constants.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define DEVICE_ID1 (UID_BASE)
|
|
||||||
#define DEVICE_ID2 (UID_BASE + 0x4)
|
|
||||||
#define DEVICE_ID3 (UID_BASE + 0x8)
|
|
||||||
|
|
||||||
#define USB_SIZ_STRING_SERIAL 0x1A
|
|
||||||
|
|
||||||
/* USER CODE BEGIN EXPORTED_CONSTANTS */
|
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_CONSTANTS */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Exported_Defines USBD_DESC_Exported_Defines
|
|
||||||
* @brief Defines.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN EXPORTED_DEFINES */
|
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_DEFINES */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Exported_TypesDefinitions USBD_DESC_Exported_TypesDefinitions
|
|
||||||
* @brief Types.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN EXPORTED_TYPES */
|
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_TYPES */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Exported_Macros USBD_DESC_Exported_Macros
|
|
||||||
* @brief Aliases.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN EXPORTED_MACRO */
|
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_MACRO */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Exported_Variables USBD_DESC_Exported_Variables
|
|
||||||
* @brief Public variables.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Descriptor for the Usb device. */
|
|
||||||
extern USBD_DescriptorsTypeDef FS_Desc;
|
|
||||||
|
|
||||||
/* USER CODE BEGIN EXPORTED_VARIABLES */
|
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_VARIABLES */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_DESC_Exported_FunctionsPrototype USBD_DESC_Exported_FunctionsPrototype
|
|
||||||
* @brief Public functions declaration.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN EXPORTED_FUNCTIONS */
|
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_FUNCTIONS */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __USBD_DESC__C__ */
|
|
||||||
|
|
||||||
@@ -1,666 +0,0 @@
|
|||||||
/* USER CODE BEGIN Header */
|
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file : Target/usbd_conf.c
|
|
||||||
* @version : v2.0_Cube
|
|
||||||
* @brief : This file implements the board support package for the USB device library
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 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 "stm32f1xx.h"
|
|
||||||
#include "stm32f1xx_hal.h"
|
|
||||||
#include "usbd_def.h"
|
|
||||||
#include "usbd_core.h"
|
|
||||||
#include "usbd_cdc.h"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Includes */
|
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
|
||||||
/* Private define ------------------------------------------------------------*/
|
|
||||||
/* Private macro -------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* USER CODE END PV */
|
|
||||||
|
|
||||||
PCD_HandleTypeDef hpcd_USB_FS;
|
|
||||||
void Error_Handler(void);
|
|
||||||
|
|
||||||
/* USER CODE BEGIN 0 */
|
|
||||||
|
|
||||||
/* USER CODE END 0 */
|
|
||||||
|
|
||||||
/* USER CODE BEGIN PFP */
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
|
||||||
|
|
||||||
/* USER CODE END PFP */
|
|
||||||
|
|
||||||
/* Private functions ---------------------------------------------------------*/
|
|
||||||
static USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status);
|
|
||||||
/* USER CODE BEGIN 1 */
|
|
||||||
|
|
||||||
/* USER CODE END 1 */
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
static void PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
|
||||||
#else
|
|
||||||
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
LL Driver Callbacks (PCD -> USB Device Library)
|
|
||||||
*******************************************************************************/
|
|
||||||
/* MSP Init */
|
|
||||||
|
|
||||||
void HAL_PCD_MspInit(PCD_HandleTypeDef* pcdHandle)
|
|
||||||
{
|
|
||||||
if(pcdHandle->Instance==USB)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN USB_MspInit 0 */
|
|
||||||
|
|
||||||
/* USER CODE END USB_MspInit 0 */
|
|
||||||
/* Peripheral clock enable */
|
|
||||||
__HAL_RCC_USB_CLK_ENABLE();
|
|
||||||
|
|
||||||
/* Peripheral interrupt init */
|
|
||||||
HAL_NVIC_SetPriority(USB_LP_CAN1_RX0_IRQn, 0, 0);
|
|
||||||
HAL_NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn);
|
|
||||||
/* USER CODE BEGIN USB_MspInit 1 */
|
|
||||||
|
|
||||||
/* USER CODE END USB_MspInit 1 */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HAL_PCD_MspDeInit(PCD_HandleTypeDef* pcdHandle)
|
|
||||||
{
|
|
||||||
if(pcdHandle->Instance==USB)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN USB_MspDeInit 0 */
|
|
||||||
|
|
||||||
/* USER CODE END USB_MspDeInit 0 */
|
|
||||||
/* Peripheral clock disable */
|
|
||||||
__HAL_RCC_USB_CLK_DISABLE();
|
|
||||||
|
|
||||||
/* Peripheral interrupt Deinit*/
|
|
||||||
/* USER CODE BEGIN USB:USB_LP_CAN1_RX0_IRQn disable */
|
|
||||||
/**
|
|
||||||
* Uncomment the line below to disable the "USB_LP_CAN1_RX0_IRQn" interrupt
|
|
||||||
* Be aware, disabling shared interrupt may affect other IPs
|
|
||||||
*/
|
|
||||||
/* HAL_NVIC_DisableIRQ(USB_LP_CAN1_RX0_IRQn); */
|
|
||||||
/* USER CODE END USB:USB_LP_CAN1_RX0_IRQn disable */
|
|
||||||
|
|
||||||
/* USER CODE BEGIN USB_MspDeInit 1 */
|
|
||||||
|
|
||||||
/* USER CODE END USB_MspDeInit 1 */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Setup stage callback
|
|
||||||
* @param hpcd: PCD handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
static void PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#else
|
|
||||||
void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
{
|
|
||||||
USBD_LL_SetupStage((USBD_HandleTypeDef*)hpcd->pData, (uint8_t *)hpcd->Setup);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Data Out stage callback.
|
|
||||||
* @param hpcd: PCD handle
|
|
||||||
* @param epnum: Endpoint number
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
static void PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
|
|
||||||
#else
|
|
||||||
void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
{
|
|
||||||
USBD_LL_DataOutStage((USBD_HandleTypeDef*)hpcd->pData, epnum, hpcd->OUT_ep[epnum].xfer_buff);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Data In stage callback.
|
|
||||||
* @param hpcd: PCD handle
|
|
||||||
* @param epnum: Endpoint number
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
static void PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
|
|
||||||
#else
|
|
||||||
void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
{
|
|
||||||
USBD_LL_DataInStage((USBD_HandleTypeDef*)hpcd->pData, epnum, hpcd->IN_ep[epnum].xfer_buff);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SOF callback.
|
|
||||||
* @param hpcd: PCD handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
static void PCD_SOFCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#else
|
|
||||||
void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
{
|
|
||||||
USBD_LL_SOF((USBD_HandleTypeDef*)hpcd->pData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reset callback.
|
|
||||||
* @param hpcd: PCD handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
static void PCD_ResetCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#else
|
|
||||||
void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
{
|
|
||||||
USBD_SpeedTypeDef speed = USBD_SPEED_FULL;
|
|
||||||
|
|
||||||
if ( hpcd->Init.speed != PCD_SPEED_FULL)
|
|
||||||
{
|
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
/* Set Speed. */
|
|
||||||
USBD_LL_SetSpeed((USBD_HandleTypeDef*)hpcd->pData, speed);
|
|
||||||
|
|
||||||
/* Reset Device. */
|
|
||||||
USBD_LL_Reset((USBD_HandleTypeDef*)hpcd->pData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Suspend callback.
|
|
||||||
* When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it)
|
|
||||||
* @param hpcd: PCD handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
static void PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#else
|
|
||||||
void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
{
|
|
||||||
/* Inform USB library that core enters in suspend Mode. */
|
|
||||||
USBD_LL_Suspend((USBD_HandleTypeDef*)hpcd->pData);
|
|
||||||
/* Enter in STOP mode. */
|
|
||||||
/* USER CODE BEGIN 2 */
|
|
||||||
if (hpcd->Init.low_power_enable)
|
|
||||||
{
|
|
||||||
/* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register. */
|
|
||||||
SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
|
|
||||||
}
|
|
||||||
/* USER CODE END 2 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Resume callback.
|
|
||||||
* When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it)
|
|
||||||
* @param hpcd: PCD handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
static void PCD_ResumeCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#else
|
|
||||||
void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN 3 */
|
|
||||||
|
|
||||||
/* USER CODE END 3 */
|
|
||||||
USBD_LL_Resume((USBD_HandleTypeDef*)hpcd->pData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ISOOUTIncomplete callback.
|
|
||||||
* @param hpcd: PCD handle
|
|
||||||
* @param epnum: Endpoint number
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
static void PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
|
|
||||||
#else
|
|
||||||
void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
{
|
|
||||||
USBD_LL_IsoOUTIncomplete((USBD_HandleTypeDef*)hpcd->pData, epnum);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ISOINIncomplete callback.
|
|
||||||
* @param hpcd: PCD handle
|
|
||||||
* @param epnum: Endpoint number
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
static void PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
|
|
||||||
#else
|
|
||||||
void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
{
|
|
||||||
USBD_LL_IsoINIncomplete((USBD_HandleTypeDef*)hpcd->pData, epnum);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Connect callback.
|
|
||||||
* @param hpcd: PCD handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
static void PCD_ConnectCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#else
|
|
||||||
void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
{
|
|
||||||
USBD_LL_DevConnected((USBD_HandleTypeDef*)hpcd->pData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disconnect callback.
|
|
||||||
* @param hpcd: PCD handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
static void PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#else
|
|
||||||
void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd)
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
{
|
|
||||||
USBD_LL_DevDisconnected((USBD_HandleTypeDef*)hpcd->pData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
LL Driver Interface (USB Device Library --> PCD)
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initializes the low level portion of the device driver.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @retval USBD status
|
|
||||||
*/
|
|
||||||
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
|
|
||||||
{
|
|
||||||
/* Init USB Ip. */
|
|
||||||
/* Link the driver to the stack. */
|
|
||||||
hpcd_USB_FS.pData = pdev;
|
|
||||||
pdev->pData = &hpcd_USB_FS;
|
|
||||||
|
|
||||||
hpcd_USB_FS.Instance = USB;
|
|
||||||
hpcd_USB_FS.Init.dev_endpoints = 8;
|
|
||||||
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;
|
|
||||||
hpcd_USB_FS.Init.low_power_enable = DISABLE;
|
|
||||||
hpcd_USB_FS.Init.lpm_enable = DISABLE;
|
|
||||||
hpcd_USB_FS.Init.battery_charging_enable = DISABLE;
|
|
||||||
if (HAL_PCD_Init(&hpcd_USB_FS) != HAL_OK)
|
|
||||||
{
|
|
||||||
Error_Handler( );
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
/* Register USB PCD CallBacks */
|
|
||||||
HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_SOF_CB_ID, PCD_SOFCallback);
|
|
||||||
HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_SETUPSTAGE_CB_ID, PCD_SetupStageCallback);
|
|
||||||
HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_RESET_CB_ID, PCD_ResetCallback);
|
|
||||||
HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_SUSPEND_CB_ID, PCD_SuspendCallback);
|
|
||||||
HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_RESUME_CB_ID, PCD_ResumeCallback);
|
|
||||||
HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_CONNECT_CB_ID, PCD_ConnectCallback);
|
|
||||||
HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_DISCONNECT_CB_ID, PCD_DisconnectCallback);
|
|
||||||
|
|
||||||
HAL_PCD_RegisterDataOutStageCallback(&hpcd_USB_FS, PCD_DataOutStageCallback);
|
|
||||||
HAL_PCD_RegisterDataInStageCallback(&hpcd_USB_FS, PCD_DataInStageCallback);
|
|
||||||
HAL_PCD_RegisterIsoOutIncpltCallback(&hpcd_USB_FS, PCD_ISOOUTIncompleteCallback);
|
|
||||||
HAL_PCD_RegisterIsoInIncpltCallback(&hpcd_USB_FS, PCD_ISOINIncompleteCallback);
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
/* USER CODE BEGIN EndPoint_Configuration */
|
|
||||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x00 , PCD_SNG_BUF, 0x18);
|
|
||||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x80 , PCD_SNG_BUF, 0x58);
|
|
||||||
/* USER CODE END EndPoint_Configuration */
|
|
||||||
/* USER CODE BEGIN EndPoint_Configuration_CDC */
|
|
||||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x81 , PCD_SNG_BUF, 0xC0);
|
|
||||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x01 , PCD_SNG_BUF, 0x110);
|
|
||||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x82 , PCD_SNG_BUF, 0x100);
|
|
||||||
/* USER CODE END EndPoint_Configuration_CDC */
|
|
||||||
return USBD_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief De-Initializes the low level portion of the device driver.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @retval USBD status
|
|
||||||
*/
|
|
||||||
USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev)
|
|
||||||
{
|
|
||||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
|
||||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
|
||||||
|
|
||||||
hal_status = HAL_PCD_DeInit(pdev->pData);
|
|
||||||
|
|
||||||
usb_status = USBD_Get_USB_Status(hal_status);
|
|
||||||
|
|
||||||
return usb_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Starts the low level portion of the device driver.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @retval USBD status
|
|
||||||
*/
|
|
||||||
USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev)
|
|
||||||
{
|
|
||||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
|
||||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
|
||||||
|
|
||||||
hal_status = HAL_PCD_Start(pdev->pData);
|
|
||||||
|
|
||||||
usb_status = USBD_Get_USB_Status(hal_status);
|
|
||||||
|
|
||||||
return usb_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Stops the low level portion of the device driver.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @retval USBD status
|
|
||||||
*/
|
|
||||||
USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev)
|
|
||||||
{
|
|
||||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
|
||||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
|
||||||
|
|
||||||
hal_status = HAL_PCD_Stop(pdev->pData);
|
|
||||||
|
|
||||||
usb_status = USBD_Get_USB_Status(hal_status);
|
|
||||||
|
|
||||||
return usb_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Opens an endpoint of the low level driver.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @param ep_addr: Endpoint number
|
|
||||||
* @param ep_type: Endpoint type
|
|
||||||
* @param ep_mps: Endpoint max packet size
|
|
||||||
* @retval USBD status
|
|
||||||
*/
|
|
||||||
USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t ep_type, uint16_t ep_mps)
|
|
||||||
{
|
|
||||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
|
||||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
|
||||||
|
|
||||||
hal_status = HAL_PCD_EP_Open(pdev->pData, ep_addr, ep_mps, ep_type);
|
|
||||||
|
|
||||||
usb_status = USBD_Get_USB_Status(hal_status);
|
|
||||||
|
|
||||||
return usb_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Closes an endpoint of the low level driver.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @param ep_addr: Endpoint number
|
|
||||||
* @retval USBD status
|
|
||||||
*/
|
|
||||||
USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
|
||||||
{
|
|
||||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
|
||||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
|
||||||
|
|
||||||
hal_status = HAL_PCD_EP_Close(pdev->pData, ep_addr);
|
|
||||||
|
|
||||||
usb_status = USBD_Get_USB_Status(hal_status);
|
|
||||||
|
|
||||||
return usb_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Flushes an endpoint of the Low Level Driver.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @param ep_addr: Endpoint number
|
|
||||||
* @retval USBD status
|
|
||||||
*/
|
|
||||||
USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
|
||||||
{
|
|
||||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
|
||||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
|
||||||
|
|
||||||
hal_status = HAL_PCD_EP_Flush(pdev->pData, ep_addr);
|
|
||||||
|
|
||||||
usb_status = USBD_Get_USB_Status(hal_status);
|
|
||||||
|
|
||||||
return usb_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Sets a Stall condition on an endpoint of the Low Level Driver.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @param ep_addr: Endpoint number
|
|
||||||
* @retval USBD status
|
|
||||||
*/
|
|
||||||
USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
|
||||||
{
|
|
||||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
|
||||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
|
||||||
|
|
||||||
hal_status = HAL_PCD_EP_SetStall(pdev->pData, ep_addr);
|
|
||||||
|
|
||||||
usb_status = USBD_Get_USB_Status(hal_status);
|
|
||||||
|
|
||||||
return usb_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clears a Stall condition on an endpoint of the Low Level Driver.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @param ep_addr: Endpoint number
|
|
||||||
* @retval USBD status
|
|
||||||
*/
|
|
||||||
USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
|
||||||
{
|
|
||||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
|
||||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
|
||||||
|
|
||||||
hal_status = HAL_PCD_EP_ClrStall(pdev->pData, ep_addr);
|
|
||||||
|
|
||||||
usb_status = USBD_Get_USB_Status(hal_status);
|
|
||||||
|
|
||||||
return usb_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns Stall condition.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @param ep_addr: Endpoint number
|
|
||||||
* @retval Stall (1: Yes, 0: No)
|
|
||||||
*/
|
|
||||||
uint8_t USBD_LL_IsStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
|
||||||
{
|
|
||||||
PCD_HandleTypeDef *hpcd = (PCD_HandleTypeDef*) pdev->pData;
|
|
||||||
|
|
||||||
if((ep_addr & 0x80) == 0x80)
|
|
||||||
{
|
|
||||||
return hpcd->IN_ep[ep_addr & 0x7F].is_stall;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return hpcd->OUT_ep[ep_addr & 0x7F].is_stall;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Assigns a USB address to the device.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @param dev_addr: Device address
|
|
||||||
* @retval USBD status
|
|
||||||
*/
|
|
||||||
USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_addr)
|
|
||||||
{
|
|
||||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
|
||||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
|
||||||
|
|
||||||
hal_status = HAL_PCD_SetAddress(pdev->pData, dev_addr);
|
|
||||||
|
|
||||||
usb_status = USBD_Get_USB_Status(hal_status);
|
|
||||||
|
|
||||||
return usb_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Transmits data over an endpoint.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @param ep_addr: Endpoint number
|
|
||||||
* @param pbuf: Pointer to data to be sent
|
|
||||||
* @param size: Data size
|
|
||||||
* @retval USBD status
|
|
||||||
*/
|
|
||||||
USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t *pbuf, uint16_t size)
|
|
||||||
{
|
|
||||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
|
||||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
|
||||||
|
|
||||||
hal_status = HAL_PCD_EP_Transmit(pdev->pData, ep_addr, pbuf, size);
|
|
||||||
|
|
||||||
usb_status = USBD_Get_USB_Status(hal_status);
|
|
||||||
|
|
||||||
return usb_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Prepares an endpoint for reception.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @param ep_addr: Endpoint number
|
|
||||||
* @param pbuf: Pointer to data to be received
|
|
||||||
* @param size: Data size
|
|
||||||
* @retval USBD status
|
|
||||||
*/
|
|
||||||
USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t *pbuf, uint16_t size)
|
|
||||||
{
|
|
||||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
|
||||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
|
||||||
|
|
||||||
hal_status = HAL_PCD_EP_Receive(pdev->pData, ep_addr, pbuf, size);
|
|
||||||
|
|
||||||
usb_status = USBD_Get_USB_Status(hal_status);
|
|
||||||
|
|
||||||
return usb_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the last transferred packet size.
|
|
||||||
* @param pdev: Device handle
|
|
||||||
* @param ep_addr: Endpoint number
|
|
||||||
* @retval Received Data Size
|
|
||||||
*/
|
|
||||||
uint32_t USBD_LL_GetRxDataSize(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
|
||||||
{
|
|
||||||
return HAL_PCD_EP_GetRxCount((PCD_HandleTypeDef*) pdev->pData, ep_addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Delays routine for the USB device library.
|
|
||||||
* @param Delay: Delay in ms
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void USBD_LL_Delay(uint32_t Delay)
|
|
||||||
{
|
|
||||||
HAL_Delay(Delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Static single allocation.
|
|
||||||
* @param size: Size of allocated memory
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void *USBD_static_malloc(uint32_t size)
|
|
||||||
{
|
|
||||||
static uint32_t mem[(sizeof(USBD_CDC_HandleTypeDef)/4)+1];/* On 32-bit boundary */
|
|
||||||
return mem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Dummy memory free
|
|
||||||
* @param p: Pointer to allocated memory address
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void USBD_static_free(void *p)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Software Device Connection
|
|
||||||
* @param hpcd: PCD handle
|
|
||||||
* @param state: Connection state (0: disconnected / 1: connected)
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
|
||||||
static void PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state)
|
|
||||||
#else
|
|
||||||
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state)
|
|
||||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN 6 */
|
|
||||||
if (state == 1)
|
|
||||||
{
|
|
||||||
/* Configure Low connection state. */
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Configure High connection state. */
|
|
||||||
|
|
||||||
}
|
|
||||||
/* USER CODE END 6 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the USB status depending on the HAL status:
|
|
||||||
* @param hal_status: HAL status
|
|
||||||
* @retval USB status
|
|
||||||
*/
|
|
||||||
USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status)
|
|
||||||
{
|
|
||||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
|
||||||
|
|
||||||
switch (hal_status)
|
|
||||||
{
|
|
||||||
case HAL_OK :
|
|
||||||
usb_status = USBD_OK;
|
|
||||||
break;
|
|
||||||
case HAL_ERROR :
|
|
||||||
usb_status = USBD_FAIL;
|
|
||||||
break;
|
|
||||||
case HAL_BUSY :
|
|
||||||
usb_status = USBD_BUSY;
|
|
||||||
break;
|
|
||||||
case HAL_TIMEOUT :
|
|
||||||
usb_status = USBD_FAIL;
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
usb_status = USBD_FAIL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return usb_status;
|
|
||||||
}
|
|
||||||
@@ -1,175 +0,0 @@
|
|||||||
/* USER CODE BEGIN Header */
|
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file : usbd_conf.h
|
|
||||||
* @version : v2.0_Cube
|
|
||||||
* @brief : Header for usbd_conf.c file.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 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 */
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __USBD_CONF__H__
|
|
||||||
#define __USBD_CONF__H__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "main.h"
|
|
||||||
#include "stm32f1xx.h"
|
|
||||||
#include "stm32f1xx_hal.h"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN INCLUDE */
|
|
||||||
|
|
||||||
/* USER CODE END INCLUDE */
|
|
||||||
|
|
||||||
/** @addtogroup USBD_OTG_DRIVER
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CONF USBD_CONF
|
|
||||||
* @brief Configuration file for Usb otg low level driver.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CONF_Exported_Variables USBD_CONF_Exported_Variables
|
|
||||||
* @brief Public variables.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CONF_Exported_Defines USBD_CONF_Exported_Defines
|
|
||||||
* @brief Defines for configuration of the Usb device.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*---------- -----------*/
|
|
||||||
#define USBD_MAX_NUM_INTERFACES 1
|
|
||||||
/*---------- -----------*/
|
|
||||||
#define USBD_MAX_NUM_CONFIGURATION 1
|
|
||||||
/*---------- -----------*/
|
|
||||||
#define USBD_MAX_STR_DESC_SIZ 512
|
|
||||||
/*---------- -----------*/
|
|
||||||
#define USBD_DEBUG_LEVEL 0
|
|
||||||
/*---------- -----------*/
|
|
||||||
#define USBD_SELF_POWERED 1
|
|
||||||
/*---------- -----------*/
|
|
||||||
#define MAX_STATIC_ALLOC_SIZE 512
|
|
||||||
|
|
||||||
/****************************************/
|
|
||||||
/* #define for FS and HS identification */
|
|
||||||
#define DEVICE_FS 0
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CONF_Exported_Macros USBD_CONF_Exported_Macros
|
|
||||||
* @brief Aliases.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Memory management macros */
|
|
||||||
|
|
||||||
/** Alias for memory allocation. */
|
|
||||||
#define USBD_malloc (uint32_t *)USBD_static_malloc
|
|
||||||
|
|
||||||
/** Alias for memory release. */
|
|
||||||
#define USBD_free USBD_static_free
|
|
||||||
|
|
||||||
/** Alias for memory set. */
|
|
||||||
#define USBD_memset /* Not used */
|
|
||||||
|
|
||||||
/** Alias for memory copy. */
|
|
||||||
#define USBD_memcpy /* Not used */
|
|
||||||
|
|
||||||
/** Alias for delay. */
|
|
||||||
#define USBD_Delay HAL_Delay
|
|
||||||
|
|
||||||
/* For footprint reasons and since only one allocation is handled in the HID class
|
|
||||||
driver, the malloc/free is changed into a static allocation method */
|
|
||||||
void *USBD_static_malloc(uint32_t size);
|
|
||||||
void USBD_static_free(void *p);
|
|
||||||
|
|
||||||
/* DEBUG macros */
|
|
||||||
|
|
||||||
#if (USBD_DEBUG_LEVEL > 0)
|
|
||||||
#define USBD_UsrLog(...) printf(__VA_ARGS__);\
|
|
||||||
printf("\n");
|
|
||||||
#else
|
|
||||||
#define USBD_UsrLog(...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (USBD_DEBUG_LEVEL > 1)
|
|
||||||
|
|
||||||
#define USBD_ErrLog(...) printf("ERROR: ") ;\
|
|
||||||
printf(__VA_ARGS__);\
|
|
||||||
printf("\n");
|
|
||||||
#else
|
|
||||||
#define USBD_ErrLog(...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (USBD_DEBUG_LEVEL > 2)
|
|
||||||
#define USBD_DbgLog(...) printf("DEBUG : ") ;\
|
|
||||||
printf(__VA_ARGS__);\
|
|
||||||
printf("\n");
|
|
||||||
#else
|
|
||||||
#define USBD_DbgLog(...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CONF_Exported_Types USBD_CONF_Exported_Types
|
|
||||||
* @brief Types.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup USBD_CONF_Exported_FunctionsPrototype USBD_CONF_Exported_FunctionsPrototype
|
|
||||||
* @brief Declaration of public functions for Usb device.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported functions -------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __USBD_CONF__H__ */
|
|
||||||
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
#MicroXplorer Configuration settings - do not modify
|
|
||||||
CAD.formats=
|
|
||||||
CAD.pinconfig=
|
|
||||||
CAD.provider=
|
|
||||||
CAN.CalculateBaudRate=533333
|
|
||||||
CAN.CalculateTimeBit=1875
|
|
||||||
CAN.CalculateTimeQuantum=625.0
|
|
||||||
CAN.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler
|
|
||||||
CAN.Prescaler=15
|
|
||||||
File.Version=6
|
|
||||||
GPIO.groupedBy=
|
|
||||||
KeepUserPlacement=false
|
|
||||||
Mcu.CPN=STM32F103C8T6
|
|
||||||
Mcu.Family=STM32F1
|
|
||||||
Mcu.IP0=CAN
|
|
||||||
Mcu.IP1=NVIC
|
|
||||||
Mcu.IP2=RCC
|
|
||||||
Mcu.IP3=SYS
|
|
||||||
Mcu.IP4=USB
|
|
||||||
Mcu.IP5=USB_DEVICE
|
|
||||||
Mcu.IPNb=6
|
|
||||||
Mcu.Name=STM32F103C(8-B)Tx
|
|
||||||
Mcu.Package=LQFP48
|
|
||||||
Mcu.Pin0=PC13-TAMPER-RTC
|
|
||||||
Mcu.Pin1=PD0-OSC_IN
|
|
||||||
Mcu.Pin10=VP_SYS_VS_Systick
|
|
||||||
Mcu.Pin11=VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS
|
|
||||||
Mcu.Pin2=PD1-OSC_OUT
|
|
||||||
Mcu.Pin3=PA4
|
|
||||||
Mcu.Pin4=PA11
|
|
||||||
Mcu.Pin5=PA12
|
|
||||||
Mcu.Pin6=PA13
|
|
||||||
Mcu.Pin7=PA14
|
|
||||||
Mcu.Pin8=PB8
|
|
||||||
Mcu.Pin9=PB9
|
|
||||||
Mcu.PinsNb=12
|
|
||||||
Mcu.ThirdPartyNb=0
|
|
||||||
Mcu.UserConstants=
|
|
||||||
Mcu.UserName=STM32F103C8Tx
|
|
||||||
MxCube.Version=6.13.0
|
|
||||||
MxDb.Version=DB.6.0.130
|
|
||||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
|
||||||
NVIC.CAN1_RX1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
|
||||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
|
||||||
NVIC.ForceEnableDMAVector=true
|
|
||||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
|
||||||
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
|
||||||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
|
||||||
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
|
||||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
|
||||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
|
||||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
|
||||||
NVIC.USB_LP_CAN1_RX0_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true
|
|
||||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
|
||||||
PA11.Mode=Device
|
|
||||||
PA11.Signal=USB_DM
|
|
||||||
PA12.Mode=Device
|
|
||||||
PA12.Signal=USB_DP
|
|
||||||
PA13.Locked=true
|
|
||||||
PA13.Mode=Serial_Wire
|
|
||||||
PA13.Signal=SYS_JTMS-SWDIO
|
|
||||||
PA14.Locked=true
|
|
||||||
PA14.Mode=Serial_Wire
|
|
||||||
PA14.Signal=SYS_JTCK-SWCLK
|
|
||||||
PA4.Locked=true
|
|
||||||
PA4.Signal=GPIO_Input
|
|
||||||
PB8.Mode=CAN_Activate
|
|
||||||
PB8.Signal=CAN_RX
|
|
||||||
PB9.Mode=CAN_Activate
|
|
||||||
PB9.Signal=CAN_TX
|
|
||||||
PC13-TAMPER-RTC.Locked=true
|
|
||||||
PC13-TAMPER-RTC.Signal=GPIO_Output
|
|
||||||
PD0-OSC_IN.Mode=HSE-External-Oscillator
|
|
||||||
PD0-OSC_IN.Signal=RCC_OSC_IN
|
|
||||||
PD1-OSC_OUT.Mode=HSE-External-Oscillator
|
|
||||||
PD1-OSC_OUT.Signal=RCC_OSC_OUT
|
|
||||||
PinOutPanel.RotationAngle=0
|
|
||||||
ProjectManager.AskForMigrate=true
|
|
||||||
ProjectManager.BackupPrevious=false
|
|
||||||
ProjectManager.CompilerOptimize=6
|
|
||||||
ProjectManager.ComputerToolchain=false
|
|
||||||
ProjectManager.CoupleFile=false
|
|
||||||
ProjectManager.CustomerFirmwarePackage=
|
|
||||||
ProjectManager.DefaultFWLocation=true
|
|
||||||
ProjectManager.DeletePrevious=true
|
|
||||||
ProjectManager.DeviceId=STM32F103C8Tx
|
|
||||||
ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.8.6
|
|
||||||
ProjectManager.FreePins=false
|
|
||||||
ProjectManager.HalAssertFull=false
|
|
||||||
ProjectManager.HeapSize=0x200
|
|
||||||
ProjectManager.KeepUserCode=true
|
|
||||||
ProjectManager.LastFirmware=true
|
|
||||||
ProjectManager.LibraryCopy=0
|
|
||||||
ProjectManager.MainLocation=Core/Src
|
|
||||||
ProjectManager.NoMain=false
|
|
||||||
ProjectManager.PreviousToolchain=
|
|
||||||
ProjectManager.ProjectBuild=false
|
|
||||||
ProjectManager.ProjectFileName=ModuleCAN.ioc
|
|
||||||
ProjectManager.ProjectName=ModuleCAN
|
|
||||||
ProjectManager.ProjectStructure=
|
|
||||||
ProjectManager.RegisterCallBack=
|
|
||||||
ProjectManager.StackSize=0x400
|
|
||||||
ProjectManager.TargetToolchain=EWARM V8.32
|
|
||||||
ProjectManager.ToolChainLocation=
|
|
||||||
ProjectManager.UAScriptAfterPath=
|
|
||||||
ProjectManager.UAScriptBeforePath=
|
|
||||||
ProjectManager.UnderRoot=false
|
|
||||||
ProjectManager.functionlistsort=
|
|
||||||
RCC.ADCFreqValue=24000000
|
|
||||||
RCC.AHBFreq_Value=48000000
|
|
||||||
RCC.APB1CLKDivider=RCC_HCLK_DIV2
|
|
||||||
RCC.APB1Freq_Value=24000000
|
|
||||||
RCC.APB1TimFreq_Value=48000000
|
|
||||||
RCC.APB2Freq_Value=48000000
|
|
||||||
RCC.APB2TimFreq_Value=48000000
|
|
||||||
RCC.FCLKCortexFreq_Value=48000000
|
|
||||||
RCC.FamilyName=M
|
|
||||||
RCC.HCLKFreq_Value=48000000
|
|
||||||
RCC.IPParameters=ADCFreqValue,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,PLLSourceVirtual,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,VCOOutput2Freq_Value
|
|
||||||
RCC.MCOFreq_Value=48000000
|
|
||||||
RCC.PLLCLKFreq_Value=48000000
|
|
||||||
RCC.PLLMCOFreq_Value=24000000
|
|
||||||
RCC.PLLMUL=RCC_PLL_MUL6
|
|
||||||
RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
|
|
||||||
RCC.SYSCLKFreq_VALUE=48000000
|
|
||||||
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
|
|
||||||
RCC.TimSysFreq_Value=48000000
|
|
||||||
RCC.USBFreq_Value=48000000
|
|
||||||
RCC.VCOOutput2Freq_Value=8000000
|
|
||||||
USB_DEVICE.CLASS_NAME_FS=CDC
|
|
||||||
USB_DEVICE.IPParameters=VirtualMode,VirtualModeFS,CLASS_NAME_FS,PRODUCT_STRING_CDC_FS
|
|
||||||
USB_DEVICE.PRODUCT_STRING_CDC_FS=Modular Keyboard - Module VCOM
|
|
||||||
USB_DEVICE.VirtualMode=Cdc
|
|
||||||
USB_DEVICE.VirtualModeFS=Cdc_FS
|
|
||||||
VP_SYS_VS_Systick.Mode=SysTick
|
|
||||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
|
||||||
VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Mode=CDC_FS
|
|
||||||
VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Signal=USB_DEVICE_VS_USB_DEVICE_CDC_FS
|
|
||||||
board=custom
|
|
||||||
1
firmware/components/can_testing/canblinker/.gitignore
vendored
Normal file
1
firmware/components/can_testing/canblinker/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.pio
|
||||||
11
firmware/components/can_testing/canblinker/.project
Normal file
11
firmware/components/can_testing/canblinker/.project
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>CAN-B</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
134
firmware/components/can_testing/canblinker/.vscode/c_cpp_properties.json
vendored
Normal file
134
firmware/components/can_testing/canblinker/.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
//
|
||||||
|
// !!! WARNING !!! AUTO-GENERATED FILE!
|
||||||
|
// PLEASE DO NOT MODIFY IT AND USE "platformio.ini":
|
||||||
|
// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
|
||||||
|
//
|
||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "PlatformIO",
|
||||||
|
"includePath": [
|
||||||
|
"/home/kymkim/Projects/modular-kbd/firmware/components/CAN/CAN-B/Inc",
|
||||||
|
"/home/kymkim/Projects/modular-kbd/firmware/components/CAN/CAN-B/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/CMSIS/Include",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/CMSIS/Device/ST/STM32F1xx/Include",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/STM32F1xx_HAL_Driver/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/STM32F1xx_HAL_Driver/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/CMSIS/DSP/Include",
|
||||||
|
"/home/kymkim/Projects/modular-kbd/firmware/components/CAN/CAN-B/.pio/libdeps/bluepill_f103c8/Unity/src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/Common",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/ak4343",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/cs43l22",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/hx8347d",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/ili9320",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/ili9325",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/lis302dl",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/spfd5408",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/st7735",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/stlm75",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/stmpe811",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Adafruit_Shield",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Utilities/CPU",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Utilities/Fonts",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Utilities/Log",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Core/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Core/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/AUDIO/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/AUDIO/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/DFU/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/DFU/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/HID/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Core/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Core/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/AUDIO/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/AUDIO/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/CDC/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/CDC/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/HID/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/MTP/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/MTP/Src",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"browse": {
|
||||||
|
"limitSymbolsToIncludedHeaders": true,
|
||||||
|
"path": [
|
||||||
|
"/home/kymkim/Projects/modular-kbd/firmware/components/CAN/CAN-B/Inc",
|
||||||
|
"/home/kymkim/Projects/modular-kbd/firmware/components/CAN/CAN-B/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/CMSIS/Include",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/CMSIS/Device/ST/STM32F1xx/Include",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/STM32F1xx_HAL_Driver/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/STM32F1xx_HAL_Driver/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/CMSIS/DSP/Include",
|
||||||
|
"/home/kymkim/Projects/modular-kbd/firmware/components/CAN/CAN-B/.pio/libdeps/bluepill_f103c8/Unity/src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/Common",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/ak4343",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/cs43l22",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/hx8347d",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/ili9320",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/ili9325",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/lis302dl",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/spfd5408",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/st7735",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/stlm75",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Components/stmpe811",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Drivers/BSP/Adafruit_Shield",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Utilities/CPU",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Utilities/Fonts",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Utilities/Log",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Core/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Core/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/AUDIO/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/AUDIO/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/DFU/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/DFU/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/HID/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Core/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Core/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/AUDIO/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/AUDIO/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/CDC/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/CDC/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/HID/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Src",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/MTP/Inc",
|
||||||
|
"/home/kymkim/.platformio/packages/framework-stm32cubef1/Middlewares/ST/STM32_USB_Host_Library/Class/MTP/Src",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"defines": [
|
||||||
|
"PLATFORMIO=60118",
|
||||||
|
"STM32F1",
|
||||||
|
"STM32F103xB",
|
||||||
|
"USE_HAL_DRIVER",
|
||||||
|
"F_CPU=72000000L",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"compilerPath": "/home/kymkim/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc",
|
||||||
|
"compilerArgs": [
|
||||||
|
"-mthumb",
|
||||||
|
"-mcpu=cortex-m3",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
||||||
47
firmware/components/can_testing/canblinker/.vscode/launch.json
vendored
Normal file
47
firmware/components/can_testing/canblinker/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
// AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY
|
||||||
|
//
|
||||||
|
// PlatformIO Debugging Solution
|
||||||
|
//
|
||||||
|
// Documentation: https://docs.platformio.org/en/latest/plus/debugging.html
|
||||||
|
// Configuration: https://docs.platformio.org/en/latest/projectconf/sections/env/options/debug/index.html
|
||||||
|
|
||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "platformio-debug",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "PIO Debug",
|
||||||
|
"executable": "/home/kymkim/Projects/modular-kbd/firmware/components/CAN/CAN-B/.pio/build/bluepill_f103c8/firmware.elf",
|
||||||
|
"projectEnvName": "bluepill_f103c8",
|
||||||
|
"toolchainBinDir": "/home/kymkim/.platformio/packages/toolchain-gccarmnoneeabi/bin",
|
||||||
|
"internalConsoleOptions": "openOnSessionStart",
|
||||||
|
"svdPath": "/home/kymkim/.platformio/platforms/ststm32/misc/svd/STM32F103xx.svd",
|
||||||
|
"preLaunchTask": {
|
||||||
|
"type": "PlatformIO",
|
||||||
|
"task": "Pre-Debug"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "platformio-debug",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "PIO Debug (skip Pre-Debug)",
|
||||||
|
"executable": "/home/kymkim/Projects/modular-kbd/firmware/components/CAN/CAN-B/.pio/build/bluepill_f103c8/firmware.elf",
|
||||||
|
"projectEnvName": "bluepill_f103c8",
|
||||||
|
"toolchainBinDir": "/home/kymkim/.platformio/packages/toolchain-gccarmnoneeabi/bin",
|
||||||
|
"internalConsoleOptions": "openOnSessionStart",
|
||||||
|
"svdPath": "/home/kymkim/.platformio/platforms/ststm32/misc/svd/STM32F103xx.svd"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "platformio-debug",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "PIO Debug (without uploading)",
|
||||||
|
"executable": "/home/kymkim/Projects/modular-kbd/firmware/components/CAN/CAN-B/.pio/build/bluepill_f103c8/firmware.elf",
|
||||||
|
"projectEnvName": "bluepill_f103c8",
|
||||||
|
"toolchainBinDir": "/home/kymkim/.platformio/packages/toolchain-gccarmnoneeabi/bin",
|
||||||
|
"internalConsoleOptions": "openOnSessionStart",
|
||||||
|
"svdPath": "/home/kymkim/.platformio/platforms/ststm32/misc/svd/STM32F103xx.svd",
|
||||||
|
"loadMode": "manual"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -2,11 +2,14 @@
|
|||||||
CAD.formats=
|
CAD.formats=
|
||||||
CAD.pinconfig=
|
CAD.pinconfig=
|
||||||
CAD.provider=
|
CAD.provider=
|
||||||
CAN.CalculateBaudRate=533333
|
CAN.BS1=CAN_BS1_13TQ
|
||||||
CAN.CalculateTimeBit=1875
|
CAN.BS2=CAN_BS2_2TQ
|
||||||
CAN.CalculateTimeQuantum=625.0
|
CAN.CalculateBaudRate=125000
|
||||||
CAN.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler
|
CAN.CalculateTimeBit=8000
|
||||||
CAN.Prescaler=15
|
CAN.CalculateTimeQuantum=500.0
|
||||||
|
CAN.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler,SJW,BS1,BS2
|
||||||
|
CAN.Prescaler=18
|
||||||
|
CAN.SJW=CAN_SJW_1TQ
|
||||||
File.Version=6
|
File.Version=6
|
||||||
GPIO.groupedBy=
|
GPIO.groupedBy=
|
||||||
KeepUserPlacement=false
|
KeepUserPlacement=false
|
||||||
@@ -16,23 +19,19 @@ Mcu.IP0=CAN
|
|||||||
Mcu.IP1=NVIC
|
Mcu.IP1=NVIC
|
||||||
Mcu.IP2=RCC
|
Mcu.IP2=RCC
|
||||||
Mcu.IP3=SYS
|
Mcu.IP3=SYS
|
||||||
Mcu.IP4=USB
|
Mcu.IPNb=4
|
||||||
Mcu.IP5=USB_DEVICE
|
|
||||||
Mcu.IPNb=6
|
|
||||||
Mcu.Name=STM32F103C(8-B)Tx
|
Mcu.Name=STM32F103C(8-B)Tx
|
||||||
Mcu.Package=LQFP48
|
Mcu.Package=LQFP48
|
||||||
Mcu.Pin0=PC13-TAMPER-RTC
|
Mcu.Pin0=PC13-TAMPER-RTC
|
||||||
Mcu.Pin1=PD0-OSC_IN
|
Mcu.Pin1=PD0-OSC_IN
|
||||||
Mcu.Pin10=VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS
|
|
||||||
Mcu.Pin2=PD1-OSC_OUT
|
Mcu.Pin2=PD1-OSC_OUT
|
||||||
Mcu.Pin3=PA11
|
Mcu.Pin3=PA13
|
||||||
Mcu.Pin4=PA12
|
Mcu.Pin4=PA14
|
||||||
Mcu.Pin5=PA13
|
Mcu.Pin5=PB7
|
||||||
Mcu.Pin6=PA14
|
Mcu.Pin6=PB8
|
||||||
Mcu.Pin7=PB8
|
Mcu.Pin7=PB9
|
||||||
Mcu.Pin8=PB9
|
Mcu.Pin8=VP_SYS_VS_Systick
|
||||||
Mcu.Pin9=VP_SYS_VS_Systick
|
Mcu.PinsNb=9
|
||||||
Mcu.PinsNb=11
|
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32F103C8Tx
|
Mcu.UserName=STM32F103C8Tx
|
||||||
@@ -41,6 +40,7 @@ MxDb.Version=DB.6.0.130
|
|||||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
NVIC.CAN1_RX1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
NVIC.CAN1_RX1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
|
NVIC.EXTI9_5_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||||
NVIC.ForceEnableDMAVector=true
|
NVIC.ForceEnableDMAVector=true
|
||||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
@@ -49,18 +49,19 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
|||||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
||||||
NVIC.USB_LP_CAN1_RX0_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
|
||||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
PA11.Mode=Device
|
|
||||||
PA11.Signal=USB_DM
|
|
||||||
PA12.Mode=Device
|
|
||||||
PA12.Signal=USB_DP
|
|
||||||
PA13.Mode=Serial_Wire
|
PA13.Mode=Serial_Wire
|
||||||
PA13.Signal=SYS_JTMS-SWDIO
|
PA13.Signal=SYS_JTMS-SWDIO
|
||||||
PA14.Mode=Serial_Wire
|
PA14.Mode=Serial_Wire
|
||||||
PA14.Signal=SYS_JTCK-SWCLK
|
PA14.Signal=SYS_JTCK-SWCLK
|
||||||
|
PB7.GPIOParameters=GPIO_PuPd
|
||||||
|
PB7.GPIO_PuPd=GPIO_PULLDOWN
|
||||||
|
PB7.Locked=true
|
||||||
|
PB7.Signal=GPXTI7
|
||||||
|
PB8.Locked=true
|
||||||
PB8.Mode=CAN_Activate
|
PB8.Mode=CAN_Activate
|
||||||
PB8.Signal=CAN_RX
|
PB8.Signal=CAN_RX
|
||||||
|
PB9.Locked=true
|
||||||
PB9.Mode=CAN_Activate
|
PB9.Mode=CAN_Activate
|
||||||
PB9.Signal=CAN_TX
|
PB9.Signal=CAN_TX
|
||||||
PC13-TAMPER-RTC.Locked=true
|
PC13-TAMPER-RTC.Locked=true
|
||||||
@@ -74,7 +75,7 @@ ProjectManager.AskForMigrate=true
|
|||||||
ProjectManager.BackupPrevious=false
|
ProjectManager.BackupPrevious=false
|
||||||
ProjectManager.CompilerOptimize=6
|
ProjectManager.CompilerOptimize=6
|
||||||
ProjectManager.ComputerToolchain=false
|
ProjectManager.ComputerToolchain=false
|
||||||
ProjectManager.CoupleFile=false
|
ProjectManager.CoupleFile=true
|
||||||
ProjectManager.CustomerFirmwarePackage=
|
ProjectManager.CustomerFirmwarePackage=
|
||||||
ProjectManager.DefaultFWLocation=true
|
ProjectManager.DefaultFWLocation=true
|
||||||
ProjectManager.DeletePrevious=true
|
ProjectManager.DeletePrevious=true
|
||||||
@@ -85,50 +86,45 @@ ProjectManager.HalAssertFull=false
|
|||||||
ProjectManager.HeapSize=0x200
|
ProjectManager.HeapSize=0x200
|
||||||
ProjectManager.KeepUserCode=true
|
ProjectManager.KeepUserCode=true
|
||||||
ProjectManager.LastFirmware=true
|
ProjectManager.LastFirmware=true
|
||||||
ProjectManager.LibraryCopy=2
|
ProjectManager.LibraryCopy=0
|
||||||
ProjectManager.MainLocation=Core/Src
|
ProjectManager.MainLocation=Core/Src
|
||||||
ProjectManager.NoMain=false
|
ProjectManager.NoMain=true
|
||||||
ProjectManager.PreviousToolchain=
|
ProjectManager.PreviousToolchain=
|
||||||
ProjectManager.ProjectBuild=false
|
ProjectManager.ProjectBuild=false
|
||||||
ProjectManager.ProjectFileName=MainCAN.ioc
|
ProjectManager.ProjectFileName=CAN-B.ioc
|
||||||
ProjectManager.ProjectName=MainCAN
|
ProjectManager.ProjectName=CAN-B
|
||||||
ProjectManager.ProjectStructure=
|
ProjectManager.ProjectStructure=
|
||||||
ProjectManager.RegisterCallBack=
|
ProjectManager.RegisterCallBack=
|
||||||
ProjectManager.StackSize=0x400
|
ProjectManager.StackSize=0x400
|
||||||
ProjectManager.TargetToolchain=EWARM V8.32
|
ProjectManager.TargetToolchain=CMake
|
||||||
ProjectManager.ToolChainLocation=
|
ProjectManager.ToolChainLocation=
|
||||||
ProjectManager.UAScriptAfterPath=
|
ProjectManager.UAScriptAfterPath=
|
||||||
ProjectManager.UAScriptBeforePath=
|
ProjectManager.UAScriptBeforePath=
|
||||||
ProjectManager.UnderRoot=false
|
ProjectManager.UnderRoot=false
|
||||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_CAN_Init-CAN-false-HAL-true,4-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL-false
|
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_CAN_Init-CAN-false-HAL-true
|
||||||
RCC.ADCFreqValue=24000000
|
RCC.ADCFreqValue=36000000
|
||||||
RCC.AHBFreq_Value=48000000
|
RCC.AHBFreq_Value=72000000
|
||||||
RCC.APB1CLKDivider=RCC_HCLK_DIV2
|
RCC.APB1CLKDivider=RCC_HCLK_DIV2
|
||||||
RCC.APB1Freq_Value=24000000
|
RCC.APB1Freq_Value=36000000
|
||||||
RCC.APB1TimFreq_Value=48000000
|
RCC.APB1TimFreq_Value=72000000
|
||||||
RCC.APB2Freq_Value=48000000
|
RCC.APB2Freq_Value=72000000
|
||||||
RCC.APB2TimFreq_Value=48000000
|
RCC.APB2TimFreq_Value=72000000
|
||||||
RCC.FCLKCortexFreq_Value=48000000
|
RCC.FCLKCortexFreq_Value=72000000
|
||||||
RCC.FamilyName=M
|
RCC.FamilyName=M
|
||||||
RCC.HCLKFreq_Value=48000000
|
RCC.HCLKFreq_Value=72000000
|
||||||
RCC.IPParameters=ADCFreqValue,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,PLLSourceVirtual,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,VCOOutput2Freq_Value
|
RCC.IPParameters=ADCFreqValue,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,PLLSourceVirtual,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,VCOOutput2Freq_Value
|
||||||
RCC.MCOFreq_Value=48000000
|
RCC.MCOFreq_Value=72000000
|
||||||
RCC.PLLCLKFreq_Value=48000000
|
RCC.PLLCLKFreq_Value=72000000
|
||||||
RCC.PLLMCOFreq_Value=24000000
|
RCC.PLLMCOFreq_Value=36000000
|
||||||
RCC.PLLMUL=RCC_PLL_MUL6
|
RCC.PLLMUL=RCC_PLL_MUL9
|
||||||
RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
|
RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
|
||||||
RCC.SYSCLKFreq_VALUE=48000000
|
RCC.SYSCLKFreq_VALUE=72000000
|
||||||
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
|
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
|
||||||
RCC.TimSysFreq_Value=48000000
|
RCC.TimSysFreq_Value=72000000
|
||||||
RCC.USBFreq_Value=48000000
|
RCC.USBFreq_Value=72000000
|
||||||
RCC.VCOOutput2Freq_Value=8000000
|
RCC.VCOOutput2Freq_Value=8000000
|
||||||
USB_DEVICE.CLASS_NAME_FS=CDC
|
SH.GPXTI7.0=GPIO_EXTI7
|
||||||
USB_DEVICE.IPParameters=VirtualMode,VirtualModeFS,CLASS_NAME_FS,PRODUCT_STRING_CDC_FS
|
SH.GPXTI7.ConfNb=1
|
||||||
USB_DEVICE.PRODUCT_STRING_CDC_FS=Modular Keyboard - Main Board
|
|
||||||
USB_DEVICE.VirtualMode=Cdc
|
|
||||||
USB_DEVICE.VirtualModeFS=Cdc_FS
|
|
||||||
VP_SYS_VS_Systick.Mode=SysTick
|
VP_SYS_VS_Systick.Mode=SysTick
|
||||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||||
VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Mode=CDC_FS
|
|
||||||
VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Signal=USB_DEVICE_VS_USB_DEVICE_CDC_FS
|
|
||||||
board=custom
|
board=custom
|
||||||
52
firmware/components/can_testing/canblinker/Inc/can.h
Normal file
52
firmware/components/can_testing/canblinker/Inc/can.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file can.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the can.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 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 */
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __CAN_H__
|
||||||
|
#define __CAN_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern CAN_HandleTypeDef hcan;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_CAN_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __CAN_H__ */
|
||||||
|
|
||||||
49
firmware/components/can_testing/canblinker/Inc/gpio.h
Normal file
49
firmware/components/can_testing/canblinker/Inc/gpio.h
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file gpio.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the gpio.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 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 */
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __GPIO_H__
|
||||||
|
#define __GPIO_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_GPIO_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /*__ GPIO_H__ */
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
/*#define HAL_NOR_MODULE_ENABLED */
|
/*#define HAL_NOR_MODULE_ENABLED */
|
||||||
/*#define HAL_NAND_MODULE_ENABLED */
|
/*#define HAL_NAND_MODULE_ENABLED */
|
||||||
/*#define HAL_PCCARD_MODULE_ENABLED */
|
/*#define HAL_PCCARD_MODULE_ENABLED */
|
||||||
#define HAL_PCD_MODULE_ENABLED
|
/*#define HAL_PCD_MODULE_ENABLED */
|
||||||
/*#define HAL_HCD_MODULE_ENABLED */
|
/*#define HAL_HCD_MODULE_ENABLED */
|
||||||
/*#define HAL_PWR_MODULE_ENABLED */
|
/*#define HAL_PWR_MODULE_ENABLED */
|
||||||
/*#define HAL_RCC_MODULE_ENABLED */
|
/*#define HAL_RCC_MODULE_ENABLED */
|
||||||
@@ -55,8 +55,8 @@ void SVC_Handler(void);
|
|||||||
void DebugMon_Handler(void);
|
void DebugMon_Handler(void);
|
||||||
void PendSV_Handler(void);
|
void PendSV_Handler(void);
|
||||||
void SysTick_Handler(void);
|
void SysTick_Handler(void);
|
||||||
void USB_LP_CAN1_RX0_IRQHandler(void);
|
|
||||||
void CAN1_RX1_IRQHandler(void);
|
void CAN1_RX1_IRQHandler(void);
|
||||||
|
void EXTI9_5_IRQHandler(void);
|
||||||
/* USER CODE BEGIN EFP */
|
/* USER CODE BEGIN EFP */
|
||||||
|
|
||||||
/* USER CODE END EFP */
|
/* USER CODE END EFP */
|
||||||
137
firmware/components/can_testing/canblinker/Src/can.c
Normal file
137
firmware/components/can_testing/canblinker/Src/can.c
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file can.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the CAN instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 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 "can.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
CAN_HandleTypeDef hcan;
|
||||||
|
|
||||||
|
/* CAN init function */
|
||||||
|
void MX_CAN_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN CAN_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END CAN_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN CAN_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END CAN_Init 1 */
|
||||||
|
hcan.Instance = CAN1;
|
||||||
|
hcan.Init.Prescaler = 18;
|
||||||
|
hcan.Init.Mode = CAN_MODE_NORMAL;
|
||||||
|
hcan.Init.SyncJumpWidth = CAN_SJW_1TQ;
|
||||||
|
hcan.Init.TimeSeg1 = CAN_BS1_13TQ;
|
||||||
|
hcan.Init.TimeSeg2 = CAN_BS2_2TQ;
|
||||||
|
hcan.Init.TimeTriggeredMode = DISABLE;
|
||||||
|
hcan.Init.AutoBusOff = DISABLE;
|
||||||
|
hcan.Init.AutoWakeUp = DISABLE;
|
||||||
|
hcan.Init.AutoRetransmission = DISABLE;
|
||||||
|
hcan.Init.ReceiveFifoLocked = DISABLE;
|
||||||
|
hcan.Init.TransmitFifoPriority = DISABLE;
|
||||||
|
if (HAL_CAN_Init(&hcan) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN CAN_Init 2 */
|
||||||
|
CAN_FilterTypeDef canfilterconf;
|
||||||
|
canfilterconf.FilterActivation = CAN_FILTER_ENABLE;
|
||||||
|
canfilterconf.FilterBank = 0;
|
||||||
|
canfilterconf.FilterFIFOAssignment = CAN_FILTER_FIFO1;
|
||||||
|
canfilterconf.FilterIdHigh = 0x399 << 5;
|
||||||
|
canfilterconf.FilterIdLow = 0x0000;
|
||||||
|
canfilterconf.FilterMaskIdHigh = 0x7FF << 5;
|
||||||
|
canfilterconf.FilterMaskIdLow = 0x0000;
|
||||||
|
canfilterconf.FilterMode = CAN_FILTERMODE_IDMASK;
|
||||||
|
canfilterconf.FilterScale = CAN_FILTERSCALE_32BIT;
|
||||||
|
HAL_CAN_ConfigFilter(&hcan, &canfilterconf);
|
||||||
|
/* USER CODE END CAN_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_CAN_MspInit(CAN_HandleTypeDef* canHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
if(canHandle->Instance==CAN1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN CAN1_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END CAN1_MspInit 0 */
|
||||||
|
/* CAN1 clock enable */
|
||||||
|
__HAL_RCC_CAN1_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
/**CAN GPIO Configuration
|
||||||
|
PB8 ------> CAN_RX
|
||||||
|
PB9 ------> CAN_TX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_8;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_9;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
__HAL_AFIO_REMAP_CAN1_2();
|
||||||
|
|
||||||
|
/* CAN1 interrupt Init */
|
||||||
|
HAL_NVIC_SetPriority(CAN1_RX1_IRQn, 0, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(CAN1_RX1_IRQn);
|
||||||
|
/* USER CODE BEGIN CAN1_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END CAN1_MspInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_CAN_MspDeInit(CAN_HandleTypeDef* canHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(canHandle->Instance==CAN1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN CAN1_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END CAN1_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_CAN1_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**CAN GPIO Configuration
|
||||||
|
PB8 ------> CAN_RX
|
||||||
|
PB9 ------> CAN_TX
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8|GPIO_PIN_9);
|
||||||
|
|
||||||
|
/* CAN1 interrupt Deinit */
|
||||||
|
HAL_NVIC_DisableIRQ(CAN1_RX1_IRQn);
|
||||||
|
/* USER CODE BEGIN CAN1_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END CAN1_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
77
firmware/components/can_testing/canblinker/Src/gpio.c
Normal file
77
firmware/components/can_testing/canblinker/Src/gpio.c
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file gpio.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of all used GPIO pins.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 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 "gpio.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Configure GPIO */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
|
/** Configure pins as
|
||||||
|
* Analog
|
||||||
|
* Input
|
||||||
|
* Output
|
||||||
|
* EVENT_OUT
|
||||||
|
* EXTI
|
||||||
|
*/
|
||||||
|
void MX_GPIO_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
|
||||||
|
/* GPIO Ports Clock Enable */
|
||||||
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
|
||||||
|
/*Configure GPIO pin Output Level */
|
||||||
|
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);
|
||||||
|
|
||||||
|
/*Configure GPIO pin : PC13 */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_13;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/*Configure GPIO pin : PB7 */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_7;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* EXTI interrupt init*/
|
||||||
|
HAL_NVIC_SetPriority(EXTI9_5_IRQn, 0, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 2 */
|
||||||
|
|
||||||
|
/* USER CODE END 2 */
|
||||||
227
firmware/components/can_testing/canblinker/Src/main.c
Normal file
227
firmware/components/can_testing/canblinker/Src/main.c
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file : main.c
|
||||||
|
* @brief : Main program body
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 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 "can.h"
|
||||||
|
#include "gpio.h"
|
||||||
|
|
||||||
|
/* Private includes ----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PTD */
|
||||||
|
|
||||||
|
/* USER CODE END PTD */
|
||||||
|
|
||||||
|
/* 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 -----------------------------------------------*/
|
||||||
|
void SystemClock_Config(void);
|
||||||
|
/* USER CODE BEGIN PFP */
|
||||||
|
|
||||||
|
/* USER CODE END PFP */
|
||||||
|
|
||||||
|
/* Private user code ---------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
CAN_TxHeaderTypeDef TxHeader;
|
||||||
|
CAN_RxHeaderTypeDef RxHeader;
|
||||||
|
|
||||||
|
uint8_t TxData[8];
|
||||||
|
uint8_t RxData[8];
|
||||||
|
|
||||||
|
uint32_t TxMailbox;
|
||||||
|
|
||||||
|
uint8_t isValidData;
|
||||||
|
uint8_t status;
|
||||||
|
|
||||||
|
uint32_t lastDebounceTime = 0;
|
||||||
|
const uint32_t debounceDelay = 50;
|
||||||
|
uint8_t delayLED = 0 ;
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The application entry point.
|
||||||
|
* @retval int
|
||||||
|
*/
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
|
/* MCU Configuration--------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
||||||
|
HAL_Init();
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Init */
|
||||||
|
|
||||||
|
/* USER CODE END Init */
|
||||||
|
|
||||||
|
/* Configure the system clock */
|
||||||
|
SystemClock_Config();
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SysInit */
|
||||||
|
|
||||||
|
/* USER CODE END SysInit */
|
||||||
|
|
||||||
|
/* Initialize all configured peripherals */
|
||||||
|
MX_GPIO_Init();
|
||||||
|
MX_CAN_Init();
|
||||||
|
/* USER CODE BEGIN 2 */
|
||||||
|
|
||||||
|
HAL_CAN_Start(&hcan);
|
||||||
|
HAL_CAN_ActivateNotification(&hcan, CAN_IT_RX_FIFO1_MSG_PENDING);
|
||||||
|
HAL_Delay(50);
|
||||||
|
|
||||||
|
TxHeader.DLC = 1;
|
||||||
|
TxHeader.IDE = CAN_ID_STD;
|
||||||
|
TxHeader.RTR = CAN_RTR_DATA;
|
||||||
|
TxHeader.StdId = 0x399;
|
||||||
|
|
||||||
|
TxData[0] = 0x1;
|
||||||
|
|
||||||
|
// milliseconds
|
||||||
|
|
||||||
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
|
/* Infinite loop */
|
||||||
|
/* USER CODE BEGIN WHILE */
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
|
||||||
|
HAL_Delay(delayLED*100);
|
||||||
|
}
|
||||||
|
/* USER CODE END 3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan)
|
||||||
|
{
|
||||||
|
HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO1, &RxHeader, RxData);
|
||||||
|
delayLED+=RxData[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
|
{
|
||||||
|
if(GPIO_Pin == GPIO_PIN_7)
|
||||||
|
{
|
||||||
|
uint32_t currentTime = HAL_GetTick();
|
||||||
|
if ((currentTime - lastDebounceTime) > debounceDelay)
|
||||||
|
{
|
||||||
|
lastDebounceTime = currentTime;
|
||||||
|
TxData[0] ^= 1;
|
||||||
|
HAL_CAN_AddTxMessage(&hcan, &TxHeader, TxData, &TxMailbox);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief System Clock Configuration
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void SystemClock_Config(void)
|
||||||
|
{
|
||||||
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||||
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the RCC Oscillators according to the specified parameters
|
||||||
|
* in the RCC_OscInitTypeDef structure.
|
||||||
|
*/
|
||||||
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||||
|
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||||
|
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
|
||||||
|
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||||
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||||
|
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||||
|
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
|
||||||
|
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Initializes the CPU, AHB and APB buses clocks
|
||||||
|
*/
|
||||||
|
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.APB1CLKDivider = RCC_HCLK_DIV2;
|
||||||
|
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||||
|
|
||||||
|
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 4 */
|
||||||
|
|
||||||
|
/* USER CODE END 4 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function is executed in case of error occurrence.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void Error_Handler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN Error_Handler_Debug */
|
||||||
|
/* User can add his own implementation to report the HAL error return state */
|
||||||
|
__disable_irq();
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/* USER CODE END Error_Handler_Debug */
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_FULL_ASSERT
|
||||||
|
/**
|
||||||
|
* @brief Reports the name of the source file and the source line number
|
||||||
|
* where the assert_param error has occurred.
|
||||||
|
* @param file: pointer to the source file name
|
||||||
|
* @param line: assert_param error line source number
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void assert_failed(uint8_t *file, uint32_t line)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN 6 */
|
||||||
|
/* User can add his own implementation to report the file name and line number,
|
||||||
|
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
||||||
|
/* USER CODE END 6 */
|
||||||
|
}
|
||||||
|
#endif /* USE_FULL_ASSERT */
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32f1xx_hal_msp.c
|
||||||
|
* @brief This file provides code for the MSP Initialization
|
||||||
|
* and de-Initialization codes.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 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"
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN TD */
|
||||||
|
|
||||||
|
/* USER CODE END TD */
|
||||||
|
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Define */
|
||||||
|
|
||||||
|
/* USER CODE END Define */
|
||||||
|
|
||||||
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Macro */
|
||||||
|
|
||||||
|
/* USER CODE END Macro */
|
||||||
|
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PV */
|
||||||
|
|
||||||
|
/* USER CODE END PV */
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN PFP */
|
||||||
|
|
||||||
|
/* USER CODE END PFP */
|
||||||
|
|
||||||
|
/* External functions --------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN ExternalFunctions */
|
||||||
|
|
||||||
|
/* USER CODE END ExternalFunctions */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
/**
|
||||||
|
* Initializes the Global MSP.
|
||||||
|
*/
|
||||||
|
void HAL_MspInit(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END MspInit 0 */
|
||||||
|
|
||||||
|
__HAL_RCC_AFIO_CLK_ENABLE();
|
||||||
|
__HAL_RCC_PWR_CLK_ENABLE();
|
||||||
|
|
||||||
|
/* System interrupt init*/
|
||||||
|
|
||||||
|
/** NOJTAG: JTAG-DP Disabled and SW-DP Enabled
|
||||||
|
*/
|
||||||
|
__HAL_AFIO_REMAP_SWJ_NOJTAG();
|
||||||
|
|
||||||
|
/* USER CODE BEGIN MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END MspInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
@@ -55,7 +55,6 @@
|
|||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
/* External variables --------------------------------------------------------*/
|
/* External variables --------------------------------------------------------*/
|
||||||
extern PCD_HandleTypeDef hpcd_USB_FS;
|
|
||||||
extern CAN_HandleTypeDef hcan;
|
extern CAN_HandleTypeDef hcan;
|
||||||
/* USER CODE BEGIN EV */
|
/* USER CODE BEGIN EV */
|
||||||
|
|
||||||
@@ -199,21 +198,6 @@ void SysTick_Handler(void)
|
|||||||
/* please refer to the startup file (startup_stm32f1xx.s). */
|
/* please refer to the startup file (startup_stm32f1xx.s). */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function handles USB low priority or CAN RX0 interrupts.
|
|
||||||
*/
|
|
||||||
void USB_LP_CAN1_RX0_IRQHandler(void)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN USB_LP_CAN1_RX0_IRQn 0 */
|
|
||||||
|
|
||||||
/* USER CODE END USB_LP_CAN1_RX0_IRQn 0 */
|
|
||||||
HAL_CAN_IRQHandler(&hcan);
|
|
||||||
HAL_PCD_IRQHandler(&hpcd_USB_FS);
|
|
||||||
/* USER CODE BEGIN USB_LP_CAN1_RX0_IRQn 1 */
|
|
||||||
|
|
||||||
/* USER CODE END USB_LP_CAN1_RX0_IRQn 1 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles CAN RX1 interrupt.
|
* @brief This function handles CAN RX1 interrupt.
|
||||||
*/
|
*/
|
||||||
@@ -228,6 +212,20 @@ void CAN1_RX1_IRQHandler(void)
|
|||||||
/* USER CODE END CAN1_RX1_IRQn 1 */
|
/* USER CODE END CAN1_RX1_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles EXTI line[9:5] interrupts.
|
||||||
|
*/
|
||||||
|
void EXTI9_5_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN EXTI9_5_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END EXTI9_5_IRQn 0 */
|
||||||
|
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_7);
|
||||||
|
/* USER CODE BEGIN EXTI9_5_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END EXTI9_5_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/* USER CODE BEGIN 1 */
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
/* USER CODE END 1 */
|
/* USER CODE END 1 */
|
||||||
46
firmware/components/can_testing/canblinker/lib/README
Normal file
46
firmware/components/can_testing/canblinker/lib/README
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
This directory is intended for project specific (private) libraries.
|
||||||
|
PlatformIO will compile them to static libraries and link into the executable file.
|
||||||
|
|
||||||
|
The source code of each library should be placed in a separate directory
|
||||||
|
("lib/your_library_name/[Code]").
|
||||||
|
|
||||||
|
For example, see the structure of the following example libraries `Foo` and `Bar`:
|
||||||
|
|
||||||
|
|--lib
|
||||||
|
| |
|
||||||
|
| |--Bar
|
||||||
|
| | |--docs
|
||||||
|
| | |--examples
|
||||||
|
| | |--src
|
||||||
|
| | |- Bar.c
|
||||||
|
| | |- Bar.h
|
||||||
|
| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||||
|
| |
|
||||||
|
| |--Foo
|
||||||
|
| | |- Foo.c
|
||||||
|
| | |- Foo.h
|
||||||
|
| |
|
||||||
|
| |- README --> THIS FILE
|
||||||
|
|
|
||||||
|
|- platformio.ini
|
||||||
|
|--src
|
||||||
|
|- main.c
|
||||||
|
|
||||||
|
Example contents of `src/main.c` using Foo and Bar:
|
||||||
|
```
|
||||||
|
#include <Foo.h>
|
||||||
|
#include <Bar.h>
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
The PlatformIO Library Dependency Finder will find automatically dependent
|
||||||
|
libraries by scanning project source files.
|
||||||
|
|
||||||
|
More information about PlatformIO Library Dependency Finder
|
||||||
|
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||||
19
firmware/components/can_testing/canblinker/platformio.ini
Normal file
19
firmware/components/can_testing/canblinker/platformio.ini
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
; PlatformIO Project Configuration File
|
||||||
|
;
|
||||||
|
; Build options: build flags, source filter
|
||||||
|
; Upload options: custom upload port, speed and extra flags
|
||||||
|
; Library options: dependencies, extra library storages
|
||||||
|
; Advanced options: extra scripting
|
||||||
|
;
|
||||||
|
; Please visit documentation for the other options and examples
|
||||||
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
|
[env:bluepill_f103c8]
|
||||||
|
platform = ststm32
|
||||||
|
board = bluepill_f103c8
|
||||||
|
framework = stm32cube
|
||||||
|
board_build.stm32cube.custom_config_header = yes
|
||||||
|
|
||||||
|
[platformio]
|
||||||
|
include_dir = Inc
|
||||||
|
src_dir = Src
|
||||||
18
firmware/components/can_testing/canblinker/stm32pio.ini
Normal file
18
firmware/components/can_testing/canblinker/stm32pio.ini
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
[app]
|
||||||
|
platformio_cmd = platformio
|
||||||
|
cubemx_cmd = /opt/stm32cubemx/STM32CubeMX
|
||||||
|
java_cmd = java
|
||||||
|
|
||||||
|
[project]
|
||||||
|
cubemx_script_content = config load ${ioc_file_absolute_path}
|
||||||
|
generate code ${project_dir_absolute_path}
|
||||||
|
exit
|
||||||
|
platformio_ini_patch_content = [platformio]
|
||||||
|
include_dir = Inc
|
||||||
|
src_dir = Src
|
||||||
|
board = bluepill_f103c8
|
||||||
|
ioc_file = CAN-B.ioc
|
||||||
|
cleanup_ignore = CAN-B.ioc
|
||||||
|
cleanup_use_git = False
|
||||||
|
inspect_ioc = True
|
||||||
|
|
||||||
11
firmware/components/can_testing/canblinker/test/README
Normal file
11
firmware/components/can_testing/canblinker/test/README
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
This directory is intended for PlatformIO Test Runner and project tests.
|
||||||
|
|
||||||
|
Unit Testing is a software testing method by which individual units of
|
||||||
|
source code, sets of one or more MCU program modules together with associated
|
||||||
|
control data, usage procedures, and operating procedures, are tested to
|
||||||
|
determine whether they are fit for use. Unit testing finds problems early
|
||||||
|
in the development cycle.
|
||||||
|
|
||||||
|
More information about PlatformIO Unit Testing:
|
||||||
|
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user