do{학습}while

USB2.0 속도 인식 오류 본문

TROUBLE SHOOTING

USB2.0 속도 인식 오류

하이오야이 2025. 8. 1. 10:09

문제 상황

시스템이 해당 디바이스를 **USB 1.1(Full Speed)**으로 인식하는 문제가 발생하였습니다. 결과적으로 데이터 전송 속도가 제한되어 실시간 영상 전송에 지연이 발생했습니다.

원인 분석

bcdUSB 설정 누락

  • /sys/kernel/config/usb_gadget/<gadget_name>/bcdUSB에 0x0200 값을 echo하지 않아, 기본값(USB 1.1)으로 인식됨.

디스크립터 정의 부족

  • High Speed 디스크립터만 선언하고 Full Speed 디스크립터를 누락함.
  • USB 호스트는 Dual-Speed 디바이스로 인식되려면 두 속도에 대한 디스크립터가 모두 정의되어 있어야 함.
You will notice we have not included speed identification for High Speed mode. High speed devices will start by connecting as a full speed device (1.5k to 3.3V). Once it has been attached, it will do a high speed chirp during reset and establish a high speed connection if the hub supports it. If the device operates in high speed mode, then the pull up resistor is removed to balance the line.

 

 

https://sge.frba.utn.edu.ar/upload/Materias/95-0435/archivos/usb-in-a-nutshell.pdf

USB 관련 문서에 따르면 처음 usb를 인식할때 high speed인지 full speed인지 모르는 상태에서 연결이 되는데

이때 먼저 full speed 디바이스로 의해 연결이 되고 high speed로 동작되게 된다고 명시되어 있습니다.

 

해결 방법

  • echo 0x0200 > /sys/kernel/config/usb_gadget/<gadget_name>/bcdUSB 명령어로 USB 2.0 명시 설정
echo 0x0200 > /sys/kernel/config/usb_gadget/mygadget/bcdUSB
  • Full Speed, High Speed 양쪽 디스크립터 모두 정의하여 호스트가 USB 2.0 모드로 인식 가능하도록 수정
#pragma pack(1)
struct __attribute__((packed)) usb_descs {
    struct usb_functionfs_descs_head_v2 header;
	__le32 fs_count;
    __le32 hs_count;
    struct {
        struct usb_interface_descriptor intf;
        struct usb_endpoint_descriptor_no_audio ep_in;
        struct usb_endpoint_descriptor_no_audio ep_out;
    } __attribute__((packed))fs_descs, hs_descs; //full speed, high speed 모두 선언
};
#pragma pack()