FEZ Moxa

Hello,

some time ago, I’ve asked for help in designing a shield.

After some weeks of waiting, the time has come for the implementation. :hand:

I have received all the needed components from various sources : GHI for the Panda, Sparkfun for eletronics and BatchPCB for the PCB.

Here are some pictures of all this stuff before starting soldering :

This Panda is in fact prepared for my next shield (PandaMotors), hence the added headers.

There are two versions of the shield : a simple one and one with RS232 debugging. I can also debug with the simple one but via the Panda COM1 pins.

I will come back with other pictures when the board(s) will be soldered and will finally write a Wiki page when all this will be done.

Edit:
Of course, as with any project that respects itself, it’s bound to be a concern somewhere : here I forgot to order the reset switches :wall:
I will have to desolder some off another board… ::slight_smile:

The shield is now working. As expected, of course :wink:

It’s not very obvious but the green led on the right is lit, indicating that the Moxa board is ok.

To verify this, it comes with a program that can see it and configure it. It’s located at IP 192.168.0.100 on my network. Teraterm is also seeing it since I have opened a Telnet session on it :

Now, a “real” test session. For this example, the Moxa has been configured to appear as COM8 on my PC. It also communicate with the Panda via its COM1 pins (Panda pins).

I open a session with Teraterm on COM8 and then send chars to this port. On the Panda, it simply echoing what it receives. If it receives the letter “A” then it sends “Hello world !” back to the Moxa, which in turn sends it on the PC COM8 port.

You can see a recording of this test session : [url=http://www.lsp-fr.com/FEZ/moxa/FEZMoxa.htm]http://www.lsp-fr.com/FEZ/moxa/FEZMoxa.htm[/url]

And here’s the C# code that is running on the Panda :

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

namespace FEZ_Panda_Application1
{
    public class Program
    {
        static readonly SerialPort Uart = new SerialPort("COM1", 115200);

        public static void Main()
        {
            Uart.DataReceived += UartDataReceived;
            Uart.Open();

            Thread.Sleep(Timeout.Infinite);
        }

        static void UartDataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            if (e.EventType != SerialData.Chars) return;
            var readBuffer = new byte[Uart.BytesToRead];
            Uart.Read(readBuffer, 0, readBuffer.Length);
            Debug.Print(new String(Encoding.UTF8.GetChars(readBuffer)));
            if (readBuffer[0] == 65)
            {
                var dataToSend = Encoding.UTF8.GetBytes("\r\nHello World!\r\n");
                Uart.Write(dataToSend, 0, dataToSend.Length);
            }
        }
    }
}

So, to summarize, the Panda can now communicate with any PC on a network via a simple “serial link” mechanism.

I’ve chosen this mode (COM port emulation) because it’s the one I will be using in a real project, but the Moxa can also act as a TCP server/client or in UDP mode.

Christophe that is exceptional work. Thank you for sharing your project with us.

Thank you, Richard. Sharing is essential, to me. :hand:

Here’s a screenshot of a different working mode : TCP Server.

Here, the underlying C# code does not change (*) : it’s still a SerialPort that is used on the Panda but now the network transmissions are done via TCP packets.

Edit: here, the Moxa is serving messages on 192.168.0.100:4001 and permits 4 clients to connect (the maximum permitted by Moxa).

(*) although I’ve changed it here to reflect the new behaviour :wink: When you send ‘A’ or ‘B’ or ‘C’ you get different messages back. That’s all :hand:

Wow. From an eagle “noob” to a complete board. Very very nice! :clap:

Thank you, Robert :stuck_out_tongue:

The first FEZ board/shield made by a user…1000 point :slight_smile: thanks

more points for a wiki page that explicit how you started not knowing anything about eagle to make your own board.

Thank you very much, Gus :-[
The Wiki page will also be done, of course :hand:

Next step will be a more useful (at least I hope so) but more complex board than this one : PandaMotors.

Again, don’t understand everything here, but the concept is Awesome. I would love to see your code, is it more than just your insert here, or is that it?

Also, Wiki page would be great!

Mike in MN

@ Mike : no more code than what I’ve posted here :wink:

That’s why I love this little Moxa board… On the embedded side (Panda/Domino) you speak TTL Serial and on the other side (PC, for example) you speak virtual Serial or Network.

My first example was using Teraterm on the PC with COM8 serial port and the second example was using a simple TCP client to speak with the Panda across my network.

Plus you have a complete control over the board via a web page or with an external program :

That’s cool! Very interesting indeed.

Gonna have to look into this… ;D

Mike in MN

Here it is : (link removed)

[italic]Edit: I don’t know in which category it should be put in, though :think: Any suggestion would be welcome, here.[/italic]

Awesome!!!

I would make a new category, “hardware” maybe?

Fantastic work and additional 300 points :slight_smile: