G120, problem with serial port (beginner here)

Hello, I cannot simply send any data to PC, for example:

I have connected the wires to the module’s COM3 on the “extension comb” like follows: p0.11/COM3_Rx0, P0.10/COM3_TX0, GND. I am using a TTL to RS232 converter.

SerialPort serial = new SerialPort(Serial.COM3, 9600, Parity.None, 8, StopBits.One);
byte[] buf = new byte[] {0x41, 0x42, 0x43};
serial.Write(buf, 0, buf.Length);

And I see nothing on the receiving side (PC with hyperterminal). The connection parameters match. I am new to this board and I am not sure whether do I need to pre-configure the pins/dips on G120, or does the framework do it for me? Do I need to set tx to output somehow and rx to input etc?

I had weird behaviour that without the ttl/RS232 converter when I opened the port on the board’s side it sent the byte 0x00, but with it I have no transmission at all.

Thank you in advance

That looks mostly ok. Get rid of the flush command an that clears the tx and rx buffers.

No need to pre configure the pins.

If it’s still not working you can check that the levels are changing on the tx pin. Best with an oscilloscope if you have one. If not connect a LED and watch it flicker.

I don’t know if there is still an issue with the Driver but perhaps this link can help


Post #17

I’d also try swapping RX/TX connections from the TTL converter to make sure you haven’t got that reversed (remember that TX on the G120 side needs to be RX on the USB adapter side)