How do I create the RS232 objects in software to make use of the COM3 and COM5 serial ports on the Cobra II? The only code I know of is this:
public RS232(int socketNumber);
this.rs232 = new GTM.GHIElectronics.RS232(8);
To create the RS232 object, I must pass in the number of the socket. The designer tool will allow RS232 connections to sockets 5,7,8 only, all type U sockets.
There is no U type socket for COM3 and COM5. The COM3 Tx and Rx lines appear on the extender card expansion bus JP2 pins 4 and 6. The COM5 Tx and Rx lines appear on the main board LCD_R4/P2.9/COM5_RXD on socket 3 and LCD_B4/P1.29/COM5_TXD on Socket 1.
Do I have to specify in the code what socket or what G120 pins the serial port #5 uses? COM5_RXD is on socket 3 and COM5_TXD is on Socket 1, so two sockets are involved in COM5. Does the SerialPort class know how to activate these I/O pins as COM5 simply by passing in the COM port name “COM5” ?
public SerialPort (
The port to use (for example, COM1).
The baud rate.
One of the Parity values.
The data bits value.
One of the StopBits values.
I have a related question; on the Cobra II extender board, COM2 is on socket X8, COM4 is on socket X7, and COM3 is split between socket X8 and X10 - COM3_RxD is on socket X10 and COM3_TxD is on socket X8. So can all three serial ports 2,3,4 work at the same time? Is there a problem because socket X8 is hosting COM2 and part of COM3? Do I use the SerialPort class to construct the COM3 object in software, and at the same time, use GTM.GHIElectronics.RS232(8) class to construct the COM2 object?
@ dspacek - When you consider Gadgeteer, remember that it is just NETMF with helper classes – It is more than this, but when thinking of pin association, it is just this. These classes make it easier to access protocols through the use of sockets and defining the pins of that socket. However, at it’s heart, NETMF does not know what a socket is, so it does not care where the pin resides, as long as you have access to it.
That gives me some insight, but does not really answer my question. Should I expect that COM2, COM3, and COM4 on the extender board can all be wired up to RS-232 devices and all send and receive at the same time? If so, what class should I use? Should I execute new SerialPort() passing in “COM2”, “COM3” and “COM4”? The GHI spec page says that Cobra II has five serial ports (UARTS). So there should be two on the main board and three on the extender board, all working at the same time.
No it’s my poor choice of words. I am aware of the TTL logic levels. My main concern is that socket X8 is hosting COM2 and part of COM3. I was assuming that a socket can only do one function at a time. But you are saying that as long as I use the SerialPort class, this sharing of COM ports on socket X8 does not interfere and both COM2 and COM3 will work.
Yes, as long as another module does not reside on this socket. A lot drivers will reserve all pins, even if they are not used as it is assumed that one socket will be a link to one module. If, for instance, you have another serial device connected to the socket, you will need to use a breakout on that as well.
Does anyone know of a Gadgeteer flat cable that can be purchased pre-wired for COM5 for the Cobra II board? The cable has be split with TXD going to Socket X1 pin 7 and RXD going to Socket X3 pin 7, plus VCC, +5V, Ground going to either X1 or X3.
@ James - Hi James! This is Bill–the guy that bought a FEZ Raptor from you locally… I have a question similar to this. I’m glad I found this post… I was thinking I could simply use a U-port and connect it to my motor controller! I don’t want to see smoke!
Currently I have it running using PWM and the breadboard, but I am finding it a little flaky.
I’ve searched for others controlling a Sabertooth and could not find much on here. Am I correctly thinking that the Serial Mode would be the best way to control it? Using PWM, I get one of the motors jittering while the other is still.