CDC on 4.2.9

Hi everyone

I am using EMX and switch from 4.1.8 to 4.2.9 sdk and I have a lot of thing to solve. On 4.1 the CDC was not very reliable (cdc+debug or without debug). Now if I want to move to 4.2.9, I can’t debug using the usb anymore. But what are the options? In the doc we can see that Port 1 can be used to deploy FW. What is the COM1? is it COM0 or COM1 (it would be better to refer to the COM port associated with Pinnumber…)

Is it possible to deploy using ethernet?

What about the USB_CDC class that is in the 4.2.8 premium library. It is tagged as obsolete but I do not find any replacement or any link that indicates where to find more infiormation…

Can anyone help me?

Regards

Once you use USB for anything (including CDC) you need to debug over COM1 cable, that is COM1 on your product (EMX in this case), not the PC.

To the PC, this can be a serial RS232 connection (you need to add a RS232 to UART level converter) or using USB (a USB to serial cable). This will be may favorite FTDI TTL 3.3V cable http://www.digikey.com/product-detail/en/TTL-232R-3V3/768-1015-ND

Here is another alternative:

http://www.electrodragon.com/?product=pl2303hx-usb-to-comuartttl-integrated-programmer-cables-1m

It uses the less popular PL-2303 chip. I wouldn’t recommend it over Gus’s recommendation, but for those of us with more time than money (shipping can take a while), it’s a decent option. I am currently using it to communicate with the Cerb40 at 460800 baud without error.

Ok Gus, this is therefore COM1 on EMX and I have routed RXD1 and TXD1 such that we can connect an USB to rs232 converter. But what’s the hell!!! RXD1 and TXD 1 are not the pin associated with COM1 but COM2…

Now what Can I Do, I do not have access to IO2 and 3. Any other advice than rerouting the board?

Just to know how it works, I have try the following:


using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHI.Premium.Hardware;
using GHI.Premium.USBClient;



namespace EMX_Application1
{
    public class Program
    {

        static PWM buz = new PWM(Cpu.PWMChannel.PWM_0,10000,0.1,false);
        public static void Main()
        {
            buz.Stop();
            buz.Start();
            Thread.Sleep(200);
            buz.Stop();
            Debug.Print(Resources.GetString(Resources.StringResources.String1));

            // Start CDC
            USBC_CDC cdc = USBClientController.StandardDevices.StartCDC();

            // Send "Hello world!" to PC every second. (Append a new line too)
            byte[] bytes = System.Text.Encoding.UTF8.GetBytes("Hello world!\r\n");
            while(true)
            {
                // Check if connected to PC
                if(USBClientController.GetState() !=
                    USBClientController.State.Running)
                {
                    Debug.Print("Waiting to connect to PC...");
                }
                else
                {
                    cdc.Write(bytes,0,bytes.Length);
                }
                Thread.Sleep(1000);
                buz.Start();
                Thread.Sleep(200);
                buz.Stop();
            }

        }

    }
}

As expected, due to the fact that I am using usb interface (GHI.NET Micro Framewor USB Debugging Interface shown in the device manager, the code crashes while trying to execute:

USBC_CDC cdc = USBClientController.StandardDevices.StartCDC();

No pb, now the code is in the device. Therefore I should see a new COM port and the GHI debugging interface should disappear but nothing happens, the first bip is emitted by the pwm but nothing else. So the board can’t start the CDC… What’s wrong?

Ok this was due to a hardware pb, LMOD was pulled down continuously… after removing to resistor pull down, the deployment and debugging interface become the com port.