Fez CERB40 II Serial port

Hello everybody.

I need some help with serial ports on CERB40 II.

I would like to use Com1 (pins 18/19 on the module) and Com6(pins36/37 on the module) as SerialPort.

When i try to init these port with a SerialPort class, i get an exception for COM6 and don’t have anything on the COM1 pins …

I used HardwareProvider.GetSerialPortsCount(); to know how many port the board count and it give me 3;
I used HardwareProvider.GetSerialPins() to know wich one and on wich pin?
=> results =
COM1 on pin PC6 and PC7 ( UART6 on schematic)
COM2 on pin PA2 and PA37 ( UART2 on schematic)
COM3 on pin PB10 and PB11 ( UART3 on schematic)

On the schematics, Com1, 3, 4 and 6 are available. How can i handle the real ports? Are they reallly usable?

My print is already done…

Thanks by advance.

Damien

@ damhold - I believe PC6 and PC7 should be COM6. Can you show some minimal, but complete, code for each of the COM ports and the errors they give?

Hi John
If I used the uarts definition from there
https://www.ghielectronics.com/docs/44/fez-cerb40-developer
PC6 and PC7 is COM1 and not com6 as showed on your cerb40 schematic.
I made my design based on your schematics.

///


/// Initializes a new instance of the class.
///

/// The port name used
/// The baudRate needed
public SerialBase(string portName = “COM1”, int baudRate = 19200) {
// Initialize serial port
this.ComPort = new SerialPort(portName, baudRate);
this.ComPort.Parity = Parity.None;
this.ComPort.DataBits = 8;
this.ComPort.Handshake = Handshake.None;
this.ComPort.DataReceived += this._comPort_DataReceived;
try {
this.ComPort.Open();
}
catch (Exception ex) {
Debug.Print(ex.Message + " on " + DateTime.Now.ToString());
}

        // Init receive buffer
        this.receivedBuffer = new byte[Constants.Communication.MaxByteFromDevices];
        this.messageToAnalyse = new byte[Constants.Communication.MaxByteFromDevices];
    }

If i pass “COM6” as parameter of my constructor, i get an exception : "An unhandled eception of type “System.argumentException” occured in Microsoft.SPOT.Hardware.dll

If i pass COM1 as parameter, no exception and PC6 an 7 are used in place of PB6 and7.

I used this code to determine wich serial port really usable
////HardwareProvider hwProvider = new HardwareProvider();
////string port = “COM1”;
////var count = hwProvider.GetSerialPortsCount();
////Cpu.Pin tx;
////Cpu.Pin rx;
////Cpu.Pin cts;
////Cpu.Pin rts;
////hwProvider.GetSerialPins(port, out rx, out tx, out cts, out rts);
It is only 3 serial port usable : COM1,COM2 and COM3

I made some cuts and wiring on my design to redirect the schematic com1 on com2 and use com 6 as com1 and now it’s working BUT it was not my wish. I have now 7 cards where i have to make these correction.

Is it possible to use PB6 and 7 as SerialPort or are these pin only IIC as the url say?

I have another question… :slight_smile:

Is it possible to connect an enc28 on this module? ( it would be for another project i have…)

Regards

Damien

ENC28 is certainly usable. It just needs the equivalent of an S socket.

As for serial ports, I suspect the answer is that the schematic labelling of pins is wrong and you have no option to rearrange anything. Perhaps there are firmware options open to you or perhaps not, you could look at the open source community firmware for hints (but if you’re not familiar with the porting kit and you just want to use the device, I’d suggest you don’t attempt)

Hi Brett

I’m not familiar with the porting kit but i can look if i find something interesting.
Do you have some good links to get infos about this kit?

For the ENC28, i think that the needed pins are present (SPI1 pins are available)… i hope only they are implemented into the firmware…

Regards,

SPI is available on Cerb family.

https://www.ghielectronics.com/community/forum/topic?id=11719&page=1 is a thread that might be of interest. Otherwise head to netmf.codeplex.com and look for the porting kit - you will need the PK to compile any firmware.

Thanks for your suggestions.

I will check this link.

John, I had to find this posting today to try and get a Cerbuino Bee to work with the latest 4.3 SDK and I had to use COM1 for the XBee and yet the schematic shows this as UART6. If I input COM6 then I get an exception. COM1 works.

It would make more sense for all future versions if the COM port name matched with the UART numbering.

OR… document it somewhere cleanly. We used to have on the Cerb40 developers page a great table of pins and stuff, just add COMx=PinX and PinY so everyone knows what the mapping is.

@ Brett - https://www.ghielectronics.com/docs/44/fez-cerb40-developer does still exist, though it has been marked obsolete.

@ Dave McLaughlin - The GHI.Pins classes do have the correct mappings for all boards. We do try to match the UART number with the COM port, the cerb family is the only exception.