Design of Contiki Protocol Stack Based on CSMA Protocol Principle

ConTIki consists of several independent modules. It is an open source, multi-tasking event-driven embedded network-specific operating system, a micro-lightweight controller, and a wireless sensor network protocol stack Rime. The entire application, including kernel, libraries, and user code, is useful for some periodic operations or network protocols.

one. Protocol stack overall framework

The ConTIki system has designed a hierarchical framework as shown in Figure 1.1 to support multiple hardware platforms and software protocols. The macro definition of conTIki-conf.h allows users to flexibly select protocol types, such as:

#define NETSTACK_CONF_NETWORK rime_driver

#define NETSTACK_CONF_MAC csma _driver

#define NETSTACK_CONF_RDC cxmac_driver

#define NETSTACK_CONF_RADIO sx1278_radio_driver

#define NETSTACK_CONF_FRAMER framer_nullmac

Principle of CSMA protocol Design of Contiki protocol stack

Figure 1.1 Protocol stack hierarchy

The hierarchical protocol categories supported by ConTIki V2.7 are shown in Figure 1.2, where NETSTACK_MAC is a conceptual level. The actual processing MAC logic is done by NETSTACK_RDC (Radio Duty Cycling); while the NETSTACK_RADIO layer supports RF drivers, users can freely expand. .

Principle of CSMA protocol Design of Contiki protocol stack

Figure 1.2 Protocol types supported by Contiki V2.7

two. Send and receive radio packet calls and timing

Receive Radio Packet

Figure 2.1 shows the call logic and timing of receiving the Radio Packet. When the RF hardware receives the data packet, the ISR notifies rf_process, rf_process calls from the bottom to the top: RDC-"MAC-"NETWORK protocol stack receive function, and finally submits the data packet The process that is bound to the application.

Principle of CSMA protocol Design of Contiki protocol stack

Figure 2.1 Receiving Radio Packet

2. Send the Radio Packet

As shown in Figure 2.2, process_i needs to send an abc (Anonymous best-effort local area Broad Cast) packet, the process calls from top to bottom: MAC-"RDC-" RADIO protocol stack send function, and finally radio through radio frequency hardware transmission.

Principle of CSMA protocol Design of Contiki protocol stack

Figure 2.2 Sending a Radio Packet

three. Principle of CSMA (Carrier Sense Multiple Access) protocol

The CSMA protocol provides a relatively reliable MAC layer transmission. After each call to the RDC layer to send a data packet, it determines whether it needs to buffer and retransmit the data packet based on the feedback information.

The key data structure of CSMA is shown in Figure 3.1. The struct neighbor_queue caches packets according to different receiving addresses. The struct rdc_buf_list links packets of different PACKETBUF_ATTR_MAC_SEQNO with the same receiving address. The struct queuebuf saves the header and data entity that need to be retransmitted. ;struct qbuf_metadata stores information such as callback function pointers.

Principle of CSMA protocol Design of Contiki protocol stack

Figure 3.1 csma key data structure

The CSMA selects the corresponding logical action according to the feedback information of the data packet sent by the RDC layer:

MAC_TX_OK: Send successfully, reclaim cache data structure and work afterwards;

MAC_TX_NOACK: Start ctimer, retransmit after random delay, until the number of transmissions exceeds MAX;

MAC_TX_COLLISION: The retransmission is continued and the number of transmissions is not limited.

A typical timing of a CSMA is shown in Figure 3.2. When the RDC layer sends the data packet, the CSMA callback function packet_sent() selects the action according to the result of the transmission (see logical description above). If retransmission is required, select one according to the number of retransmissions. The ctimer is set at random time, and the cached packet is sent again when the ctimer timer expires.

Principle of CSMA protocol Design of Contiki protocol stack

Figure 3.2 csma logic and timing

CAT8 Ethernet Cable

Category 8, or just Cat8, is the latest standard in copper Ethernet Cable. It represents a significant leap in data transfer speed over the earlier Cat7 and Cat6a network cables. It uses standard RJ45 connectors and is backwards compatible with previous standards.

Cat8 is the fastest Ethernet cable yet. It's data transfer speed of up to 40 Gbps is four times faster than Cat6a, while its support of bandwidth up to 2 GHz (four times more than standard Cat6a bandwidth) reduces latency for superior signal quality.

CAT8 Ethernet Cable-05

Cat 8 Cable,Cat8 Ethernet Cable,Cat8 Indoor Ethernet Cable,High Speed Cat8 Cable

Shenzhen Kingwire Electronics Co., Ltd. , https://www.kingwires.com