Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
USB CDC not working under Windows
22-07-2014, 02:03 PM, (This post was last modified: 22-07-2014, 02:08 PM by aoc99p.)
#2
RE: USB CDC not working under Windows
… short update on this topic:

CDC communication works fine under Linux... but not on Windows (as described previously). After some intensive time of debugging USB code of Pinguino and tracing & analyzing USB packets, I think I found a coding error...

usb_cdc.c

case USB_CDC_REQ_SET_LINE_CODING:

outPtr = (__data u8 *)&line_config;
wCount = sizeof(USB_CDC_Line_Coding);
requestHandled = 1;
break;

→ outPtr is wrong... it should be "inPtr":

case USB_CDC_REQ_SET_LINE_CODING:

inPtr = (__data u8 *)&line_config;



… same applies on …

case USB_CDC_REQ_SET_CONTROL_LINE_STATE:

outPtr = (__data u8 *)&zlp;
wCount = sizeof(Zero_Packet_Length);
requestHandled = 1;
break;

→ correct is:
inPtr = (__data u8 *)&zlp;


After these two changes, CDC communication is perfectly working under Windows (tested with Windows 7, Vista and XP). Also USB protocol trace shows now a correct protocol behaviour. For me, it seems as if Linux is not really taking care of parameter negotiation (like baudrate, bit size, …), but Windows (or perhaps CDC driver of Microchip) does.

Michael

P.S.: in contrast to Linux, not every terminal program under Windows is using flow control when opening a serial connection. Because of

if (SetupPacket.wValue0==3) CONTROL_LINE=1;
else CONTROL_LINE=0;

this is essential in current Pinguino code. Suggest to introduce a software switch in next Pinguino version to let the user decide if handshake/flow control is wanted or not. Guess this would be a big benefit for Windows community...
Reply


Messages In This Thread
USB CDC not working under Windows - by aoc99p - 29-06-2014, 11:22 AM
RE: USB CDC not working under Windows - by aoc99p - 22-07-2014, 02:03 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)