Main Site Documentation

USBizi100 Chipset - USB DEVICE


#1

Does USBizi100 CHIPSET works like USB DEVICE of a PC ?

I want to make it a SERIAL DEVICE of my PC!

Miguel


#2

Yes, all FEZ devices can be USB clients to a host - the CDC serial driver is the default.

Good info on http://www.tinyclr.com/forum/1/1328/ and the linked threads.


#3

But works using the SDK 4.0 and MSC 2008 C# ?

The example not compile in 2008…

Looks that USB DEVICE is only for SDK 4.1…

http://www.inf.furb.br/~maw/asm51/csharp.txt

Miguel


#4

Miguel, you have to update your software. Both SDK and VS.

Look at this page for help : http://www.tinyclr.com/dl/


#5

Why using VS2008 not VS2010?! You can use the free express version


#6

Hi Patrick

Then not works in 4.0 and MSC 2008, ok ?

Thanks

Miguel


#7

i was using 2008 because 2010 had problems in my windows. Ok, i will install in my notebook late…

Miguel


#8

Now is working on 2010 :slight_smile:

Thanks

Miguel


#9

In this example i am waiting for data coming from cdc when reachs 30 or timeout…

byte[] receive = new byte[30];

int qnt_recebidos = cdc.Read(receive, 0, 30);

During a the string conversion, how i inform the byte array size ?

how to convert to string to send back with cdc.Write ?


#10

Help us to help you :frowning: You will get better answers if you use code tags

This is hard to read code

byte[] receive = new byte[30];

int qnt_recebidos = cdc.Read(receive, 0, 30);

This is easy to read code

byte[] receive = new byte[30];

int qnt_recebidos = cdc.Read(receive, 0, 30);

Also, the topic is about “USBizi100 Chipset - USB DEVICE” but now you are asking question on creating strings :slight_smile:

I don’t want to bug you but you are a FEZ Senior so proper posting is expected please :slight_smile: only so we can help you better.

About your question, why do you want to convert to string if you are using cdc.Write?


#11

Here the code

 cdc.Write(bytes, 0, bytes.Length);
    int qnt_recebidos = cdc.Read(receive, 0, 30);

    if (!(qnt_recebidos == 0))
    {
        byte[] encrypted_bytes = xtea.Encrypt(receive, 0, receive.Length, null);
        byte[] decrypted_bytes = xtea.Decrypt(encrypted_bytes, 0, encrypted_bytes.Length, null);
        cdc.Write(decrypted_bytes, 0, decrypted_bytes.Length);
    }

The problem is if i type MIGUEL in the COMx console
Prints MIGUEL
But, if you type A
Prints AIGUEL (stay the historic of last type)

Miguel


#12

Your question is on strings or on encryption!!

Also, did you clear your array after you have used it? Use Array.xxxx


#13

wow,

tks, i had forgotten to clear…

Now is working nice

Thanks


#14

Don’t use receive.Length, use qnt_recebidos which is the number of bytes received. This way you don’t have to clear the array and its more efficient.

 cdc.Write(bytes, 0, bytes.Length);
    int qnt_recebidos = cdc.Read(receive, 0, 30);
 
    if (!(qnt_recebidos == 0))
    {
        byte[] encrypted_bytes = xtea.Encrypt(receive, 0, qnt_recebidos, null);
        byte[] decrypted_bytes = xtea.Decrypt(encrypted_bytes, 0, encrypted_bytes.Length, null);
        cdc.Write(decrypted_bytes, 0, decrypted_bytes.Length);
    }