CDC Serial question

When I use from example, it read only one char at each send from client application with :

serial.Write("Test");
            while (true)
            {
                var len = usbclient.ByteToRead;

                if (len > 0)
                {
                    var dataR = new byte[len];
                    var dataW = new byte[len];
                    int read = usbclient.Read(dataR);
                    for (var i = 0; i < read; i++)
                    {
                        dataW[i] = (byte)(dataR[i] + 1);
                    }
                    usbclient.Write(dataW);
                }
                Thread.Sleep(100);
            }

You mean
Write(“T”),
Write(“e”),
Write(“s”),
Write(“t”),

will get all “Test”

But Write(“Test”) then Cdc got only “T” ?

What do you have on the PC side? Teraterm?

That’s it ! When sending a string or a buffer with multi byte, only first char or byte is received. If I do a write foreach byte it is working.

Just a winform with serialport.

Check how many bytes you got. Does it say 1, 4 or 8?

Also there is an even with count.

I will check by self later anyway.

In TinyClr app, only one.
In Winform app, it sends 4 bytes, and receives 4 bytes (if I do a write for each byte to sending them).

Fixed. Thanks for pointing it out.

1 Like

@Bauland Please test in preview 3 and let us know if you are happy.

1 Like

It’s working !!! Thanks to fix it.

1 Like