对于PSDK代码中的BUL节点配置,可以参考以下流程,此前需要先配置好开发板的BULK节点,成功生成BULK以后,再执行以下步骤。
生成BULK节点后,可以将开发板的Device接口(一般是TypeC或Micro usb)连接到另一台Linux上,或连接到自身的Host接口,在另一台Linux上先使用lsusb查看下设备信息:
这里查看到设备的VID PID是0955:7020(不确定的话可以通过热插拔确认下)
然后通过lsusb -d VID:PID -v指令查看所有的usb节点。
leon@leon-virtual-machine:~$ lsusb -d 0955:7020 -v
Bus 002 Device 002: ID 0955:7020 NVIDIA Corp. L4T (Linux for Tegra) running on Tegra
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x0955 NVIDIA Corp.
idProduct 0x7020 L4T (Linux for Tegra) running on Tegra
bcdDevice 0.01
iManufacturer 1 raspberry
iProduct 2 PI4
iSerial 3 abcdefg1234567890
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0079
bNumInterfaces 4
bConfigurationValue 1
iConfiguration 4
bmAttributes 0x80
(Bus Powered)
MaxPower 250mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 6 Ethernet Networking
bFunctionProtocol 0
iFunction 7
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 255 Vendor Specific (MSFT RNDIS?)
iInterface 5
CDC Header:
bcdCDC 1.10
CDC Call Management:
bmCapabilities 0x00
bDataInterface 1
CDC ACM:
bmCapabilities 0x00
CDC Union:
bMasterInterface 0
bSlaveInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 9
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 6
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 9
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 10
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
然后可以对照下PSDK代码中的BULK配置(hal_usb_bulk.h)
首先我们要找出所有类型为BULK的节点,也就是Transfer Type为BULK的节点。
然后可以对照下关系,以BULK1为例,实际上BULK2也是一样的,代码中的
LINUX_USB_BULK1_INTERFACE_NUM 对应 bInterfaceNumber,
LINUX_USB_BULK1_END_POINT_IN 对应 bEndpointAddress *** IN
LINUX_USB_BULK1_END_POINT_OUT 对应 bEndpointAddress *** OUT (比如0x03填3)
以此处为例,找出所有BULK类型的节点,此处分别有0x81 0x83 0x84。
那么在代码中应该配置的为:
#define LINUX_USB_BULK1_INTERFACE_NUM (1)
#define LINUX_USB_BULK1_END_POINT_IN (0x81)
#define LINUX_USB_BULK1_END_POINT_OUT (1)
#define LINUX_USB_BULK1_INTERFACE_NUM (2)
#define LINUX_USB_BULK1_END_POINT_IN (0x83)
#define LINUX_USB_BULK1_END_POINT_OUT (2)
#define LINUX_USB_BULK1_INTERFACE_NUM (3)
#define LINUX_USB_BULK1_END_POINT_IN (0x84)
#define LINUX_USB_BULK1_END_POINT_OUT (3)
其次,需要注意bInterfaceClass参数,当参数为255 Vendor Specific Class时,才表示该节点为PSDK可用的BULK节点,因此,只有0x83、0x84节点才符合条件。
注意:BULK1和BULK2的节点不能够相同,必须分别配置不同的BULK节点。
此时可以使用liveview功能来验证。在以下两个函数中加入打印,然后在main.c中调用DjiTest_LiveviewRunSample,看是否有进入回调。
未进入回调说明bulk节点还有问题,需要更换下配置的节点,成功打印说明BULK1的节点已经没问题了。
BULK2节点可以通过下载媒体文件的方式来验证。DjiTest_CameraManagerRunSample函数,E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_DOWNLOAD_AND_DELETE_MEDIA_FILE选项。
评论
0 条评论
请登录写评论。