update version to v2.0.8

This commit is contained in:
Artery-MCU
2022-11-22 18:18:07 +08:00
parent d95c5fb9e8
commit d4910499d3
1365 changed files with 13037 additions and 14600 deletions

View File

@@ -1,46 +1,44 @@
/**
**************************************************************************
* @file at32f415_clock.h
* @version v2.0.7
* @date 2022-08-16
* @brief header file of clock program
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __AT32F415_CLOCK_H
#define __AT32F415_CLOCK_H
#ifdef __cplusplus
extern "C" {
#endif
/* includes ------------------------------------------------------------------*/
#include "at32f415.h"
/* exported functions ------------------------------------------------------- */
void system_clock_config(void);
#ifdef __cplusplus
}
#endif
#endif
/**
**************************************************************************
* @file at32f415_clock.h
* @brief header file of clock program
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __AT32F415_CLOCK_H
#define __AT32F415_CLOCK_H
#ifdef __cplusplus
extern "C" {
#endif
/* includes ------------------------------------------------------------------*/
#include "at32f415.h"
/* exported functions ------------------------------------------------------- */
void system_clock_config(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,146 +1,144 @@
/**
**************************************************************************
* @file at32f415_conf.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f415 config header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __AT32F415_CONF_H
#define __AT32F415_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief in the following line adjust the value of high speed exernal crystal (hext)
* used in your application
* tip: to avoid modifying this file each time you need to use different hext, you
* can define the hext value in your toolchain compiler preprocessor.
*/
#if !defined HEXT_VALUE
#define HEXT_VALUE ((uint32_t)8000000) /*!< value of the high speed exernal crystal in hz */
#endif
/**
* @brief in the following line adjust the high speed exernal crystal (hext) startup
* timeout value
*/
#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000) /*!< time out for hext start up */
#define HICK_VALUE ((uint32_t)8000000) /*!< value of the high speed internal clock in hz */
/* module define -------------------------------------------------------------*/
#define CRM_MODULE_ENABLED
#define CMP_MODULE_ENABLED
#define TMR_MODULE_ENABLED
#define ERTC_MODULE_ENABLED
#define GPIO_MODULE_ENABLED
#define I2C_MODULE_ENABLED
#define USART_MODULE_ENABLED
#define PWC_MODULE_ENABLED
#define CAN_MODULE_ENABLED
#define ADC_MODULE_ENABLED
#define SPI_MODULE_ENABLED
#define DMA_MODULE_ENABLED
#define DEBUG_MODULE_ENABLED
#define FLASH_MODULE_ENABLED
#define CRC_MODULE_ENABLED
#define WWDT_MODULE_ENABLED
#define WDT_MODULE_ENABLED
#define EXINT_MODULE_ENABLED
#define SDIO_MODULE_ENABLED
#define USB_MODULE_ENABLED
#define MISC_MODULE_ENABLED
/* includes ------------------------------------------------------------------*/
#ifdef CRM_MODULE_ENABLED
#include "at32f415_crm.h"
#endif
#ifdef CMP_MODULE_ENABLED
#include "at32f415_cmp.h"
#endif
#ifdef TMR_MODULE_ENABLED
#include "at32f415_tmr.h"
#endif
#ifdef ERTC_MODULE_ENABLED
#include "at32f415_ertc.h"
#endif
#ifdef GPIO_MODULE_ENABLED
#include "at32f415_gpio.h"
#endif
#ifdef I2C_MODULE_ENABLED
#include "at32f415_i2c.h"
#endif
#ifdef USART_MODULE_ENABLED
#include "at32f415_usart.h"
#endif
#ifdef PWC_MODULE_ENABLED
#include "at32f415_pwc.h"
#endif
#ifdef CAN_MODULE_ENABLED
#include "at32f415_can.h"
#endif
#ifdef ADC_MODULE_ENABLED
#include "at32f415_adc.h"
#endif
#ifdef SPI_MODULE_ENABLED
#include "at32f415_spi.h"
#endif
#ifdef DMA_MODULE_ENABLED
#include "at32f415_dma.h"
#endif
#ifdef DEBUG_MODULE_ENABLED
#include "at32f415_debug.h"
#endif
#ifdef FLASH_MODULE_ENABLED
#include "at32f415_flash.h"
#endif
#ifdef CRC_MODULE_ENABLED
#include "at32f415_crc.h"
#endif
#ifdef WWDT_MODULE_ENABLED
#include "at32f415_wwdt.h"
#endif
#ifdef WDT_MODULE_ENABLED
#include "at32f415_wdt.h"
#endif
#ifdef EXINT_MODULE_ENABLED
#include "at32f415_exint.h"
#endif
#ifdef SDIO_MODULE_ENABLED
#include "at32f415_sdio.h"
#endif
#ifdef MISC_MODULE_ENABLED
#include "at32f415_misc.h"
#endif
#ifdef USB_MODULE_ENABLED
#include "at32f415_usb.h"
#endif
#ifdef __cplusplus
}
#endif
#endif /* __AT32F415_CONF_H */
/**
**************************************************************************
* @file at32f415_conf.h
* @brief at32f415 config header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __AT32F415_CONF_H
#define __AT32F415_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief in the following line adjust the value of high speed exernal crystal (hext)
* used in your application
* tip: to avoid modifying this file each time you need to use different hext, you
* can define the hext value in your toolchain compiler preprocessor.
*/
#if !defined HEXT_VALUE
#define HEXT_VALUE ((uint32_t)8000000) /*!< value of the high speed exernal crystal in hz */
#endif
/**
* @brief in the following line adjust the high speed exernal crystal (hext) startup
* timeout value
*/
#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000) /*!< time out for hext start up */
#define HICK_VALUE ((uint32_t)8000000) /*!< value of the high speed internal clock in hz */
/* module define -------------------------------------------------------------*/
#define CRM_MODULE_ENABLED
#define CMP_MODULE_ENABLED
#define TMR_MODULE_ENABLED
#define ERTC_MODULE_ENABLED
#define GPIO_MODULE_ENABLED
#define I2C_MODULE_ENABLED
#define USART_MODULE_ENABLED
#define PWC_MODULE_ENABLED
#define CAN_MODULE_ENABLED
#define ADC_MODULE_ENABLED
#define SPI_MODULE_ENABLED
#define DMA_MODULE_ENABLED
#define DEBUG_MODULE_ENABLED
#define FLASH_MODULE_ENABLED
#define CRC_MODULE_ENABLED
#define WWDT_MODULE_ENABLED
#define WDT_MODULE_ENABLED
#define EXINT_MODULE_ENABLED
#define SDIO_MODULE_ENABLED
#define USB_MODULE_ENABLED
#define MISC_MODULE_ENABLED
/* includes ------------------------------------------------------------------*/
#ifdef CRM_MODULE_ENABLED
#include "at32f415_crm.h"
#endif
#ifdef CMP_MODULE_ENABLED
#include "at32f415_cmp.h"
#endif
#ifdef TMR_MODULE_ENABLED
#include "at32f415_tmr.h"
#endif
#ifdef ERTC_MODULE_ENABLED
#include "at32f415_ertc.h"
#endif
#ifdef GPIO_MODULE_ENABLED
#include "at32f415_gpio.h"
#endif
#ifdef I2C_MODULE_ENABLED
#include "at32f415_i2c.h"
#endif
#ifdef USART_MODULE_ENABLED
#include "at32f415_usart.h"
#endif
#ifdef PWC_MODULE_ENABLED
#include "at32f415_pwc.h"
#endif
#ifdef CAN_MODULE_ENABLED
#include "at32f415_can.h"
#endif
#ifdef ADC_MODULE_ENABLED
#include "at32f415_adc.h"
#endif
#ifdef SPI_MODULE_ENABLED
#include "at32f415_spi.h"
#endif
#ifdef DMA_MODULE_ENABLED
#include "at32f415_dma.h"
#endif
#ifdef DEBUG_MODULE_ENABLED
#include "at32f415_debug.h"
#endif
#ifdef FLASH_MODULE_ENABLED
#include "at32f415_flash.h"
#endif
#ifdef CRC_MODULE_ENABLED
#include "at32f415_crc.h"
#endif
#ifdef WWDT_MODULE_ENABLED
#include "at32f415_wwdt.h"
#endif
#ifdef WDT_MODULE_ENABLED
#include "at32f415_wdt.h"
#endif
#ifdef EXINT_MODULE_ENABLED
#include "at32f415_exint.h"
#endif
#ifdef SDIO_MODULE_ENABLED
#include "at32f415_sdio.h"
#endif
#ifdef MISC_MODULE_ENABLED
#include "at32f415_misc.h"
#endif
#ifdef USB_MODULE_ENABLED
#include "at32f415_usb.h"
#endif
#ifdef __cplusplus
}
#endif
#endif /* __AT32F415_CONF_H */

View File

@@ -1,58 +1,56 @@
/**
**************************************************************************
* @file at32f415_int.h
* @version v2.0.7
* @date 2022-08-16
* @brief header file of main interrupt service routines.
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __AT32F415_INT_H
#define __AT32F415_INT_H
#ifdef __cplusplus
extern "C" {
#endif
/* includes ------------------------------------------------------------------*/
#include "at32f415.h"
/* exported types ------------------------------------------------------------*/
/* exported constants --------------------------------------------------------*/
/* exported macro ------------------------------------------------------------*/
/* exported functions ------------------------------------------------------- */
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
#ifdef __cplusplus
}
#endif
#endif
/**
**************************************************************************
* @file at32f415_int.h
* @brief header file of main interrupt service routines.
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __AT32F415_INT_H
#define __AT32F415_INT_H
#ifdef __cplusplus
extern "C" {
#endif
/* includes ------------------------------------------------------------------*/
#include "at32f415.h"
/* exported types ------------------------------------------------------------*/
/* exported constants --------------------------------------------------------*/
/* exported macro ------------------------------------------------------------*/
/* exported functions ------------------------------------------------------- */
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,172 +1,170 @@
/**
**************************************************************************
* @file usb_conf.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb config header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __USB_CONF_H
#define __USB_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
#include "at32f415_usb.h"
#include "at32f415.h"
#include "stdio.h"
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_USB_host_cdc
* @{
*/
/**
* @brief enable usb device mode
*/
/* #define USE_OTG_DEVICE_MODE */
/**
* @brief enable usb host mode
*/
#define USE_OTG_HOST_MODE
#define USB_ID 0
#define OTG_CLOCK CRM_OTGFS1_PERIPH_CLOCK
#define OTG_IRQ OTGFS1_IRQn
#define OTG_IRQ_HANDLER OTGFS1_IRQHandler
#define OTG_WKUP_IRQ OTGFS1_WKUP_IRQn
#define OTG_WKUP_HANDLER OTGFS1_WKUP_IRQHandler
#define OTG_WKUP_EXINT_LINE EXINT_LINE_18
#define OTG_PIN_GPIO GPIOA
#define OTG_PIN_GPIO_CLOCK CRM_GPIOA_PERIPH_CLOCK
#define OTG_PIN_VBUS GPIO_PINS_9
#define OTG_PIN_ID GPIO_PINS_10
#define OTG_PIN_SOF_GPIO GPIOA
#define OTG_PIN_SOF_GPIO_CLOCK CRM_GPIOA_PERIPH_CLOCK
#define OTG_PIN_SOF GPIO_PINS_8
#define OTG_PIN_POWER_SWITCH_GPIO GPIOB
#define OTG_PIN_POWER_SWITCH_CLOCK CRM_GPIOH_PERIPH_CLOCK
#define OTG_PIN_POWER_SWITCH GPIO_PINS_3
/**
* @brief usb device mode config
*/
#ifdef USE_OTG_DEVICE_MODE
/**
* @brief usb device mode fifo
*/
/* otg1 device fifo */
#define USBD_RX_SIZE 128
#define USBD_EP0_TX_SIZE 24
#define USBD_EP1_TX_SIZE 20
#define USBD_EP2_TX_SIZE 20
#define USBD_EP3_TX_SIZE 20
/**
* @brief usb endpoint max num define
*/
#ifndef USB_EPT_MAX_NUM
#define USB_EPT_MAX_NUM 4
#endif
#endif
/**
* @brief usb host mode config
*/
#ifdef USE_OTG_HOST_MODE
#ifndef USB_HOST_CHANNEL_NUM
#define USB_HOST_CHANNEL_NUM 8
#endif
/**
* @brief usb host mode fifo
*/
/* otg1 host fifo */
#define USBH_RX_FIFO_SIZE 128
#define USBH_NP_TX_FIFO_SIZE 96
#define USBH_P_TX_FIFO_SIZE 96
/* usb host vbus power switch */
//#define USBH_5V_POWER_SWITCH
#endif
/**
* @brief usb sof output enable
*/
/* #define USB_SOF_OUTPUT_ENABLE */
/**
* @brief ignore vbus detection, only available in at32f415xx revision C.
* at32f415xx revision B: (not support)
* the vbus detection pin (pa9) can not be used for other functionality.
* vbus pin must kept at VBUS or VDD.
*
* at32f415xx revision C: (support)
* ignore vbus detection, the internal vbus is always valid.
* the vbus pin (pa9) can be used for other functionality.
* note: host mode can use vbus ignore
*/
#define USB_VBUS_IGNORE
/**
* @brief usb low power wakeup handler enable
*/
/* #define USB_LOW_POWER_WAKUP */
#define USBH_DEBUG_ENABLE
#ifdef USBH_DEBUG_ENABLE
#define USBH_DEBUG(...) printf(__VA_ARGS__);\
printf("\r\n");
#else
#define USBH_DEBUG(...)
#endif
void usb_delay_ms(uint32_t ms);
void usb_delay_us(uint32_t us);
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif
/**
**************************************************************************
* @file usb_conf.h
* @brief usb config header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __USB_CONF_H
#define __USB_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
#include "at32f415_usb.h"
#include "at32f415.h"
#include "stdio.h"
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_USB_host_cdc
* @{
*/
/**
* @brief enable usb device mode
*/
/* #define USE_OTG_DEVICE_MODE */
/**
* @brief enable usb host mode
*/
#define USE_OTG_HOST_MODE
#define USB_ID 0
#define OTG_CLOCK CRM_OTGFS1_PERIPH_CLOCK
#define OTG_IRQ OTGFS1_IRQn
#define OTG_IRQ_HANDLER OTGFS1_IRQHandler
#define OTG_WKUP_IRQ OTGFS1_WKUP_IRQn
#define OTG_WKUP_HANDLER OTGFS1_WKUP_IRQHandler
#define OTG_WKUP_EXINT_LINE EXINT_LINE_18
#define OTG_PIN_GPIO GPIOA
#define OTG_PIN_GPIO_CLOCK CRM_GPIOA_PERIPH_CLOCK
#define OTG_PIN_VBUS GPIO_PINS_9
#define OTG_PIN_ID GPIO_PINS_10
#define OTG_PIN_SOF_GPIO GPIOA
#define OTG_PIN_SOF_GPIO_CLOCK CRM_GPIOA_PERIPH_CLOCK
#define OTG_PIN_SOF GPIO_PINS_8
#define OTG_PIN_POWER_SWITCH_GPIO GPIOB
#define OTG_PIN_POWER_SWITCH_CLOCK CRM_GPIOH_PERIPH_CLOCK
#define OTG_PIN_POWER_SWITCH GPIO_PINS_3
/**
* @brief usb device mode config
*/
#ifdef USE_OTG_DEVICE_MODE
/**
* @brief usb device mode fifo
*/
/* otg1 device fifo */
#define USBD_RX_SIZE 128
#define USBD_EP0_TX_SIZE 24
#define USBD_EP1_TX_SIZE 20
#define USBD_EP2_TX_SIZE 20
#define USBD_EP3_TX_SIZE 20
/**
* @brief usb endpoint max num define
*/
#ifndef USB_EPT_MAX_NUM
#define USB_EPT_MAX_NUM 4
#endif
#endif
/**
* @brief usb host mode config
*/
#ifdef USE_OTG_HOST_MODE
#ifndef USB_HOST_CHANNEL_NUM
#define USB_HOST_CHANNEL_NUM 8
#endif
/**
* @brief usb host mode fifo
*/
/* otg1 host fifo */
#define USBH_RX_FIFO_SIZE 128
#define USBH_NP_TX_FIFO_SIZE 96
#define USBH_P_TX_FIFO_SIZE 96
/* usb host vbus power switch */
//#define USBH_5V_POWER_SWITCH
#endif
/**
* @brief usb sof output enable
*/
/* #define USB_SOF_OUTPUT_ENABLE */
/**
* @brief ignore vbus detection, only available in at32f415xx revision C.
* at32f415xx revision B: (not support)
* the vbus detection pin (pa9) can not be used for other functionality.
* vbus pin must kept at VBUS or VDD.
*
* at32f415xx revision C: (support)
* ignore vbus detection, the internal vbus is always valid.
* the vbus pin (pa9) can be used for other functionality.
* note: host mode can use vbus ignore
*/
#define USB_VBUS_IGNORE
/**
* @brief usb low power wakeup handler enable
*/
/* #define USB_LOW_POWER_WAKUP */
#define USBH_DEBUG_ENABLE
#ifdef USBH_DEBUG_ENABLE
#define USBH_DEBUG(...) printf(__VA_ARGS__);\
printf("\r\n");
#else
#define USBH_DEBUG(...)
#endif
void usb_delay_ms(uint32_t ms);
void usb_delay_us(uint32_t us);
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,43 +1,41 @@
/**
**************************************************************************
* @file usbh_user.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb host user header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __USBH_USER_H
#define __USBH_USER_H
#ifdef __cplusplus
extern "C" {
#endif
#include "usbh_core.h"
extern usbh_user_handler_type usbh_user_handle;
#ifdef __cplusplus
}
#endif
#endif
/**
**************************************************************************
* @file usbh_user.h
* @brief usb host user header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __USBH_USER_H
#define __USBH_USER_H
#ifdef __cplusplus
extern "C" {
#endif
#include "usbh_core.h"
extern usbh_user_handler_type usbh_user_handle;
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -10,9 +10,9 @@
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt>
<tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp</CppX>
<CppX>*.cpp; *.cc; *.cxx</CppX>
<nMigrate>0</nMigrate>
</Extensions>

View File

@@ -16,7 +16,7 @@
<TargetCommonOption>
<Device>-AT32F415RCT7</Device>
<Vendor>ArteryTek</Vendor>
<PackID>ArteryTek.AT32F415_DFP.2.0.0</PackID>
<PackID>ArteryTek.AT32F415_DFP.2.0.6</PackID>
<Cpu>IRAM(0x20000000,0x8000) IROM(0x08000000,0x40000) CPUTYPE("Cortex-M4") CLOCK(12000000) ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
@@ -533,11 +533,6 @@
<Layers>
<Layer>
<LayName>&lt;Project Info&gt;</LayName>
<LayDesc></LayDesc>
<LayUrl></LayUrl>
<LayKeys></LayKeys>
<LayCat></LayCat>
<LayLic></LayLic>
<LayTarg>0</LayTarg>
<LayPrjMark>1</LayPrjMark>
</Layer>

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file readme.txt
* @version v2.0.7
* @date 2022-08-16
* @brief readme
**************************************************************************
*/
@@ -11,4 +9,4 @@
when an usb device is attached to the host port, the device is enumerated and
checked whether it cdc device.
for more detailed information, please refer to the application note document AN0097.
for more detailed information, please refer to the application note document AN0097.

View File

@@ -1,99 +1,97 @@
/**
**************************************************************************
* @file at32f415_clock.c
* @version v2.0.7
* @date 2022-08-16
* @brief system clock config program
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* includes ------------------------------------------------------------------*/
#include "at32f415_clock.h"
/**
* @brief system clock config program
* @note the system clock is configured as follow:
* - system clock = hext / 2 * pll_mult
* - system clock source = pll (hext)
* - hext = 8000000
* - sclk = 144000000
* - ahbdiv = 1
* - ahbclk = 144000000
* - apb2div = 2
* - apb2clk = 72000000
* - apb1div = 2
* - apb1clk = 72000000
* - pll_mult = 36
* - flash_wtcyc = 4 cycle
* @param none
* @retval none
*/
void system_clock_config(void)
{
/* config flash psr register */
flash_psr_set(FLASH_WAIT_CYCLE_4);
/* reset crm */
crm_reset();
crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
/* wait till hext is ready */
while(crm_hext_stable_wait() == ERROR)
{
}
/* config pll clock resource */
crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_36);
/* enable pll */
crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
/* wait till pll is ready */
while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
{
}
/* config ahbclk */
crm_ahb_div_set(CRM_AHB_DIV_1);
/* config apb2clk */
crm_apb2_div_set(CRM_APB2_DIV_2);
/* config apb1clk */
crm_apb1_div_set(CRM_APB1_DIV_2);
/* enable auto step mode */
crm_auto_step_mode_enable(TRUE);
/* select pll as system clock source */
crm_sysclk_switch(CRM_SCLK_PLL);
/* wait till pll is used as system clock source */
while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
{
}
/* disable auto step mode */
crm_auto_step_mode_enable(FALSE);
/* update system_core_clock global variable */
system_core_clock_update();
}
/**
**************************************************************************
* @file at32f415_clock.c
* @brief system clock config program
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* includes ------------------------------------------------------------------*/
#include "at32f415_clock.h"
/**
* @brief system clock config program
* @note the system clock is configured as follow:
* - system clock = hext / 2 * pll_mult
* - system clock source = pll (hext)
* - hext = 8000000
* - sclk = 144000000
* - ahbdiv = 1
* - ahbclk = 144000000
* - apb2div = 2
* - apb2clk = 72000000
* - apb1div = 2
* - apb1clk = 72000000
* - pll_mult = 36
* - flash_wtcyc = 4 cycle
* @param none
* @retval none
*/
void system_clock_config(void)
{
/* config flash psr register */
flash_psr_set(FLASH_WAIT_CYCLE_4);
/* reset crm */
crm_reset();
crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
/* wait till hext is ready */
while(crm_hext_stable_wait() == ERROR)
{
}
/* config pll clock resource */
crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_36);
/* enable pll */
crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
/* wait till pll is ready */
while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
{
}
/* config ahbclk */
crm_ahb_div_set(CRM_AHB_DIV_1);
/* config apb2clk, the maximum frequency of APB1/APB2 clock is 75 MHz */
crm_apb2_div_set(CRM_APB2_DIV_2);
/* config apb1clk, the maximum frequency of APB1/APB2 clock is 75 MHz */
crm_apb1_div_set(CRM_APB1_DIV_2);
/* enable auto step mode */
crm_auto_step_mode_enable(TRUE);
/* select pll as system clock source */
crm_sysclk_switch(CRM_SCLK_PLL);
/* wait till pll is used as system clock source */
while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
{
}
/* disable auto step mode */
crm_auto_step_mode_enable(FALSE);
/* update system_core_clock global variable */
system_core_clock_update();
}

View File

@@ -1,142 +1,140 @@
/**
**************************************************************************
* @file at32f415_int.c
* @version v2.0.7
* @date 2022-08-16
* @brief main interrupt service routines.
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* includes ------------------------------------------------------------------*/
#include "at32f415_int.h"
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_USB_host_cdc
* @{
*/
/**
* @brief this function handles nmi exception.
* @param none
* @retval none
*/
void NMI_Handler(void)
{
}
/**
* @brief this function handles hard fault exception.
* @param none
* @retval none
*/
void HardFault_Handler(void)
{
/* go to infinite loop when hard fault exception occurs */
while(1)
{
}
}
/**
* @brief this function handles memory manage exception.
* @param none
* @retval none
*/
void MemManage_Handler(void)
{
/* go to infinite loop when memory manage exception occurs */
while(1)
{
}
}
/**
* @brief this function handles bus fault exception.
* @param none
* @retval none
*/
void BusFault_Handler(void)
{
/* go to infinite loop when bus fault exception occurs */
while(1)
{
}
}
/**
* @brief this function handles usage fault exception.
* @param none
* @retval none
*/
void UsageFault_Handler(void)
{
/* go to infinite loop when usage fault exception occurs */
while(1)
{
}
}
/**
* @brief this function handles svcall exception.
* @param none
* @retval none
*/
void SVC_Handler(void)
{
}
/**
* @brief this function handles debug monitor exception.
* @param none
* @retval none
*/
void DebugMon_Handler(void)
{
}
/**
* @brief this function handles pendsv_handler exception.
* @param none
* @retval none
*/
void PendSV_Handler(void)
{
}
/**
* @brief this function handles systick handler.
* @param none
* @retval none
*/
void SysTick_Handler(void)
{
}
/**
* @}
*/
/**
* @}
*/
/**
**************************************************************************
* @file at32f415_int.c
* @brief main interrupt service routines.
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* includes ------------------------------------------------------------------*/
#include "at32f415_int.h"
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_USB_host_cdc
* @{
*/
/**
* @brief this function handles nmi exception.
* @param none
* @retval none
*/
void NMI_Handler(void)
{
}
/**
* @brief this function handles hard fault exception.
* @param none
* @retval none
*/
void HardFault_Handler(void)
{
/* go to infinite loop when hard fault exception occurs */
while(1)
{
}
}
/**
* @brief this function handles memory manage exception.
* @param none
* @retval none
*/
void MemManage_Handler(void)
{
/* go to infinite loop when memory manage exception occurs */
while(1)
{
}
}
/**
* @brief this function handles bus fault exception.
* @param none
* @retval none
*/
void BusFault_Handler(void)
{
/* go to infinite loop when bus fault exception occurs */
while(1)
{
}
}
/**
* @brief this function handles usage fault exception.
* @param none
* @retval none
*/
void UsageFault_Handler(void)
{
/* go to infinite loop when usage fault exception occurs */
while(1)
{
}
}
/**
* @brief this function handles svcall exception.
* @param none
* @retval none
*/
void SVC_Handler(void)
{
}
/**
* @brief this function handles debug monitor exception.
* @param none
* @retval none
*/
void DebugMon_Handler(void)
{
}
/**
* @brief this function handles pendsv_handler exception.
* @param none
* @retval none
*/
void PendSV_Handler(void)
{
}
/**
* @brief this function handles systick handler.
* @param none
* @retval none
*/
void SysTick_Handler(void)
{
}
/**
* @}
*/
/**
* @}
*/

View File

@@ -1,285 +1,283 @@
/**
**************************************************************************
* @file main.c
* @version v2.0.7
* @date 2022-08-16
* @brief main program
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
#include "at32f415_board.h"
#include "at32f415_clock.h"
#include "usb_conf.h"
#include "usb_core.h"
#include "usbh_int.h"
#include "usbh_user.h"
#include "usbh_cdc_class.h"
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_USB_host_cdc USB_host_cdc
* @{
*/
/* usb global struct define */
otg_core_type otg_core_struct;
void usb_clock48m_select(usb_clk48_s clk_s);
void usb_gpio_config(void);
void usb_low_power_wakeup_config(void);
uint32_t tx_data[16] = {0};
uint32_t rx_data[16];
/**
* @brief main function.
* @param none
* @retval none
*/
int main(void)
{
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
system_clock_config();
at32_board_init();
/* usb gpio config */
usb_gpio_config();
#ifdef USB_LOW_POWER_WAKUP
usb_low_power_wakeup_config();
#endif
uart_print_init(115200);
/* enable otgfs clock */
crm_periph_clock_enable(OTG_CLOCK, TRUE);
/* select usb 48m clcok source */
usb_clock48m_select(USB_CLK_HEXT);
/* enable otgfs irq */
nvic_irq_enable(OTG_IRQ, 0, 0);
/* init usb */
usbh_init(&otg_core_struct,
USB_FULL_SPEED_CORE_ID,
USB_ID,
&uhost_cdc_class_handler,
&usbh_user_handle);
while(1)
{
usbh_loop_handler(&otg_core_struct.host);
/* if press user key, host send data to device */
if(at32_button_press() == USER_BUTTON)
{
cdc_start_transmission(&otg_core_struct.host, (uint8_t *)tx_data, 60);
cdc_start_reception(&otg_core_struct.host, (uint8_t *)rx_data, 64);
}
}
}
/**
* @brief usb host cdc class transmit complete
* @param uhost: to the structure of usbh_core_type
* @retval status: usb_sts_type status
*/
void cdc_transmit_complete(usbh_core_type *uhost)
{
tx_data[0] ++;
cdc_start_transmission(&otg_core_struct.host, (uint8_t *)tx_data, 60);
}
/**
* @brief usb host cdc class reception complete
* @param uhost: to the structure of usbh_core_type
* @retval status: usb_sts_type status
*/
void cdc_receive_complete(usbh_core_type *uhost)
{
usbh_core_type *puhost = (usbh_core_type *)uhost;
usbh_cdc_type *pcdc = (usbh_cdc_type *)puhost->class_handler->pdata;
if(uhost->hch[pcdc->data_interface.in_channel].trans_count != 0)
{
USBH_DEBUG("%x", rx_data[0]);
}
cdc_start_reception(&otg_core_struct.host, (uint8_t *)rx_data, 64);
}
/**
* @brief usb 48M clock select
* @param clk_s:USB_CLK_HICK, USB_CLK_HEXT
* @retval none
*/
void usb_clock48m_select(usb_clk48_s clk_s)
{
switch(system_core_clock)
{
/* 48MHz */
case 48000000:
crm_usb_clock_div_set(CRM_USB_DIV_1);
break;
/* 72MHz */
case 72000000:
crm_usb_clock_div_set(CRM_USB_DIV_1_5);
break;
/* 96MHz */
case 96000000:
crm_usb_clock_div_set(CRM_USB_DIV_2);
break;
/* 120MHz */
case 120000000:
crm_usb_clock_div_set(CRM_USB_DIV_2_5);
break;
/* 144MHz */
case 144000000:
crm_usb_clock_div_set(CRM_USB_DIV_3);
break;
default:
break;
}
}
/**
* @brief this function config gpio.
* @param none
* @retval none
*/
void usb_gpio_config(void)
{
gpio_init_type gpio_init_struct;
crm_periph_clock_enable(OTG_PIN_GPIO_CLOCK, TRUE);
gpio_default_para_init(&gpio_init_struct);
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
#ifdef USB_SOF_OUTPUT_ENABLE
crm_periph_clock_enable(OTG_PIN_SOF_GPIO_CLOCK, TRUE);
gpio_init_struct.gpio_pins = OTG_PIN_SOF;
gpio_init(OTG_PIN_SOF_GPIO, &gpio_init_struct);
#endif
/* otgfs use vbus pin */
#ifndef USB_VBUS_IGNORE
gpio_init_struct.gpio_pins = OTG_PIN_VBUS;
gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
gpio_init(OTG_PIN_GPIO, &gpio_init_struct);
#endif
#ifdef USBH_5V_POWER_SWITCH
crm_periph_clock_enable(OTG_PIN_POWER_SWITCH_CLOCK, TRUE);
gpio_bits_set(OTG_PIN_POWER_SWITCH_GPIO, OTG_PIN_POWER_SWITCH);
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
gpio_init_struct.gpio_pins = OTG_PIN_POWER_SWITCH;
gpio_init(OTG_PIN_POWER_SWITCH_GPIO, &gpio_init_struct);
#endif
}
#ifdef USB_LOW_POWER_WAKUP
/**
* @brief usb low power wakeup interrupt config
* @param none
* @retval none
*/
void usb_low_power_wakeup_config(void)
{
exint_init_type exint_init_struct;
exint_default_para_init(&exint_init_struct);
exint_init_struct.line_enable = TRUE;
exint_init_struct.line_mode = EXINT_LINE_INTERRUPUT;
exint_init_struct.line_select = OTG_WKUP_EXINT_LINE;
exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
exint_init(&exint_init_struct);
nvic_irq_enable(OTG_WKUP_IRQ, 0, 0);
}
/**
* @brief this function handles otgfs wakup interrupt.
* @param none
* @retval none
*/
void OTG_WKUP_HANDLER(void)
{
exint_flag_clear(OTG_WKUP_EXINT_LINE);
}
#endif
/**
* @brief this function handles otgfs interrupt.
* @param none
* @retval none
*/
void OTG_IRQ_HANDLER(void)
{
usbh_irq_handler(&otg_core_struct);
}
/**
* @brief usb delay millisecond function.
* @param ms: number of millisecond delay
* @retval none
*/
void usb_delay_ms(uint32_t ms)
{
/* user can define self delay function */
delay_ms(ms);
}
/**
* @brief usb delay microsecond function.
* @param us: number of microsecond delay
* @retval none
*/
void usb_delay_us(uint32_t us)
{
delay_us(us);
}
/**
* @}
*/
/**
* @}
*/
/**
**************************************************************************
* @file main.c
* @brief main program
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
#include "at32f415_board.h"
#include "at32f415_clock.h"
#include "usb_conf.h"
#include "usb_core.h"
#include "usbh_int.h"
#include "usbh_user.h"
#include "usbh_cdc_class.h"
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_USB_host_cdc USB_host_cdc
* @{
*/
/* usb global struct define */
otg_core_type otg_core_struct;
void usb_clock48m_select(usb_clk48_s clk_s);
void usb_gpio_config(void);
void usb_low_power_wakeup_config(void);
uint32_t tx_data[16] = {0};
uint32_t rx_data[16];
/**
* @brief main function.
* @param none
* @retval none
*/
int main(void)
{
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
system_clock_config();
at32_board_init();
/* usb gpio config */
usb_gpio_config();
#ifdef USB_LOW_POWER_WAKUP
usb_low_power_wakeup_config();
#endif
uart_print_init(115200);
/* enable otgfs clock */
crm_periph_clock_enable(OTG_CLOCK, TRUE);
/* select usb 48m clcok source */
usb_clock48m_select(USB_CLK_HEXT);
/* enable otgfs irq */
nvic_irq_enable(OTG_IRQ, 0, 0);
/* init usb */
usbh_init(&otg_core_struct,
USB_FULL_SPEED_CORE_ID,
USB_ID,
&uhost_cdc_class_handler,
&usbh_user_handle);
while(1)
{
usbh_loop_handler(&otg_core_struct.host);
/* if press user key, host send data to device */
if(at32_button_press() == USER_BUTTON)
{
cdc_start_transmission(&otg_core_struct.host, (uint8_t *)tx_data, 60);
cdc_start_reception(&otg_core_struct.host, (uint8_t *)rx_data, 64);
}
}
}
/**
* @brief usb host cdc class transmit complete
* @param uhost: to the structure of usbh_core_type
* @retval status: usb_sts_type status
*/
void cdc_transmit_complete(usbh_core_type *uhost)
{
tx_data[0] ++;
cdc_start_transmission(&otg_core_struct.host, (uint8_t *)tx_data, 60);
}
/**
* @brief usb host cdc class reception complete
* @param uhost: to the structure of usbh_core_type
* @retval status: usb_sts_type status
*/
void cdc_receive_complete(usbh_core_type *uhost)
{
usbh_core_type *puhost = (usbh_core_type *)uhost;
usbh_cdc_type *pcdc = (usbh_cdc_type *)puhost->class_handler->pdata;
if(uhost->hch[pcdc->data_interface.in_channel].trans_count != 0)
{
USBH_DEBUG("%x", rx_data[0]);
}
cdc_start_reception(&otg_core_struct.host, (uint8_t *)rx_data, 64);
}
/**
* @brief usb 48M clock select
* @param clk_s:USB_CLK_HICK, USB_CLK_HEXT
* @retval none
*/
void usb_clock48m_select(usb_clk48_s clk_s)
{
switch(system_core_clock)
{
/* 48MHz */
case 48000000:
crm_usb_clock_div_set(CRM_USB_DIV_1);
break;
/* 72MHz */
case 72000000:
crm_usb_clock_div_set(CRM_USB_DIV_1_5);
break;
/* 96MHz */
case 96000000:
crm_usb_clock_div_set(CRM_USB_DIV_2);
break;
/* 120MHz */
case 120000000:
crm_usb_clock_div_set(CRM_USB_DIV_2_5);
break;
/* 144MHz */
case 144000000:
crm_usb_clock_div_set(CRM_USB_DIV_3);
break;
default:
break;
}
}
/**
* @brief this function config gpio.
* @param none
* @retval none
*/
void usb_gpio_config(void)
{
gpio_init_type gpio_init_struct;
crm_periph_clock_enable(OTG_PIN_GPIO_CLOCK, TRUE);
gpio_default_para_init(&gpio_init_struct);
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
#ifdef USB_SOF_OUTPUT_ENABLE
crm_periph_clock_enable(OTG_PIN_SOF_GPIO_CLOCK, TRUE);
gpio_init_struct.gpio_pins = OTG_PIN_SOF;
gpio_init(OTG_PIN_SOF_GPIO, &gpio_init_struct);
#endif
/* otgfs use vbus pin */
#ifndef USB_VBUS_IGNORE
gpio_init_struct.gpio_pins = OTG_PIN_VBUS;
gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
gpio_init(OTG_PIN_GPIO, &gpio_init_struct);
#endif
#ifdef USBH_5V_POWER_SWITCH
crm_periph_clock_enable(OTG_PIN_POWER_SWITCH_CLOCK, TRUE);
gpio_bits_set(OTG_PIN_POWER_SWITCH_GPIO, OTG_PIN_POWER_SWITCH);
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
gpio_init_struct.gpio_pins = OTG_PIN_POWER_SWITCH;
gpio_init(OTG_PIN_POWER_SWITCH_GPIO, &gpio_init_struct);
#endif
}
#ifdef USB_LOW_POWER_WAKUP
/**
* @brief usb low power wakeup interrupt config
* @param none
* @retval none
*/
void usb_low_power_wakeup_config(void)
{
exint_init_type exint_init_struct;
exint_default_para_init(&exint_init_struct);
exint_init_struct.line_enable = TRUE;
exint_init_struct.line_mode = EXINT_LINE_INTERRUPUT;
exint_init_struct.line_select = OTG_WKUP_EXINT_LINE;
exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
exint_init(&exint_init_struct);
nvic_irq_enable(OTG_WKUP_IRQ, 0, 0);
}
/**
* @brief this function handles otgfs wakup interrupt.
* @param none
* @retval none
*/
void OTG_WKUP_HANDLER(void)
{
exint_flag_clear(OTG_WKUP_EXINT_LINE);
}
#endif
/**
* @brief this function handles otgfs interrupt.
* @param none
* @retval none
*/
void OTG_IRQ_HANDLER(void)
{
usbh_irq_handler(&otg_core_struct);
}
/**
* @brief usb delay millisecond function.
* @param ms: number of millisecond delay
* @retval none
*/
void usb_delay_ms(uint32_t ms)
{
/* user can define self delay function */
delay_ms(ms);
}
/**
* @brief usb delay microsecond function.
* @param us: number of microsecond delay
* @retval none
*/
void usb_delay_us(uint32_t us)
{
delay_us(us);
}
/**
* @}
*/
/**
* @}
*/

View File

@@ -1,246 +1,244 @@
/**
**************************************************************************
* @file usbh_user.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb user function
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
#include "usbh_user.h"
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_USB_host_cdc
* @{
*/
static usb_sts_type usbh_user_init(void);
static usb_sts_type usbh_user_reset(void);
static usb_sts_type usbh_user_attached(void);
static usb_sts_type usbh_user_disconnect(void);
static usb_sts_type usbh_user_speed(uint8_t speed);
static usb_sts_type usbh_user_mfc_string(void *string);
static usb_sts_type usbh_user_product_string(void *string);
static usb_sts_type usbh_user_serial_string(void *string);
static usb_sts_type usbh_user_enumeration_done(void);
static usb_sts_type usbh_user_application(void);
static usb_sts_type usbh_user_active_vbus(void *uhost, confirm_state state);
static usb_sts_type usbh_user_not_support(void);
usbh_user_handler_type usbh_user_handle =
{
usbh_user_init,
usbh_user_reset,
usbh_user_attached,
usbh_user_disconnect,
usbh_user_speed,
usbh_user_mfc_string,
usbh_user_product_string,
usbh_user_serial_string,
usbh_user_enumeration_done,
usbh_user_application,
usbh_user_active_vbus,
usbh_user_not_support,
};
typedef enum
{
USR_IDLE,
USR_APP,
USR_FINISH
}cdc_usr_state;
cdc_usr_state usr_state = USR_IDLE;
/**
* @brief usb host init user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_init(void)
{
usb_sts_type status = USB_OK;
return status;
}
/**
* @brief usb host reset user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_reset(void)
{
usb_sts_type status = USB_OK;
return status;
}
/**
* @brief usb host check device attached
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_attached(void)
{
usb_sts_type status = USB_OK;
USBH_DEBUG("USB Device Attached");
return status;
}
/**
* @brief usb host discconet user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_disconnect(void)
{
usb_sts_type status = USB_OK;
usr_state = USR_IDLE;
USBH_DEBUG("Device Disconnect");
return status;
}
/**
* @brief usb host speed user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_speed(uint8_t speed)
{
usb_sts_type status = USB_OK;
if(speed == USB_PRTSPD_FULL_SPEED)
{
USBH_DEBUG("This is a Full-Speed device");
}
else if(speed == USB_PRTSPD_LOW_SPEED)
{
USBH_DEBUG("This is a Low-Speed device");
}
return status;
}
/**
* @brief usb host manufacturer string user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_mfc_string(void *string)
{
usb_sts_type status = USB_OK;
USBH_DEBUG("Manufacturer: %s", (uint8_t *)string);
return status;
}
/**
* @brief usb host product string user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_product_string(void *string)
{
usb_sts_type status = USB_OK;
USBH_DEBUG("Product: %s", (uint8_t *)string);
return status;
}
/**
* @brief usb host serial string user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_serial_string(void *string)
{
usb_sts_type status = USB_OK;
USBH_DEBUG("Serial: %s", (uint8_t *)string);
return status;
}
/**
* @brief usb host enumeration done user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_enumeration_done(void)
{
usb_sts_type status = USB_OK;
USBH_DEBUG("Enumeration done");
return status;
}
/**
* @brief usb host application user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_application(void)
{
usb_sts_type status = USB_OK;
return status;
}
/**
* @brief usb host active vbus user handler
* @param uhost: to the structure of usbh_core_type
* @param state: vbus state
TRUE: active vbus
FALSE: deactive vbus
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_active_vbus(void *uhost, confirm_state state)
{
usb_sts_type status = USB_OK;
#ifdef USBH_5V_POWER_SWITCH
if(state == TRUE)
{
/* active vbus */
gpio_bits_reset(OTG_PIN_POWER_SWITCH_GPIO, OTG_PIN_POWER_SWITCH);
}
else
{
/* deactive vubs */
gpio_bits_set(OTG_PIN_POWER_SWITCH_GPIO, OTG_PIN_POWER_SWITCH);
}
#endif
return status;
}
/**
* @brief usb host not support user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_not_support(void)
{
usb_sts_type status = USB_OK;
return status;
}
/**
* @}
*/
/**
* @}
*/
/**
**************************************************************************
* @file usbh_user.c
* @brief usb user function
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
#include "usbh_user.h"
/** @addtogroup AT32F415_periph_examples
* @{
*/
/** @addtogroup 415_USB_host_cdc
* @{
*/
static usb_sts_type usbh_user_init(void);
static usb_sts_type usbh_user_reset(void);
static usb_sts_type usbh_user_attached(void);
static usb_sts_type usbh_user_disconnect(void);
static usb_sts_type usbh_user_speed(uint8_t speed);
static usb_sts_type usbh_user_mfc_string(void *string);
static usb_sts_type usbh_user_product_string(void *string);
static usb_sts_type usbh_user_serial_string(void *string);
static usb_sts_type usbh_user_enumeration_done(void);
static usb_sts_type usbh_user_application(void);
static usb_sts_type usbh_user_active_vbus(void *uhost, confirm_state state);
static usb_sts_type usbh_user_not_support(void);
usbh_user_handler_type usbh_user_handle =
{
usbh_user_init,
usbh_user_reset,
usbh_user_attached,
usbh_user_disconnect,
usbh_user_speed,
usbh_user_mfc_string,
usbh_user_product_string,
usbh_user_serial_string,
usbh_user_enumeration_done,
usbh_user_application,
usbh_user_active_vbus,
usbh_user_not_support,
};
typedef enum
{
USR_IDLE,
USR_APP,
USR_FINISH
}cdc_usr_state;
cdc_usr_state usr_state = USR_IDLE;
/**
* @brief usb host init user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_init(void)
{
usb_sts_type status = USB_OK;
return status;
}
/**
* @brief usb host reset user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_reset(void)
{
usb_sts_type status = USB_OK;
return status;
}
/**
* @brief usb host check device attached
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_attached(void)
{
usb_sts_type status = USB_OK;
USBH_DEBUG("USB Device Attached");
return status;
}
/**
* @brief usb host discconet user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_disconnect(void)
{
usb_sts_type status = USB_OK;
usr_state = USR_IDLE;
USBH_DEBUG("Device Disconnect");
return status;
}
/**
* @brief usb host speed user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_speed(uint8_t speed)
{
usb_sts_type status = USB_OK;
if(speed == USB_PRTSPD_FULL_SPEED)
{
USBH_DEBUG("This is a Full-Speed device");
}
else if(speed == USB_PRTSPD_LOW_SPEED)
{
USBH_DEBUG("This is a Low-Speed device");
}
return status;
}
/**
* @brief usb host manufacturer string user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_mfc_string(void *string)
{
usb_sts_type status = USB_OK;
USBH_DEBUG("Manufacturer: %s", (uint8_t *)string);
return status;
}
/**
* @brief usb host product string user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_product_string(void *string)
{
usb_sts_type status = USB_OK;
USBH_DEBUG("Product: %s", (uint8_t *)string);
return status;
}
/**
* @brief usb host serial string user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_serial_string(void *string)
{
usb_sts_type status = USB_OK;
USBH_DEBUG("Serial: %s", (uint8_t *)string);
return status;
}
/**
* @brief usb host enumeration done user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_enumeration_done(void)
{
usb_sts_type status = USB_OK;
USBH_DEBUG("Enumeration done");
return status;
}
/**
* @brief usb host application user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_application(void)
{
usb_sts_type status = USB_OK;
return status;
}
/**
* @brief usb host active vbus user handler
* @param uhost: to the structure of usbh_core_type
* @param state: vbus state
TRUE: active vbus
FALSE: deactive vbus
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_active_vbus(void *uhost, confirm_state state)
{
usb_sts_type status = USB_OK;
#ifdef USBH_5V_POWER_SWITCH
if(state == TRUE)
{
/* active vbus */
gpio_bits_reset(OTG_PIN_POWER_SWITCH_GPIO, OTG_PIN_POWER_SWITCH);
}
else
{
/* deactive vubs */
gpio_bits_set(OTG_PIN_POWER_SWITCH_GPIO, OTG_PIN_POWER_SWITCH);
}
#endif
return status;
}
/**
* @brief usb host not support user handler
* @param none
* @retval usb_sts_type
*/
static usb_sts_type usbh_user_not_support(void)
{
usb_sts_type status = USB_OK;
return status;
}
/**
* @}
*/
/**
* @}
*/

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file at32f415_clock.h
* @version v2.0.7
* @date 2022-08-16
* @brief header file of clock program
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file at32f415_conf.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f415 config header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file at32f415_int.h
* @version v2.0.7
* @date 2022-08-16
* @brief header file of main interrupt service routines.
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usb_conf.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb config header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbh_user.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb host user header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -10,9 +10,9 @@
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt>
<tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp</CppX>
<CppX>*.cpp; *.cc; *.cxx</CppX>
<nMigrate>0</nMigrate>
</Extensions>

View File

@@ -16,7 +16,7 @@
<TargetCommonOption>
<Device>-AT32F415RCT7</Device>
<Vendor>ArteryTek</Vendor>
<PackID>ArteryTek.AT32F415_DFP.2.0.0</PackID>
<PackID>ArteryTek.AT32F415_DFP.2.0.6</PackID>
<Cpu>IRAM(0x20000000,0x8000) IROM(0x08000000,0x40000) CPUTYPE("Cortex-M4") CLOCK(12000000) ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
@@ -534,19 +534,4 @@
<files/>
</RTE>
<LayerInfo>
<Layers>
<Layer>
<LayName>&lt;Project Info&gt;</LayName>
<LayDesc></LayDesc>
<LayUrl></LayUrl>
<LayKeys></LayKeys>
<LayCat></LayCat>
<LayLic></LayLic>
<LayTarg>0</LayTarg>
<LayPrjMark>1</LayPrjMark>
</Layer>
</Layers>
</LayerInfo>
</Project>

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file readme.txt
* @version v2.0.7
* @date 2022-08-16
* @brief readme
**************************************************************************
*/
@@ -12,4 +10,4 @@
when an usb device is attached to the host port, the device is enumerated and
checked whether it can support hid device or not,the demo just support keyboard
and mouse device.
for more detailed information, please refer to the application note document AN0097.
for more detailed information, please refer to the application note document AN0097.

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file at32f415_clock.c
* @version v2.0.7
* @date 2022-08-16
* @brief system clock config program
**************************************************************************
* Copyright notice & Disclaimer
@@ -74,10 +72,10 @@ void system_clock_config(void)
/* config ahbclk */
crm_ahb_div_set(CRM_AHB_DIV_1);
/* config apb2clk */
/* config apb2clk, the maximum frequency of APB1/APB2 clock is 75 MHz */
crm_apb2_div_set(CRM_APB2_DIV_2);
/* config apb1clk */
/* config apb1clk, the maximum frequency of APB1/APB2 clock is 75 MHz */
crm_apb1_div_set(CRM_APB1_DIV_2);
/* enable auto step mode */

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file at32f415_int.c
* @version v2.0.7
* @date 2022-08-16
* @brief main interrupt service routines.
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file main.c
* @version v2.0.7
* @date 2022-08-16
* @brief main program
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbh_user.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb user function
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file at32f415_clock.h
* @version v2.0.7
* @date 2022-08-16
* @brief header file of clock program
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file at32f415_conf.h
* @version v2.0.7
* @date 2022-08-16
* @brief at32f415 config header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file at32f415_int.h
* @version v2.0.7
* @date 2022-08-16
* @brief header file of main interrupt service routines.
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usb_conf.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb config header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbh_user.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb host user header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -10,9 +10,9 @@
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt>
<tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp</CppX>
<CppX>*.cpp; *.cc; *.cxx</CppX>
<nMigrate>0</nMigrate>
</Extensions>

View File

@@ -16,7 +16,7 @@
<TargetCommonOption>
<Device>-AT32F415RCT7</Device>
<Vendor>ArteryTek</Vendor>
<PackID>ArteryTek.AT32F415_DFP.2.0.0</PackID>
<PackID>ArteryTek.AT32F415_DFP.2.0.6</PackID>
<Cpu>IRAM(0x20000000,0x8000) IROM(0x08000000,0x40000) CPUTYPE("Cortex-M4") CLOCK(12000000) ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
@@ -549,19 +549,4 @@
<files/>
</RTE>
<LayerInfo>
<Layers>
<Layer>
<LayName>&lt;Project Info&gt;</LayName>
<LayDesc></LayDesc>
<LayUrl></LayUrl>
<LayKeys></LayKeys>
<LayCat></LayCat>
<LayLic></LayLic>
<LayTarg>0</LayTarg>
<LayPrjMark>1</LayPrjMark>
</Layer>
</Layers>
</LayerInfo>
</Project>

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file readme.txt
* @version v2.0.7
* @date 2022-08-16
* @brief readme
**************************************************************************
*/
@@ -11,4 +9,4 @@
when an usb device is attached to the host port, the device is enumerated and
checked whether it msc device.
for more detailed information, please refer to the application note document AN0097.
for more detailed information, please refer to the application note document AN0097.

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file at32f415_clock.c
* @version v2.0.7
* @date 2022-08-16
* @brief system clock config program
**************************************************************************
* Copyright notice & Disclaimer
@@ -74,10 +72,10 @@ void system_clock_config(void)
/* config ahbclk */
crm_ahb_div_set(CRM_AHB_DIV_1);
/* config apb2clk */
/* config apb2clk, the maximum frequency of APB1/APB2 clock is 75 MHz */
crm_apb2_div_set(CRM_APB2_DIV_2);
/* config apb1clk */
/* config apb1clk, the maximum frequency of APB1/APB2 clock is 75 MHz */
crm_apb1_div_set(CRM_APB1_DIV_2);
/* enable auto step mode */

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file at32f415_int.c
* @version v2.0.7
* @date 2022-08-16
* @brief main interrupt service routines.
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file main.c
* @version v2.0.7
* @date 2022-08-16
* @brief main program
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbh_msc_diskio.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb mass storage disk io
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbh_user.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb user function
**************************************************************************
* Copyright notice & Disclaimer