Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
USB CDC not working under Windows
29-06-2014, 11:22 AM,
#1
USB CDC not working under Windows
… with Pinguino you really did any excellent job and I'm very happy with this IDE/HW platform. But I'm getting more and more frustrated because I'm unable to get CDC working successfully.

I'm using Pinguino IDE „X4-easy-rev999“ (but same also with previous revisions) under Windows7 (64bit) together with PIC18F25K50 (USB bootloader v4.8). Everything is working fine (compile a program, download via USB) – but I'm failing in using CDC successfully.

Once downloading a CDC example program to PIC (e.g. printf-cdc-p8), I can see a new COM port after some seconds (when bootloader mode is left and user code is executed).
When I try to connect to this COM port via Hterm (which is the terminal program I use) with a Baud rate different to 115200, I can see the message „baudrate not supported“. Using 115200 Baud, Hterm connects to Pinguino PIC18F25K50 without a failure message, but no data is received or there is no reaction by transmitting data.

For me it seems, as „control path/pipe“ is working... but data exchange not.

Same happens with Windows 7 (32 bit) and Vista... also tested different terminal programs.

I tried to follow and execute all explanations/steps I found on your website regarding CDC and Windows... but I permanently fail to get it running.

I checked available source files and I noticed sections like
#ifdef DEBUG_PRINT_CDC
printf("send\r\n");
#endif

Serial.printf is working fine (using external UART <-> USB converter). Defining DEBUG_PRINT_CDC results in numerous compiling errors -> can anyone please assist me in how to collect debug data?

Or any other idea what I can do?

Many thanks,
Michael


P.S.: While browsing through source code, I also had a look at p32 branch. For me, it seems as for PIC32 pre-compiled USB libs are used provided/based on Microchip USB stack. What is the reason not to do the same for p8 ?
Reply
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


Forum Jump:


Users browsing this thread: 2 Guest(s)