Reading custom ethernet frames with ESP-IDF on ESP32 - tcp

I am using ESP-IDF to programm an ESP32 (Olimex ESP32-POE).
I have written a program which can send out broadcast ethernet frames with a custom ethertype using esp_eth_transmit().
Now I want to make it receive frames (unicast) with the same ethertype, but don't know how this works.
Also I want to have a little web interface, so I need TCP/IP.
I have a TCP/IP stack running using esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handle)), but I am not sure, how to receive these custom ethernet frames in addition to the TCP/IP handling.
Can someone provide a sample?
I found out that I can use esp_eth_update_input_path(eth_handle, my_stack_input, (void *)true); to check incoming frames, but how to chainlink this to the TCP/IP stack?

Related

How to interface ethernet with STM32 Microcontroller?

The project uses an ethernet loop which is connected through the STM32 Microcontroller. I have to use ethernet switch IC(4 port). What are the topics that I have to know so that I can use the ethernet in the project? Also how to interface the ethernet switch IC, transceiver with the MCU? How to read and transfer data (integer data) through the ethernet.
It does not matter what you want to send over ethernet and how many ports your switch has. You need to know what protocol your other devices use. At the moment you most of them use TCP/IP and you need to implement it in your app. CubeMX has support for LWIP stack.
You can also use external chips with built in TCP/IP stack like Wiznet W5100, 55000 or other chips.
How to read and transfer data (integer data) through the ethernet.
You will need to read about TCP, UDP, ports, sockets etc. It a too wide topic to be answered in the forum post

sending a chunk of data using zigbee

I have some nodes with installed Xbee s2 on them. the zigbee modules configured as routers and coordinator, in zigbee mesh topology. I want to send data from each node to some other nodes.
question:
how I have to send data? here is a pseudo code that I have in mind. I want to know if there is any API in zigbee stack that I can use for this, and if I miss anything:
init_network;
fragment_data_to_frames;
fork();
if(process_is_parent)
for(i=0;iMbum_frames;i++){
send_frame(i);
wait(x miliseconds)// how much do I have to wait? or do I have to wait upon receiving ack,i.e. wait(ack(i));
}
}
if(process_is_child){
check_acknowledgment_packets();//does zigbee notify me that the frame is lost? or I have handle it by myself, e.g. by assuming frame is lost after specific time.
}
resend_lost_frames;
in the destination node, how I can retrieve the data? Do I have to handle it by myself by checking the sequence number and profile, and concatenating the packets? or Zigbee stack will do it for me.
XBee radio modules in API mode will generate a "Transmit Status" frame to indicate that a frame number was received by the remote module. There's no guarantee that the host on the other side successfully processed it, since it's a network-layer acknowledgement and not application-layer.
How much data are you planning to send? ZigBee was designed for low-speed, low-volume data transmission. If you're just using XBee modules, you can make use of their proprietary protocols (like transparent serial). For interoperability, you'll need to read up on the ZigBee Cluster Library and how it uses general commands and attributes to transfer information between nodes.

Connecting Zynq boards in deterministic way

I'm trying to make a cluster with Zynq-7010 boards for a real-time application. One of them will be the master, and it will control eight client boards. The master board will also collect the data from clients. I tried to use 100Mbit ethernet connection to connect the nodes but it was not as fast as I need. In addition, it was not deterministic because of switch's indeterministic behavior. Could you give me some idea about how to connect them fast and deterministic way?
One way to speed it up is to use 1Gbit ethernet, which is supported by Zynq-7010, if you have an appropriate ethernet transceiver on the board.
If you have FMC connectors, you could use an FMC Ethernet board to enable the master to connect directly to 4 other boards to avoid the non-determinism of an ethernet switch.

Can Cat 5 cable communicate with microcontroller and CPU?

So I was curious if this is possible at all. Currently i have a program running in a micro controller (digi rabbit) that reads SPI data from a chip. I also have TCP/IP protocol set in this program so it sends the SPI data to the server. Microcontroller is programmed in C. Server is in java. I convert SPI data into string and send it over, the server reads the raw data.
But i wanted to know if there is a way that I can read the data from Ethernet port. So what i want is one end of cat 5 cable on micro controller and the other on Ethernet port of the computer. Just for testing purposes that micro controller port and everything is installed properly, before i turn on the server. I am not that experienced with networking. So if anyone can point to a blog, or any tips that would be great. My question is how would i go about it?
Thank You
What you want to do is called raw Ethernet. Of course this can be done.
On the microcontroller side you need to follow its Ethernet controller datasheet to send out and receive packets. On the PC side this is a bit more complicated and depends on the OS that is running on the PC. On Windows you can use the WinPcap driver to send and receive raw Ethernet packets.
Be aware, that both Ethernet controllers, the one on the PC and the one on the microcontroller, filter all incoming packets that do not contain the receivers MAC address or any multicast/broadcast address. For a simple check the broadcast address (all address bits are 1) will do.
Also note, that the OS on your PC will transmit all kind of packets as soon as the link is established. So you may use a unique protocol identifier in the type field of your raw Ethernet frame. Check Wikipedia's article about Ethernet frames. Btw. don't get confused. You only need to send MAC-adresses, Ethertype and the payload. Everything else, like the CRC, preamble etc., is added by the Ethernet controller automatically.

XBee Send To All

I have a simple xbee network operating where there are a bunch of slaves operating remotely and all talking to one master, who is connected to the server computer. That works no problem.
The slaves all send their ID as part of the packet and I'd like to have the master deliberately send an Ack after a delay. I'm trying to figure out how to do this efficiently and it seems that the only plausible way that doesn't involve reprogramming the master before each Ack is to send the Ack to all slaves and have them ignore the packet if it's not meant for them.
That solution is ok - I just can't figure out the command to use to do this. Is there some sort of Serial sendAll command? All of the devices are on the same ATID.
Typically in this situation, you would configure the master in API mode so you would get "Receive Explicit" frames with source addressing information, and could send with the "Transmit Explicit" frame type, and include addressing information in your frames.
If you use AT mode (transparent serial mode), then you're stuck having to change the DH and DL parameters on your coordinator every time you want to change who you send to. You should avoid using broadcast packets, since each one results in lots of network traffic (IIRC, each router will send the broadcast packet three times).
I do not know of a good XBee library on the Arduino, but it might be possible to port Digi's Open Source ANSI C XBee Host Library to that platform.

Resources