Main Site Documentation

FEZ mini UART to USB - SOLVED


#1

Good day,

I have the FEZ mini and i recentrly bought the USB to UART adapter ( http://viewitem.eim.ebay.gr/CP2102-USB-20-to-UART-TTL-6-Pin-COM-Module-Converter/150653024649/item?transId=701986566005 )

But i have trouble connecting it. I tried to connect it in the UEXT connector, but some pins are left uinconnected.

The adapter has RX, TX, Ground, +3.3, +5.
Where do i connect them in FEZ mini? and what port are the pins assigned? (COM1/2/3)

Also i have problem with this code in the tutorial
http://wiki.tinyclr.com/index.php?title=UART_-_PC_Communication

I get an error in line:
SerialPort UART = new SerialPort(“COM1”, 115200);

says the serialport is unknown member

(Irecently updated both FEZ mini and the GHI framework so they are the same)

I am newbie, all help are welcome.
Thanks


#2

Take a look at the Mini pinout found here http://www.ghielectronics.com/downloads/FEZ/Mini/Broch_FEZ_Mini.pdf. This will tell you what pins map to what COM port. You should not connect 5V to the Mini. Also, start with a low BAUD rate of 9600 and work your way up to higher speeds, testing as you go.


#3

remember that COM1 on mini is RS232 not TTL


#4

OK this is what i did,

SerialPort uart = new SerialPort("COM3", 9600,Parity.None,8,StopBits.One);
            int read_count = 0;
            byte[] rxByte = new byte[1];

            uart.Open();
            while (true)
            {

                // read one byte
                read_count = uart.Read(rxByte, 0, 1);
                if (read_count > 0)// do we have data?
                {
                    // create a string
                    string counterString =
                            "You typed: " + rxByte[0].ToString() + "\r\n";
                    // convert the string to bytes
                    byte[] buffer = Encoding.UTF8.GetBytes(counterString);
                    // send the bytes on the serial port
                    uart.Write(buffer, 0, buffer.Length);
                    //wait...
                    Thread.Sleep(10);
                }
            }

I used COM3 with pins d7 & d8 (because as you said Com1 is RS232, so u guess COM3 is TTL right?), and i use the same settings for serial speed, parity etc in windows COM1 (as mapped my ttl from the driver).
The program seems to be running good, but i can’t still receive from my pc any data.
I use hyper terminal, please advice


#5

Show a drawing of your connection to the pc please.


#6

Here is what i did:

  1. connect FEZ mini with usb to pc.
  2. connect the TTL to USB to pc.
  3. Connect the Di7 (RX) to TXD pin. (BLUE)
  4. Connect the Di8 (TX) to RXD pin. (ORANGE)
  5. Connect common ground. (BROWN)

And it is not working.

I found also one pic from an arduino project, that guy put the DTS or some other pin (with soldering) to ground or i don’t remember… i lost the link somewhere…

Thanks


#7

Connect grounds.


#8

i dunno exactly what that image represents but as Ian says, make sure GNDs are connected between the Mini and the USB TTL device - you mention the brown wires, which would imply the small insert pics are of your setup? I didn’t check the mini diagram to make sure your pins were correct, that’s the other thing to check.


#9

I have connected the grounds on both of them (with brown cable on the small top image).
So it should work like that right?

Can somebody please explain to me the the back pins that need soldering on the usb2ttl?
(DTR,DTS etc)

Many thanks,
Andreas


#10

Only obvious problem… Does it work now?

I’m not familiar with that board but from what I can see it appears those are alternate I2C & SPI interfaces. Get it working with UART first as you have it wired. You can look into those later if you find you need a faster interface or would rather poll the data.


#11

OK, i will fight a little more with it right now, play with the COM port window’s settings one more time and hope it works,

Thank you,


#12

If you need to dig into anything (ie it doesn’t “just work” now) then you should look at the CP2102 datasheet as this will tell you more than anything. Just one more check to make, you can see the CP2102 listed in the serial devices in device manager, and that the driver is showing installed and working?


#13

Drivers and everything is ok, as in the picture right?

Im checking the datasheet for the board now…
I will keep you posted :slight_smile:

I have checked this page: http://blog.tarn-vedra.de/2011/09/using-cp2102-on-arduino.html
and this guy connects the lines differently than i do:
[ulist]
GND to GND
RXD to RX (?)
TXD to TX (?)
3.3V or 5V to VCC[/ulist]

should i connect like that?

Thanks


#14

Try it. If it worked for arduino, then that usb2ttl doesn’t follow labeling standard


#15

I got it working, many thanks guys.

It was this naming standart and it needed to connect the RXD to RX and TXD to tx.
I will test the various speeds and post back my results.

Thank you guys for your help.


#16

Great! That should save some hair. :smiley: