ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Пятница
13 июня
1524238 Топик полностью
klen (11.06.2025 12:26, просмотров: 34) ответил Nikolay_Po на Насчёт костыля для LinkE - в пакете USB_out USB_IN просто был другой байт, а остальные - те же, что и для строенного в отладочную плату CH549.
очень похоже вот на что 0x8x и 0x0x - это идентификаторы end-point's 

4. Endpoint addressing

Each endpoint has a unique address composed of a direction (IN or OUT) and an endpoint number to be defined in each endpoint descriptor. The endpoint address is an 8-bit value that contains both the endpoint number and the direction of data transfer. The format is as follows:

Bits 0-3: Endpoint number (0-15) if applicable.

Bit 7: Direction (0 for OUT, 1 for IN).

Bits 4-6: Reserved (usually set to 0).

Endpoint numbers typically range from 1 to 15 (0 is reserved for control endpoints). The definition of endpoint numbers must respect the order of classes instantiation. Here’s an example to initialize the endpoint address:


// Define endpoint addresses
#define EP1_OUT 0x01 // Endpoint 1, OUT direction
#define EP1_IN 0x81 // Endpoint 1, IN direction
#define EP2_OUT 0x02 // Endpoint 2, OUT direction
#define EP2_IN 0x82 // Endpoint 2, IN direction

// Initialize endpoint descriptors

USBD_EpDescTypedef ep1_out_descriptor = {
.bLength = 7, // Descriptor size
.bDescriptorType = 0x05, // Endpoint descriptor type
.bEndpointAddress = EP1_OUT,// Endpoint address
.bmAttributes = 0x02, // Bulk transfer type
.wMaxPacketSize = 64, // Maximum packet size (64 bytes)
.bInterval = 0 // Polling interval (ignored for bulk)
};