ESP32S3 USB热拔插问题
Posted: Tue Nov 16, 2021 1:51 am
by sssgil
淘宝官方买的ESP32S3开发板,IDF用的master,参考demo写了一个usb打印机驱动,现在枚举和发送数据正常,但是热拔插有问题。具体就是DCD_EVENT_UNPLUGGED这个事件无法触发,一拔掉usb就会触发DCD_EVENT_SUSPEND事件,请问是什么原因还是我这边需要做什么处理
Re: ESP32S3 USB热拔插问题
Posted: Tue Nov 16, 2021 3:37 am
by ESP_Bob
请问是基于哪个 example
Re: ESP32S3 USB热拔插问题
Posted: Tue Nov 16, 2021 3:50 am
by sssgil
ESP_Bob wrote: ↑Tue Nov 16, 2021 3:37 am
请问是基于哪个 example
参考VENDOR的代码改的,不过感觉是不是跟参考哪个demo没关系?我看事件检测是定义在usbd.c当中,而且其中有这么一段话,是否跟这里有关,后继我会验证下demo是否能正常检测到拔插
case DCD_EVENT_SUSPEND:
// NOTE: When plugging/unplugging device, the D+/D- state are unstable and
// can accidentally meet the SUSPEND condition ( Bus Idle for 3ms ).
// In addition, some MCUs such as SAMD or boards that haven no VBUS detection cannot distinguish
// suspended vs disconnected. We will skip handling SUSPEND/RESUME event if not currently connected
if ( _usbd_dev.connected )
{
_usbd_dev.suspended = 1;
osal_queue_send(_usbd_q, event, in_isr);
}
break;