STM32 CubeMX USB_MSC(存储设备U盘)

这篇具有很好参考价值的文章主要介绍了STM32 CubeMX USB_MSC(存储设备U盘)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

STM32 CubeMX




前言

STM32 CubeMX 配置USB将STM32设置可以作为存储设备或者IAP升级功能

《使用内部Flash》——U盘

一、STM32 CubeMX 设置

USB时钟设置

stm32 u盘,STM32 CubeMX,stm32,嵌入式硬件,单片机

USB使能

stm32 u盘,STM32 CubeMX,stm32,嵌入式硬件,单片机

UBS功能选择

要注意:stm32f103c8t6内部Flash的1页为1024(1kb)
stm32 u盘,STM32 CubeMX,stm32,嵌入式硬件,单片机

FATFS功能

stm32 u盘,STM32 CubeMX,stm32,嵌入式硬件,单片机

二、代码部分

需要修改两个部分:usbd_storage_if.c文件和user_diskio.c文件
stm32 u盘,STM32 CubeMX,stm32,嵌入式硬件,单片机

修改代码"usbd_storage_if.c"

/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : usbd_storage_if.c
  * @version        : v2.0_Cube
  * @brief          : Memory management layer.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2023 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_storage_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.
  * @{
  */

/** @defgroup USBD_STORAGE
  * @brief Usb mass storage device module
  * @{
  */

/** @defgroup USBD_STORAGE_Private_TypesDefinitions
  * @brief Private types.
  * @{
  */

/* USER CODE BEGIN PRIVATE_TYPES */

/* USER CODE END PRIVATE_TYPES */

/**
  * @}
  */

/** @defgroup USBD_STORAGE_Private_Defines
  * @brief Private defines.
  * @{
  */
#define     FLASH_SIZE                  128
#define     FMC_SECTOR_SIZE             1024
#define     FLASH_PAGE_NBR              64
#define     FLASH_START_ADDR        	(0x08000000+((FLASH_SIZE-FLASH_PAGE_NBR)*1024))

#define STORAGE_LUN_NBR                  1
#define STORAGE_BLK_NBR                  0x10000
#define STORAGE_BLK_SIZ                  0x200

/* USER CODE BEGIN PRIVATE_DEFINES */

/* USER CODE END PRIVATE_DEFINES */

/**
  * @}
  */

/** @defgroup USBD_STORAGE_Private_Macros
  * @brief Private macros.
  * @{
  */

/* USER CODE BEGIN PRIVATE_MACRO */

/* USER CODE END PRIVATE_MACRO */

/**
  * @}
  */

/** @defgroup USBD_STORAGE_Private_Variables
  * @brief Private variables.
  * @{
  */

/* USER CODE BEGIN INQUIRY_DATA_FS */
/** USB Mass storage Standard Inquiry Data. */
const int8_t STORAGE_Inquirydata_FS[] = {/* 36 */

  /* LUN 0 */
  0x00,
  0x80,
  0x02,
  0x02,
  (STANDARD_INQUIRY_DATA_LEN - 5),
  0x00,
  0x00,
  0x00,
  'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ', /* Manufacturer : 8 bytes */
  'P', 'r', 'o', 'd', 'u', 'c', 't', ' ', /* Product      : 16 Bytes */
  ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
  '0', '.', '0' ,'1'                      /* Version      : 4 Bytes */
};
/* USER CODE END INQUIRY_DATA_FS */

/* USER CODE BEGIN PRIVATE_VARIABLES */

/* USER CODE END PRIVATE_VARIABLES */

/**
  * @}
  */

/** @defgroup USBD_STORAGE_Exported_Variables
  * @brief Public variables.
  * @{
  */

extern USBD_HandleTypeDef hUsbDeviceFS;

/* USER CODE BEGIN EXPORTED_VARIABLES */

/* USER CODE END EXPORTED_VARIABLES */

/**
  * @}
  */

/** @defgroup USBD_STORAGE_Private_FunctionPrototypes
  * @brief Private functions declaration.
  * @{
  */

static int8_t STORAGE_Init_FS(uint8_t lun);
static int8_t STORAGE_GetCapacity_FS(uint8_t lun, uint32_t *block_num, uint16_t *block_size);
static int8_t STORAGE_IsReady_FS(uint8_t lun);
static int8_t STORAGE_IsWriteProtected_FS(uint8_t lun);
static int8_t STORAGE_Read_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
static int8_t STORAGE_Write_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
static int8_t STORAGE_GetMaxLun_FS(void);

/* USER CODE BEGIN PRIVATE_FUNCTIONS_DECLARATION */

/* USER CODE END PRIVATE_FUNCTIONS_DECLARATION */

/**
  * @}
  */

USBD_StorageTypeDef USBD_Storage_Interface_fops_FS =
{
  STORAGE_Init_FS,
  STORAGE_GetCapacity_FS,
  STORAGE_IsReady_FS,
  STORAGE_IsWriteProtected_FS,
  STORAGE_Read_FS,
  STORAGE_Write_FS,
  STORAGE_GetMaxLun_FS,
  (int8_t *)STORAGE_Inquirydata_FS
};

/* Private functions ---------------------------------------------------------*/
/**
  * @brief  Initializes over USB FS IP
  * @param  lun:
  * @retval USBD_OK if all operations are OK else USBD_FAIL
  */
int8_t STORAGE_Init_FS(uint8_t lun)
{
  /* USER CODE BEGIN 2 */
  return (USBD_OK);
  /* USER CODE END 2 */
}

/**
  * @brief  .
  * @param  lun: .
  * @param  block_num: .
  * @param  block_size: .
  * @retval USBD_OK if all operations are OK else USBD_FAIL
  */
//int8_t STORAGE_GetCapacity_FS(uint8_t lun, uint32_t *block_num, uint16_t *block_size)
//{
//  /* USER CODE BEGIN 3 */
//  *block_num  = STORAGE_BLK_NBR;
//  *block_size = STORAGE_BLK_SIZ;
//  return (USBD_OK);
//  /* USER CODE END 3 */
//}
//修改1
int8_t STORAGE_GetCapacity_FS(uint8_t lun, uint32_t *block_num, uint16_t *block_size)
{
  /* USER CODE BEGIN 3 */
  *block_num  = FLASH_PAGE_NBR;
  *block_size = FLASH_PAGE_SIZE;
  return (USBD_OK);
  /* USER CODE END 3 */
}
/**
  * @brief  .
  * @param  lun: .
  * @retval USBD_OK if all operations are OK else USBD_FAIL
  */
int8_t STORAGE_IsReady_FS(uint8_t lun)
{
  /* USER CODE BEGIN 4 */
  return (USBD_OK);
  /* USER CODE END 4 */
}

/**
  * @brief  .
  * @param  lun: .
  * @retval USBD_OK if all operations are OK else USBD_FAIL
  */
int8_t STORAGE_IsWriteProtected_FS(uint8_t lun)
{
  /* USER CODE BEGIN 5 */
  return (USBD_OK);
  /* USER CODE END 5 */
}

/**
  * @brief  .
  * @param  lun: .
  * @retval USBD_OK if all operations are OK else USBD_FAIL
  */
//int8_t STORAGE_Read_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
//{
//  /* USER CODE BEGIN 6 */
//  return (USBD_OK);
//  /* USER CODE END 6 */
//}
//修改2
int8_t STORAGE_Read_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
{
  /* USER CODE BEGIN 6 */
	if(lun == 0)
	{
        memcpy(buf,(uint8_t *)(FLASH_START_ADDR + blk_addr*FLASH_PAGE_SIZE),blk_len*FLASH_PAGE_SIZE);
        return USBD_OK;
    }
    return USBD_FAIL;
  /* USER CODE END 6 */
}
/**
  * @brief  .
  * @param  lun: .
  * @retval USBD_OK if all operations are OK else USBD_FAIL
  */
//int8_t STORAGE_Write_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
//{
//  /* USER CODE BEGIN 7 */
//  return (USBD_OK);
//  /* USER CODE END 7 */
//}
//修改3
int8_t STORAGE_Write_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
{
  /* USER CODE BEGIN 7 */
    uint16_t i;
    uint32_t PageError = 0;
    FLASH_EraseInitTypeDef Flash;
    if(lun == 0)
    {
		HAL_FLASH_Unlock();
		Flash.TypeErase = FLASH_TYPEERASE_PAGES;
		Flash.PageAddress = FLASH_START_ADDR + blk_addr*FLASH_PAGE_SIZE ;
		Flash.NbPages = blk_len;
		HAL_FLASHEx_Erase(&Flash, &PageError);
		for(i=0;i<blk_len*FLASH_PAGE_SIZE;i+=4)
		{
            HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD,FLASH_START_ADDR + blk_addr*FLASH_PAGE_SIZE + i , *(uint32_t *)(&buf[i]));
        }
		HAL_FLASH_Lock();
		return USBD_OK;
    }
    return USBD_FAIL;
  /* USER CODE END 7 */
}

/**
  * @brief  .
  * @param  None
  * @retval .
  */
int8_t STORAGE_GetMaxLun_FS(void)
{
  /* USER CODE BEGIN 8 */
  return (STORAGE_LUN_NBR - 1);
  /* USER CODE END 8 */
}

/* USER CODE BEGIN PRIVATE_FUNCTIONS_IMPLEMENTATION */

/* USER CODE END PRIVATE_FUNCTIONS_IMPLEMENTATION */

/**
  * @}
  */

/**
  * @}
  */


修改代码"user_diskio.c"

/* USER CODE BEGIN Header */
/**
 ******************************************************************************
  * @file    user_diskio.c
  * @brief   This file includes a diskio driver skeleton to be completed by the user.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2023 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 */

#ifdef USE_OBSOLETE_USER_CODE_SECTION_0
/*
 * Warning: the user section 0 is no more in use (starting from CubeMx version 4.16.0)
 * To be suppressed in the future.
 * Kept to ensure backward compatibility with previous CubeMx versions when
 * migrating projects.
 * User code previously added there should be copied in the new user sections before
 * the section contents can be deleted.
 */
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
#endif

/* USER CODE BEGIN DECL */

/* Includes ------------------------------------------------------------------*/
#include <string.h>
#include "ff_gen_drv.h"

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/

/* Private variables ---------------------------------------------------------*/
/* Disk status */
static volatile DSTATUS Stat = STA_NOINIT;
#define     FLASH_SIZE                  128
#define     FMC_SECTOR_SIZE             1024
#define     FLASH_PAGE_NBR              64
#define     FLASH_START_ADDR        	(0x08000000+((FLASH_SIZE-FLASH_PAGE_NBR)*1024))
/* USER CODE END DECL */

/* Private function prototypes -----------------------------------------------*/
DSTATUS USER_initialize (BYTE pdrv);
DSTATUS USER_status (BYTE pdrv);
DRESULT USER_read (BYTE pdrv, BYTE *buff, DWORD sector, UINT count);
#if _USE_WRITE == 1
  DRESULT USER_write (BYTE pdrv, const BYTE *buff, DWORD sector, UINT count);
#endif /* _USE_WRITE == 1 */
#if _USE_IOCTL == 1
  DRESULT USER_ioctl (BYTE pdrv, BYTE cmd, void *buff);
#endif /* _USE_IOCTL == 1 */

Diskio_drvTypeDef  USER_Driver =
{
  USER_initialize,
  USER_status,
  USER_read,
#if  _USE_WRITE
  USER_write,
#endif  /* _USE_WRITE == 1 */
#if  _USE_IOCTL == 1
  USER_ioctl,
#endif /* _USE_IOCTL == 1 */
};

/* Private functions ---------------------------------------------------------*/

/**
  * @brief  Initializes a Drive
  * @param  pdrv: Physical drive number (0..)
  * @retval DSTATUS: Operation status
  */
DSTATUS USER_initialize (
	BYTE pdrv           /* Physical drive nmuber to identify the drive */
)
{
  /* USER CODE BEGIN INIT */
    Stat = STA_NOINIT;
    return Stat;
  /* USER CODE END INIT */
}

/**
  * @brief  Gets Disk Status
  * @param  pdrv: Physical drive number (0..)
  * @retval DSTATUS: Operation status
  */
//DSTATUS USER_status (
//	BYTE pdrv       /* Physical drive number to identify the drive */
//)
//{
//  /* USER CODE BEGIN STATUS */
//    Stat = STA_NOINIT;
//    return Stat;
//  /* USER CODE END STATUS */
//}
// 修改1
DSTATUS USER_status (
	BYTE pdrv       /* Physical drive number to identify the drive */
)
{
  /* USER CODE BEGIN STATUS */
    Stat = STA_NOINIT;
    Stat &= ~STA_NOINIT;
    return Stat;
  /* USER CODE END STATUS */
}
/**
  * @brief  Reads Sector(s)
  * @param  pdrv: Physical drive number (0..)
  * @param  *buff: Data buffer to store read data
  * @param  sector: Sector address (LBA)
  * @param  count: Number of sectors to read (1..128)
  * @retval DRESULT: Operation result
  */
//DRESULT USER_read (
//	BYTE pdrv,      /* Physical drive nmuber to identify the drive */
//	BYTE *buff,     /* Data buffer to store read data */
//	DWORD sector,   /* Sector address in LBA */
//	UINT count      /* Number of sectors to read */
//)
//{
//  /* USER CODE BEGIN READ */
//    return RES_OK;
//  /* USER CODE END READ */
//}
//修改2
DRESULT USER_read (
	BYTE pdrv,      /* Physical drive nmuber to identify the drive */
	BYTE *buff,     /* Data buffer to store read data */
	DWORD sector,   /* Sector address in LBA */
	UINT count      /* Number of sectors to read */
)
{
  /* USER CODE BEGIN READ */
	uint8_t *s = (uint8_t *)(FLASH_START_ADDR);  
	s+=(sector*FMC_SECTOR_SIZE);
	for(int i=0; i<count*FMC_SECTOR_SIZE ;i++)
	{
		*(buff++) = *(s++ );
	}
    return RES_OK;
  /* USER CODE END READ */
}
/**
  * @brief  Writes Sector(s)
  * @param  pdrv: Physical drive number (0..)
  * @param  *buff: Data to be written
  * @param  sector: Sector address (LBA)
  * @param  count: Number of sectors to write (1..128)
  * @retval DRESULT: Operation result
  */
#if _USE_WRITE == 1
//DRESULT USER_write (
//	BYTE pdrv,          /* Physical drive nmuber to identify the drive */
//	const BYTE *buff,   /* Data to be written */
//	DWORD sector,       /* Sector address in LBA */
//	UINT count          /* Number of sectors to write */
//)
//{
//  /* USER CODE BEGIN WRITE */
//  /* USER CODE HERE */
//    return RES_OK;
//  /* USER CODE END WRITE */
//}
//修改3
DRESULT USER_write (
	BYTE pdrv,          /* Physical drive nmuber to identify the drive */
	const BYTE *buff,   /* Data to be written */
	DWORD sector,       /* Sector address in LBA */
	UINT count          /* Number of sectors to write */
)
{
  /* USER CODE BEGIN WRITE */
  /* USER CODE HERE */
    uint16_t i;	
    HAL_FLASH_Unlock();
	 
    FLASH_EraseInitTypeDef f;
    f.TypeErase = FLASH_TYPEERASE_PAGES;
    f.PageAddress = FLASH_START_ADDR + sector*FLASH_PAGE_SIZE ;
    f.NbPages = count;
    uint32_t PageError = 0;
    HAL_FLASHEx_Erase(&f, &PageError);
 
    for(i=0;i<count*FLASH_PAGE_SIZE;i+=4)
    HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD,FLASH_START_ADDR + sector*FLASH_PAGE_SIZE + i , *(uint32_t *)(&buff[i]));
 
    HAL_FLASH_Lock();
    return RES_OK;
  /* USER CODE END WRITE */
}
#endif /* _USE_WRITE == 1 */

/**
  * @brief  I/O control operation
  * @param  pdrv: Physical drive number (0..)
  * @param  cmd: Control code
  * @param  *buff: Buffer to send/receive control data
  * @retval DRESULT: Operation result
  */
#if _USE_IOCTL == 1
//DRESULT USER_ioctl (
//	BYTE pdrv,      /* Physical drive nmuber (0..) */
//	BYTE cmd,       /* Control code */
//	void *buff      /* Buffer to send/receive control data */
//)
//{
//  /* USER CODE BEGIN IOCTL */
//    DRESULT res = RES_ERROR;
//    return res;
//  /* USER CODE END IOCTL */
//}
//修改4
DRESULT USER_ioctl (
	BYTE pdrv,      /* Physical drive nmuber (0..) */
	BYTE cmd,       /* Control code */
	void *buff      /* Buffer to send/receive control data */
)
{
  /* USER CODE BEGIN IOCTL */
    DRESULT res = RES_ERROR;
  switch(cmd)
  {
    case CTRL_SYNC :
			res = RES_OK;
        break;	
 
    case CTRL_TRIM:
			res = RES_OK;
        break;
		
    case GET_BLOCK_SIZE:
	*(DWORD*)buff = 1; 
	break;
		
    case GET_SECTOR_SIZE:
	*(DWORD*)buff = FMC_SECTOR_SIZE;
        break;
		
    case GET_SECTOR_COUNT:
	*(DWORD*)buff =  FLASH_PAGE_NBR;
	break;
			
    default:
	res = RES_PARERR;
	break;
    }
    return res;
  /* USER CODE END IOCTL */
}
#endif /* _USE_IOCTL == 1 */


main函数初始化

int main(void)
{
  /* USER CODE BEGIN 1 */

    char path[4]= {"0:"};
    FRESULT FATFS_Status;	
  /* 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_FATFS_Init();
  MX_USB_DEVICE_Init();
  /* USER CODE BEGIN 2 */
    FATFS_Status = f_mount(&USERFatFS, path, 1);
    f_mkdir("0:/FW");
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

插上USB实验效果

stm32 u盘,STM32 CubeMX,stm32,嵌入式硬件,单片机
stm32 u盘,STM32 CubeMX,stm32,嵌入式硬件,单片机
新建一个TXT文档:
stm32 u盘,STM32 CubeMX,stm32,嵌入式硬件,单片机文章来源地址https://www.toymoban.com/news/detail-719382.html

《SPI_SD卡》——U盘

到了这里,关于STM32 CubeMX USB_MSC(存储设备U盘)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Ubuntu无法加载exfat的USB存储设备

    当接入设备USB存储设备提示: 不能挂在63GB 卷 Error mounting /dev/sdb1 at /media/ubuntu/83C9-26F4: Command-line `mount -t \\\"exfat\\\" -o \\\"uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,iocharset=utf8,namecase=0,errors=remount-ro,umask=0077\\\" \\\"/dev/sdb1\\\" \\\"/media/buntu/83C9-26F4\\\"\\\' exited with non-zero exit status 32: mount: unknown filesystem type \\\'e

    2024年02月09日
    浏览(50)
  • USB大容量存储设备无法启动该怎么办?

    USB大容量存储设备(USB mass storage device class,也称为USB MSC或UMS)是一个协议,允许一个USB接口的设备与电脑相连接,以便在两者之间传输文件。对于电脑来说,USB设备看起来就像一个移动硬盘,允许拖放型文件传送。它包括移动硬盘、闪存盘、移动光驱、读卡器、数码相机、

    2024年02月11日
    浏览(36)
  • 【FLASH】STM32内部Flash模拟EEPROM磨损均衡算法--存储设备擦写均衡自带掉电保护接口-如何在同等存储空间下增加FLASH寿命呢?往下看-STM32F334实现FLASH擦写均衡

    主要思想就是将FLASH 分配一块区域给我们的管理机,然后用索引的方式累积写FLASH,中途不进行擦写,在存满整个分区时进行统一擦写,读取根据ID进行读取,并且加上了数据校验,异常回调。主要用于存储系统配置,运行记录等。支持多个存储管理机管理不同的区域。   P

    2024年02月04日
    浏览(63)
  • STM32CubeMX学习笔记(46)——USB接口使用(HID自定义设备)

    USB(Universal Serial BUS)通用串行总线 ,是一个外部总线标准,用于规范电脑与外部设备的连接和通讯。是应用在 PC 领域的接口技术。USB 接口支持设备的即插即用和热插拔功能。USB 是在 1994 年底由英特尔、康柏、IBM、Microsoft 等多家公司联合提出的。 USB 发展到现在已经有 US

    2024年02月14日
    浏览(51)
  • stm32 USB复合设备 cubeMX库一键生成 多路CDC串口 HID鼠标键盘 Composite Device

    最近有个需求,需要同时用usb键盘鼠标和虚拟串口等,因为平时没怎么研究过usb协议,所以自己写复合设备一直没有成功,然后正巧在github上看到了一个stm32的一个usb复合设备库,可以快速配置usb组合设备,并且支持超级多路串口 Gihub地址 https://github.com/alambe94/I-CUBE-USBD-Compo

    2024年02月09日
    浏览(62)
  • 【完美解决】Windows下移动硬盘无法弹出 | 弹出USB大容量存储设备时出问题 | Windows无法停用设备 | \$Extend\$RmMetadata\$TxfLog\$TxfLog.blf

    使用U盘或者移动硬盘弹总是会遇到无法弹出的情况。此时windows往往不会告诉你具体是什么设备占用,只会提示: 弹出 USB 大容量存储设备 时出问题 或 Windows 无法停用“通用卷”设备,原因是某个程序正在使用它。关闭可能使用该设备的所有程序,然后稍后重试。 有时候我

    2024年02月11日
    浏览(63)
  • STM32F103C8用内部Flash做一个优盘(USB+MSC+FATFS)

    STM32F103C8用内部Flash做一个优盘(USB+MSC+FATFS),轻松实现APP升级、数据存储。 直接使用STM32CubeMX生成基本的工程,省得我们去调底层。 时钟配置为外部8MHz晶振,这个需要根据自己开发板的晶振选择。  启用SWD下载和滴答定时器  启用USB  启用FATFS,MAX_SS和MIN_SS设置为1024。  配

    2024年02月14日
    浏览(44)
  • STM32 CubeMX USB_CDC(USB_转串口)

    参考: STM32CubeMX学习笔记

    2024年02月14日
    浏览(44)
  • STM32 CubeMX USB_(HID 鼠标和键盘)

    STM32 CubeMX 自动生成的USB_HID是鼠标类型的:键盘类型要做一点小修改; 参考: STM32CubeMX学习笔记 USB鼠标HID描述符以及数据格式

    2024年02月14日
    浏览(35)
  • STM32 CubeMX配置USB HID功能,及安装路径

    STM32CubeMX学习笔记(46)——USB接口使用(HID自定义设备) STM32CubeMX实现STM32 USBHID双向64字节通信(下位机部分) STM32 USB HID设置(STM32CubeMX) 关于keil 5安装出现Fail to set path to Software Packs.问题解决方法

    2024年02月08日
    浏览(36)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包