rt-thread cdc vcom问题

114 views
Skip to first unread message

weety

unread,
Jun 28, 2013, 2:20:31 AM6/28/13
to rt-threa...@googlegroups.com
采用stm32f407的cdc_vcom驱动实现usb转串口,在windows系统上串口工作正常,而在linux系统上存在问题,usb虚拟串口设备能够识别,但不能打开设备进行操作,表现为usb通信卡死,usb通信出现问题时,通过keil debug查看设备状态,都陷入在usb中断处理中。这个问题该如何跟踪排查?

附linux内核的log信息:
[102335.604033] usb 2-1: new full speed USB device using uhci_hcd and address 10
[102335.792255] usb 2-1: configuration #1 chosen from 1 choice
[102335.796183] cdc_acm 2-1:1.0: This device cannot do calls on its own. It is not a modem.
[102335.796214] cdc_acm 2-1:1.0: ttyACM0: USB ACM device

bernard

unread,
Jun 28, 2013, 2:42:09 AM6/28/13
to rt-thread用户组
估计是CDC实现得不标准导致的,这个需要用USB分析仪来查了。



2013/6/28 weety <luohu...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "rt-thread用户组" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rt-thread-cnus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

weety

unread,
Jun 28, 2013, 4:38:06 AM6/28/13
to rt-threa...@googlegroups.com
我确认了下,问题与串口打印信息有关
1. 先初始化usb vcom,然后将finsh设备设置为vcom,在pc端打开虚拟串口设备失败,usb必然卡死,这里的usb卡死与pc端打开虚拟串口无关,不打开也卡死;
2. 先初始化vcom,然后在pc端打开虚拟串口设备,再将finsh设备设置为vcom,这是虚拟串口通信正常,usb不会出现卡死现象;

我这边使用的测试代码如下:
void usb_init()
{
#ifdef RT_USING_USB_DEVICE
    /* usb device controller driver initilize */
    rt_hw_usbd_init();

    rt_usb_device_init("usbd");

    rt_usb_vcom_init();
#endif
}

void set_finsh_dev(char *device)
{
#ifdef RT_USING_CONSOLE
rt_console_set_device(device);
finsh_set_device( device );
#endif
}
#include "finsh.h"
FINSH_FUNCTION_EXPORT(usb_init, init usb device);
FINSH_FUNCTION_EXPORT(set_finsh_dev, set finsh device);

上面两个程序的执行顺序:
1. usb_init() ——》set_finsh_dev(“vcom”) ——》usb卡死
2. usb_init() ——》PC端打开虚拟设备,这里为ttyACM0 ——》set_finsh_dev(“vcom”) ——》PC端能够正常显示finsh的调试信息,usb通信正常

这里有个奇怪的问题是windows上并没有这样的问题,这个问题出在哪里呢,请大家帮忙分析看看。

winfeng_hs

unread,
Jun 28, 2013, 9:33:49 PM6/28/13
to rt-threa...@googlegroups.com
我在windows下用vcom作为finsh端口基本没有问题,就是在长结果命令执行的时候,如list(),vcom发送的字符不能超过2048字节,否则,vcom只发送到pc2048字节,等下个命令发送的时候,后续的字节会跟出来,而本次命令的返回只能定下次再返回~~还没空仔细看这段呢
--
You received this message because you are subscribed to the Google Groups "rt-thread用户组" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rt-thread-cnusers+unsub...@googlegroups.com.

yueyue papa

unread,
Jun 28, 2013, 11:49:33 PM6/28/13
to rt-threa...@googlegroups.com
>> vcom发送的字符不能超过2048字节,否则,vcom只发送到pc2048字节,等下个命令发送的时候,后续的字节会跟出来,
可能实现上有问题。 后面的数据应该已经到 主机了,主机没有显示。

我猜测是,驱动没有发生一个空数据,告诉主机没有数据了。所以数据在后面一个包发的数据才出现。




2013/6/29 winfeng_hs <winfe...@163.com>
To unsubscribe from this group and stop receiving emails from it, send an email to rt-thread-cnus...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages