USB

usb_host模式下的PCD_HandleTypeDef问题

发布于 2021-04-29 14:50:41

使用env生成的MDK工程后,编译就报错,显示
..librariesHAL_Driversdrv_usbd.c(20): error: #20: identifier "PCD_HandleTypeDef" is undefined
static PCD_HandleTypeDef _stm_pcd;
..librariesHAL_Driversdrv_usbd.c(39): warning: #223-D: function "HAL_PCD_IRQHandler" declared implicitly

  HAL_PCD_IRQHandler(&_stm_pcd);

..librariesHAL_Driversdrv_usbd.c(44): error: #20: identifier "PCD_HandleTypeDef" is undefined
void HAL_PCD_ResetCallback(PCD_HandleTypeDef *pcd)
..librariesHAL_Driversdrv_usbd.c(47): warning: #223-D: function "HAL_PCD_EP_Open" declared implicitly

  HAL_PCD_EP_Open(pcd, 0x00, 0x40, EP_TYPE_CTRL);

..librariesHAL_Driversdrv_usbd.c(52): error: #20: identifier "PCD_HandleTypeDef" is undefined
void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd)
..librariesHAL_Driversdrv_usbd.c(57): error: #20: identifier "PCD_HandleTypeDef" is undefined
void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
..librariesHAL_Driversdrv_usbd.c(69): error: #20: identifier "PCD_HandleTypeDef" is undefined
void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd)
..librariesHAL_Driversdrv_usbd.c(74): error: #20: identifier "PCD_HandleTypeDef" is undefined
void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd)
..librariesHAL_Driversdrv_usbd.c(79): error: #20: identifier "PCD_HandleTypeDef" is undefined
void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd)
..librariesHAL_Driversdrv_usbd.c(84): error: #20: identifier "PCD_HandleTypeDef" is undefined

显示好多没有定义的错误,这是我直接通过menuconfig配置出来的,也不知道这些定义在哪里。

查看更多

关注者
0
被浏览
52
2 个回答
flashman2002
flashman2002 2021-04-29

PCD_HandleTypeDef类型没有定义。请你检查一下应在哪里被定义,添加相应的头文件即可。

Jone
Jone 2021-04-29

对应的外设宏定义HAL_PCD_MODULE_ENABLED没开启吧,在stm32xxx_hal_config.h文件中找找, xxx是你的芯片型号

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览