• 0
zecharia

add on for custom designed system

Question

What board and what SW could I use for this: we have abt 10k  local units (nation wide) that are to be called up from a central PC and

data sent to the PC from them. Abt 200 bytes each time and perhaps once a week. I want some board that is so complete that I don't

have to learn the whole Ethernet protocol or the entire WiFi protocol. Does such thing exist?

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi @zecharia,

We do not have a FPGA/ZYNQ or Microcontroller board that will do exactly what you are looking for without some changes to existing code. 

1) Do you need both Ethernet and WIFI?

  a) I would suggest something like the WF32 or the WI-FIRE microcontrollers using Arduino IDE in conjunction with the Pmod NIC100 if you need both Ethernet and WIFI.

  b) I would suggest something like Cora-Z7 for FPGA/ZYNQ which can use the LWIP from Xilinx in conjunction with the Pmod WIFI which Digilent made the WIFI protocol and IP Core available on our GitHub in the Vivado library here.

If you do not have much experience with FPGA's/ZYNQ and IP Cores i would suggest using the microcontrollers with the Arduino IDE. Also if power consumption is an issue I believe the PIC32 microcontrollers can use the watchdog timer which will drastically lower power consumption.

thank you,

Jon 

 

Share this post


Link to post
Share on other sites
  • 0

Hi Jon

thanks for info.  I intetend to use Mega644, ICCAVR C compiler and AS4 or AS7. The Arduino IDE is out of the question.

I will need either Ethernet OR Wifi, not both. A simple protocol that could be easily coded in C. Something like "send IPaddress

or Phone nr from PC to connect to the module on the local board. The local board sees that it is being contacted and responds.

The PC sends a command or two to get data and then closes the connection". That's all I need to do.

The Mega644 has both SPI and UART channels free for this use. We will have access to ethernet where the control unit is located

and also access to mobile network.

Share this post


Link to post
Share on other sites
  • 0

An MBED LPC1768 might work. You need to connect Ethernet magnetics, but that's more a mechanical issue (flying wires worked for me).

The C code below reads a file "config.txt" from the MBED's USB drive, which is a simple way to set the IP address by editing the file in notepad.exe.

  char buffer[256];
    char ipAddress[256];
    char subnetMask[256];
    sprintf(ipAddress, "%s", "192.168.1.10");
    sprintf(subnetMask, "%s", "255.255.255.0");
    int port = 7;

    FILE* f = fopen("/local/config.txt", "r");
    if (f != NULL){
        int n = fscanf(f, "%s", ipAddress); if (n <= 0) goto endOfFile;
        n = fscanf(f, "%s", subnetMask); if (n <= 0) goto endOfFile;
        n = fscanf(f, "%s", buffer); if (n <= 0) goto endOfFile;
        port = atoi(buffer);
    endOfFile:
        fclose(f);
    }

    EthernetInterface eth;
    eth.init(ipAddress, subnetMask, "");
    eth.connect();
    printf("IP address: %s (configured: %s) port %i\r\n", eth.getIPAddress(), ipAddress, port);
    
    TCPSocketServer server;
    server.bind(port);
    server.listen();

    while (true) {
        printf("\nWait for new connection...\n");
        TCPSocketConnection client;
        server.accept(client);
        client.set_blocking(true, 0);
        
        printf("Connection from: %s\n", client.get_address());
        client.send_all(">\r\n", 3);
        
        // === main loop ===
        while (true) {

            // === read data from socket ===
            int n = client.receive(buffer, sizeof(buffer));

            // === detect connection break ===
            if (n < 0)
                goto conn_exit;
            
            // maximum length of a single reply. Anything longer will be split.
            #define MAX_PACKETLEN (1024)
            // maximum length of a single message to guarantee there is enough output buffer
            #define MAX_MSGLEN (16)
            char bufOut[MAX_PACKETLEN];

            // === iterate over input characters ===
            int ix;
            for (ix = 0; ix < n; ++ix){
                       ... work on buffer contents
                                ... send reply:
                                           client.send_all(bufOut, nInBuf);
            } // for input character
        } // while connection
        
    conn_exit:
        client.close();
}

it needs this ethernet library (there may be several)

/* EthernetInterface.h */
/* Copyright (C) 2012 mbed.org, MIT License

Edited by xc6lx45

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now