Main Site Documentation

Cerb40 II UART


#1

Hello,

I’m creating a project using the Cerb40 with the gadgeteer framework. My problem is that I need to use 3 different UART ports. When creating a project in Gadgeteer, the FEZ Cerberus must be selected to use this processor. However, the FEZ Cerberus only has 2 U socket ports. This allows me to easily use two different sets of UART ports by plugging in directly to the approapriate pins on the Cerb40, but I’m not quite sure how to go about obtaining a third port.

Anyone know how this would be done?

Thank you!


#2

The catalog says the Cerberus has two UART ports.

If you check the schematic for the board, you will see that there is another UART’s pins available on socket 3, but not in the U socket configuration. But, this still might not help. This port might not be available in the firmware.

You would have to check the current open source firmware source to see any of the additional UARTs on the STM32F405 chip have been implemented. If not, you would have to add the support, and build you own firmware.

I suspect, unless you are prepared for a lot of additional work, you will not have three UARTs available.


#3

Thanks for your response Mike.

So even though when looking at the schematic for the CERB40 II at http://www.ghielectronics.com/downloads/schematic/FEZ_Cerb40_II_SCH.pdf
it claims there are 6 different UART ports, I can’t necessarily access all of them?


#4

The current Cerb firmware supports 3 uarts.
there are a few threads on the subject.


#5

Only two ports have been placed on the headers. You could solder wires to the processor chip to get electrical access to the other UARTs, but there might still the issue of firmware.

The processor chips have limited memory, and implementing UARTs requires transmit and receive buffers. I suspect GHI made a design decision to limit the number of UARTs supported to conserve memory.

The chip has six UARTs, but GHI has been careful to specify that they only support two.


#6

All 3 Uarts are mapped to the Cerb40 pins

#define STM32F4_UART_RXD_PINS {39, 3, 27} // C7, A3, B11
#define STM32F4_UART_TXD_PINS {38, 2, 26} // C6, A2, B10
#define STM32F4_UART_CTS_PINS {109, 0, 29} // G13, A0, B13
#define STM32F4_UART_RTS_PINS {108, 1, 30} // G12, A1, B14


#7

@ danielwatson - Why are you using a Gadgeteer project?


#8

@ Justin - I’m new to microprocessors and originally started this project on a FEZ Spider. It was easy for prototyping and worked quickly. We then started selling the product, so it made sense to swap to the Cerb40 because code ported over very easily, it’s much cheaper and much more compact. Unfortunately that was back when only 2 UART ports were required. I need a third now.

I haven’t yet put the time in to figure out how to convert off of gadgeteer, although from the sounds of this post it looks like it might be time!


#9

using System;
using System.IO.Ports;
using System.Text;
using System.Threading;

namespace SerialTest
{
    public class Program
    {
        private static SerialPort _serial1;
        private static SerialPort _serial2;
        private static SerialPort _serial3;
        private static byte[] _buffer;
        public static void Main()
        {
           _serial1 = new SerialPort("COM1",9600,Parity.None,8,StopBits.None);
            _serial1.Open();
            _serial1.DataReceived += _serial1_DataReceived;

            _serial2 = new SerialPort("COM2",14400,Parity.None,8,StopBits.None);
            _serial2.Handshake = Handshake.RequestToSend;
            _serial2.Open();
            _serial2.DataReceived += _serial2_DataReceived;

            _serial3 = new SerialPort("COM3",57600);
            _serial3.Open();
            _serial3.DataReceived += _serial3_DataReceived;

            Thread spamThread = new Thread(Spam);
            spamThread.Start();

            Thread.Sleep(Timeout.Infinite);
        }

        static void Spam()
        {
            for (;;)
            {
                _buffer = Encoding.UTF8.GetBytes("From serial 1");
                _serial2.Write(_buffer,0,_buffer.Length);

                _buffer = Encoding.UTF8.GetBytes("From serial 2");
                _serial2.Write(_buffer, 0, _buffer.Length);

                _buffer = Encoding.UTF8.GetBytes("From serial 3");
                _serial3.Write(_buffer, 0, _buffer.Length);

                Thread.Sleep(2000);
            }
        }
        static void _serial3_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            throw new NotImplementedException();
        }

        static void _serial2_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            throw new NotImplementedException();
        }

        static void _serial1_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            throw new NotImplementedException();
        }
    }
}