FEZ Cobra I : how to debug serial

I want to use the FEZ Cobra I (EMX Module) as a USB CDC device and find out that I should use the GPIO pin IO71/LMODE to switch between USB and serial debug, but I am confused about the docs in the EMX manual, where its said in chapter 4.3 The Loader and Firmware Debug Access Interface “When LMODE is high or left floating (internal weak pull up resistor) the system will run in serial mode using COM1; when pulled,
low (10 K resister), USB is used.” and what happens in reality.

If I left the pin floating (nothing attached and the application on the board does not access this pin or configures it in any way), the USB debug is still active, as I can see on the LCD (I got this Box version with a 3,5" Touch display) when the Cobra boots up.

If I pull down the pin to ground with a 10K resistor the behavior is the same ! … still USB debug and in either way I can not use “serial transport” and the USB CDC Sample (https://www.ghielectronics.com/docs/20/usb-client) fails also, which makes sense if the “USB debug” is still active and blocking the device from switching to a USB CDC device.

Is there any detail documentation for “serial debugging” with FEZ Cobra I … and what did I miss or did not understand ?

Thanks in advance

Try the pin directly without using any resistors. Do you see anything different?

Thank Gus for your reply,

I just tried it out without using a resistor, but the result is the same. To make things more clear I attach some pictures where you can see the VS 2012 project settings, my try to debug and the error output it get, a snapshot from FEZ config to see the versions used and also a picture of the LCD display that shows that “Debug: USB1” and the wiring also.

And I also used the GND pin on the upper side of the pinout strip, with the same result.

As the Serial Device I use a Arduino USB serial light Adapter and I can see the LED flicker when VS 2012 tries to connect the debugger to FEZ Cobra, but as FEZ Cobra is still in “USB mode” it gets no answer.

any ideas … and thanks for you time !

Keep the wire connected to mode and then connect it to 3.3v and leave it there. Power up your board and check what you see on the device manager.

Yes, that’s the path to get it work :wink: - connecting the Lmode (IO71) to 3.3V does the “first & big step”, as the LCD Display now shows “Debug: COM1”.

What’s still needed is the “CDC driver trick”, as in device manager I see a “CDC VCOM” but no driver was installed. I tried allready the CDC driver that is linked on the page [url]https://www.ghielectronics.com/docs/20/usb-client[/url] but if I do a “right click & Inf-file installation” I get an error with a message from Windows like “the inf-file contains no digital signature”.

As I am running Windows 8.1, will re-booting with the advanced startup option “don’t block unsigned drivers” (or something like that) do the trick OR do you have a different driver or installation workflow for Windows 8.1 ?

Thanks gebco

I just had the time to give my guess a try and did a reboot of my windows 8.1 machine (on which I have the .NET MF toolchain installed), choose the advanced startup and configured windows to allow unsigned driver install. After that I right clicked the mentioned “CDC_Driver.inf” in the windows explorer and choose the “install option” of the popup menu … and after a further dialog and warning if I really want to install a unsigned driver “my whish came true” ;D

After a while the FEZ Cobra shows up as “CDC Interface” under COM-Ports in the device manager and also deploying and debugging from VS 2012 “just works” ! … THANKS Gus for showing me the way !

BUT Gus could you please check another & releated thing - if my evaluation with .NET MF and USB CDC works as expected with FEZ Cobra I, I want to switch gears and plan to buy FEZ Cobra II (eco), for using some Gadgeteers Moduls and in the end there should be “some Cobra II’s” simulating an industrial process (an IoT scenario), producing “a lot of process-data” that can be controlled by the user (through some gadgeteer modules and environment adjustments … this is for demo purposes and people should be part of the process to get a “real feeling” of it) and that will be routed into a Windows 10 IoT core (and later on maybe Windows 10 IoT Enterprise) System that will be “the head of logic” and a gateway to backend serives.

My Question no.1 : how has “debug over serial” to be configured with FEZ Cobra II (eco), as I don’t see a document in the installation directory on my disk, but only one for the G120 (also neither the product website nor the Developers guide document has information about this topic) … but FEZ Cobra I is based on EMX and that EMX document mislead me ! … maybe a Wiki for each Board where all essential configurations are explained is a good idea, preventing you from answering the same question multiple times (:wink: ?

My Question no.2 : I am really excited about the upcoming AOT Feature of .NET MF that will expand the range / spectrum where .NET MF boards can be used, if the promise of “C++ like runtime behavior” will be kept - which the .NET MF guys at Microsoft will be in charge of in the first row I think. But beside that, can you already see some restrictions that will prevent some .NET MF / Gadgeteer Boards of GHI from using this AOT compiler feature … so that I don’t invest into the “wrong” ones?

thanks again for your help & time

  1. There is a small switch to handle that.

  2. It is over a year before we know what the plans are, way too early. RLP is available today however.

Thanks Gus for your help and guidance to get it work !

A last question towards FEZ Cobra II and G120 module: if I use the USB client as a CDC device, which data transfer rate can I expect (at least USB full speed with 12 MBit/s ?) and do you know how big are the TX-Buffers?

It seems that if the TX-Buffer of the USB CDC client (GHI library implementation) is full, which happens if on the host-side the bytes are not consumed fast enough, I get a “timeout exception” if I try to write another amount of bytes into the corresponding stream - which is okay !

But for data-flow and data-packet design it would be great to know the TX-Buffer size.

thanks gebco

Cdc is slow. I think it is limited to 64k max