OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 6192|回复: 5

labview与STM32的USB通信

[复制链接]

9

主题

36

帖子

0

精华

中级会员

Rank: 3Rank: 3

积分
211
金钱
211
注册时间
2016-5-16
在线时间
67 小时
发表于 2016-6-7 23:12:15 | 显示全部楼层 |阅读模式
5金钱
本帖最后由 NUAA-DW 于 2016-6-7 23:14 编辑

STM32自定义USB设备,有人做过这种吗?速率可以达到多少?NI-VISA生成的INF文件,能读到数据。但是速率只有11K。为什么?
[mw_shl_code=c,true]const uint8_t Virtual_Com_Port_DeviceDescriptor[] =
  {
    0x12,                       /*bLength */
    USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/
    0x00,                       /*bcdUSB */
    0x02,
   
                0x00,                       /*bDeviceClass*/
    0x00,                       /*bDeviceSubClass*/
    0x00,                       /*bDeviceProtocol*/
   
                0x40,                       /*bMaxPacketSize40*/
    0x83,                       /*idVendor (0x0483)*/
    0x04,
    0x50,                       /*idProduct = 0x5750*/
    0x57,
    0x00,                       /*bcdDevice rel. 2.00*/
    0x02,
    1,                          /*Index of string descriptor describing
                                              manufacturer */
    2,                          /*Index of string descriptor describing
                                             product*/
    0,                          /*Index of string descriptor describing the
                                             device serial number */
    0x01                        /*bNumConfigurations*/
  };

const uint8_t Virtual_Com_Port_ConfigDescriptor[] =
  {
    0x09, /* bLength: Configuation Descriptor size */                          //ÅäÖÃÃèêö·û
    USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */
    32,
    /* wTotalLength: Bytes returned */
    0x00,
    0x01,         /* bNumInterfaces: 1 interface */
    0x01,         /* bConfigurationValue: Configuration value */
    0x00,         /* iConfiguration: Index of string descriptor describing
                                 the configuration*/
    0xC0,         /* bmAttributes: Bus powered */
    0x32,         /* MaxPower 100 mA: this current is used for detecting Vbus */

   
   
    /************** Descriptor of Custom HID interface ****************/  //½ó¿úÃèêö·û
    /* 09 */
    0x09,         /* bLength: Interface Descriptor size */
    USB_INTERFACE_DESCRIPTOR_TYPE,/* bDescriptorType: Interface descriptor type */
    0x00,         /* bInterfaceNumber: Number of Interface */
    0x00,         /* bAlternateSetting: Alternate setting */
    0x02,         /* bNumEndpoints */
   
    0xff,         /* bInterfaceClass: HID */
    0x00,         /* bInterfaceSubClass : 1=BOOT, 0=no boot */
    0x00,         /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */
    0,            /* iInterface: Index of string descriptor */

          /******************** Descriptor of Custom HID endpoints ******************/   //¶ËμãÃèêö·û
    /* 27 */
    0x07,          /* bLength: Endpoint Descriptor size */
    USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */
    0x81,          /* bEndpointAddress: Endpoint Address (IN) */
    0x02,          /* bmAttributes: Interrupt endpoint */
    0x40,          /* wMaxPacketSize: 96 Bytes max */
    0x00,
    0x00,          /* bInterval: Polling Interval (32 ms) */
                /******************** Descriptor of Custom HID endpoints ******************/   //¶ËμãÃèêö·û
    /* 27 */
    0x07,          /* bLength: Endpoint Descriptor size */
    USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */
    0x03,          /* bEndpointAddress: Endpoint Address (IN) */
    0x02,          /* bmAttributes: Bulk endpoint */
    0x40,          /* wMaxPacketSize: 96 Bytes max */
    0x00,
    0x00          /* bInterval: Polling Interval (32 ms) */

  };[/mw_shl_code]
360截图-50626062.jpg

简单USB读取

简单USB读取
360截图-50732203.jpg

最佳答案

查看完整内容[请看2#楼]

已解决,labview需要多读几个字节,比如64000字节,能达到几百K
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

9

主题

36

帖子

0

精华

中级会员

Rank: 3Rank: 3

积分
211
金钱
211
注册时间
2016-5-16
在线时间
67 小时
 楼主| 发表于 2016-6-7 23:12:16 | 显示全部楼层
已解决,labview需要多读几个字节,比如64000字节,能达到几百K
回复

使用道具 举报

14

主题

1592

帖子

0

精华

资深版主

Rank: 8Rank: 8

积分
2622
金钱
2622
注册时间
2014-7-17
在线时间
350 小时
发表于 2016-6-8 10:10:14 | 显示全部楼层
你发截图上的内容是labview自己打印出来的吗??
回复

使用道具 举报

9

主题

36

帖子

0

精华

中级会员

Rank: 3Rank: 3

积分
211
金钱
211
注册时间
2016-5-16
在线时间
67 小时
 楼主| 发表于 2016-6-8 17:44:12 | 显示全部楼层
FantaSy_ 发表于 2016-6-8 10:10
你发截图上的内容是labview自己打印出来的吗??

你指什么?我是STM32不断发60字节的数组给上位机,labview连续读取,怎么也得60K/S吧
回复

使用道具 举报

1

主题

7

帖子

0

精华

新手上路

积分
29
金钱
29
注册时间
2016-6-25
在线时间
8 小时
发表于 2016-6-25 21:44:16 | 显示全部楼层
卤煮能把完整的程序发给我吗?最近也在搞usb与labview通讯,好懵
回复

使用道具 举报

1

主题

2

帖子

0

精华

新手入门

积分
15
金钱
15
注册时间
2016-5-17
在线时间
4 小时
发表于 2016-10-25 22:40:25 | 显示全部楼层
最近也在搞STM32usb与labview通讯,,,搞了好久都不行,,能把程序发给我看看吗,谢谢390146413@qq.com。谢谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-5-24 11:37

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表