ESP32S3 USB热拔插问题

sssgil
Posts: 10
Joined: Tue Nov 16, 2021 1:41 am

ESP32S3 USB热拔插问题

Postby sssgil » Tue Nov 16, 2021 1:51 am

淘宝官方买的ESP32S3开发板,IDF用的master,参考demo写了一个usb打印机驱动,现在枚举和发送数据正常,但是热拔插有问题。具体就是DCD_EVENT_UNPLUGGED这个事件无法触发,一拔掉usb就会触发DCD_EVENT_SUSPEND事件,请问是什么原因还是我这边需要做什么处理

ESP_Bob
Posts: 80
Joined: Fri Nov 27, 2020 12:52 pm

Re: ESP32S3 USB热拔插问题

Postby ESP_Bob » Tue Nov 16, 2021 3:37 am

请问是基于哪个 example

sssgil
Posts: 10
Joined: Tue Nov 16, 2021 1:41 am

Re: ESP32S3 USB热拔插问题

Postby sssgil » Tue Nov 16, 2021 3:50 am

ESP_Bob wrote:
Tue Nov 16, 2021 3:37 am
请问是基于哪个 example
参考VENDOR的代码改的,不过感觉是不是跟参考哪个demo没关系?我看事件检测是定义在usbd.c当中,而且其中有这么一段话,是否跟这里有关,后继我会验证下demo是否能正常检测到拔插
  1.    
  2. case DCD_EVENT_SUSPEND:
  3.       // NOTE: When plugging/unplugging device, the D+/D- state are unstable and
  4.       // can accidentally meet the SUSPEND condition ( Bus Idle for 3ms ).
  5.       // In addition, some MCUs such as SAMD or boards that haven no VBUS detection cannot distinguish
  6.       // suspended vs disconnected. We will skip handling SUSPEND/RESUME event if not currently connected
  7.       if ( _usbd_dev.connected )
  8.       {
  9.         _usbd_dev.suspended = 1;
  10.         osal_queue_send(_usbd_q, event, in_isr);
  11.       }
  12.     break;

Who is online

Users browsing this forum: No registered users and 31 guests