Use G120 COM1 when COM1 is debugger port

I can open COM1 at the same time as it’s a debugger port. It also fires the DataReceived interrupt.
But the serialPort.BytesToRead is always 0…

Is there a way getting hold of the incoming data before anyone consumes it?

I guess you Need to be faster then the debug Interface.
I also guess if you read the data before the debug Interface, then the data will be consumed.
Haven’t heard of an “peek” function on the Serial data.

The COM1 is forced to debugger port when the USB is used as CDC.
That’s why, I can’t recall any option to disable the COM1 as debug…

Connect your serial output to COMn where n != 1
COM1 is hard locked as the debug port in all current firmware.

@ Honken - This may help if you disable the debug interface before initializing the CDC interface, see Reply #4 in the following link.

I think the namespace is Processor, not Configuration though.

[url]https://www.ghielectronics.com/community/forum/topic?id=22693[/url]

In one of our designs the COM1 is the only physical option.
Or I should say the pins P0_2 & P0_3 are the one we need to use for uart.

I have made some test with changing the COM4 (uart 3) to the P0_2 & P0_3 pins with the registers.
Its working fine for transmitting data but there is some more to solve for RX.

In this case we open COM4 instead and doesn’t have the debugger output on these pins.

We run 4.2 :frowning:

@ Honken - Hence Reply #4 in this thread, second paragraph:
[url]https://www.ghielectronics.com/community/forum/topic?id=22691[/url]

This is how I solved it to use COM4 instead of COM1 but on the physical pins as COM1.
In this way I can use P0_2 & P0_3 as COM without the debugger consuming all the data :slight_smile:


Register IOCON_P4_28 = new Register(0x4002C270);
Register IOCON_P4_29 = new Register(0x4002C274);
Register IOCON_P0_2 = new Register(0x4002C008);
Register IOCON_P0_3 = new Register(0x4002C00C);
            
SerialPort com4 = new SerialPort("COM4", 115200);
            
com4.ReadTimeout = 500;
com4.DataReceived += Com4OnDataReceived;
com4.ErrorReceived += Com4ErrorReceived;            
com4.Open();

IOCON_P4_28.Write(0x07);    // Remove UART3 TxD from P4_28
IOCON_P4_29.Write(0x07);    // Remove UART3 RxD from P4_29
IOCON_P0_2.Write(0x22);     // Move UART3 (COM4) TxD to P0_2
IOCON_P0_3.Write(0x22);     // Move UART3 (COM4) RxD to P0_2
1 Like