# Mm-iot-esp32 IP Layer

**URL:** <https://community.morsemicro.com/t/mm-iot-esp32-ip-layer/257>\
**Category:** Embedded\
**Created:** [January 24, 2025, 12:12am UTC](https://community.morsemicro.com/t/mm-iot-esp32-ip-layer/257 "2025-01-24T00:12:57Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Rob](https://sea1.discourse-cdn.com/flex001/user_avatar/community.morsemicro.com/rob/32/45_2.png) [@Rob](https://community.morsemicro.com/u/Rob)\
**Post date:** [January 24, 2025, 9:48am UTC](https://community.morsemicro.com/t/mm-iot-esp32-ip-layer/257/2 "2025-01-24T09:48:35Z")

</div>

Hi,  
I’ll split my answer into two parts.

_ **1. Examples utilizing some of the Espressif examples** _

As it so happens I have been working on exactly this recently in my spare time 😅. I’ve put my current state of the art up on github for you to have a look at. I currently have two examples

1. A http webserver that you can hit to view an image captured by a camera attached to the esp32
2. A mqtt client that will publish and image taken by a camera attached to the esp32

It’s still early days but I think it should give you a good starting point for integrating HaLow into other examples in the esp-idf. Any feedback or additions would be more than welcome.

> **[GitHub - RobertWCarey/esp-halow-examples](https://github.com/RobertWCarey/esp-halow-examples)**
>
> Contribute to RobertWCarey/esp-halow-examples development by creating an account on GitHub.

_ **2. How can you glue the MM6108 to the network stack** _

I think a good starting point to understanding this is to take a look at this comment [Documentation SPI Command Set MM6108-MF08651-US - #8 by matt](https://community.morsemicro.com/t/documentation-spi-command-set-mm6108-mf08651-us/181/8) . In that comment you can see the ‘LWIP Shim’ is the glue that allows the network interface to talk to the MM6108. The code for this can be found [here](https://github.com/MorseMicro/mm-iot-esp32/tree/main/framework/src/mmipal/lwip) for the mm-iot-esp32 repo. An important thing to keep in mind is this is just the data-path (i.e. Ethernet frames) and does not cover WLAN control API (connect, disconnect), they are all handled separately through the mmwlan API.

So effectively there is going to be a call to transmit date and a call the receive data. In the case of mm-iot-esp32-2.6.4 these are (glossing over details like packet allocation and link status):

```c
/**
 * Transmit the given packet. The packet must start with an 802.3 header, which will be
 * translated into an 802.11 header by this function.
....
 */
enum mmwlan_status mmwlan_tx_pkt(struct mmpkt *pkt, const struct mmwlan_tx_metadata *metadata);

```

and

```c
/**
 * Receive data packet callback function.
 *
 * @param header Buffer containing the 802.3 header for this packet.
 * @param header_len Length of the @p header.
 * @param payload Packet payload (excluding header).
 * @param payload_len Length of @p payload.
 * @param arg Opaque argument that was given when the callback was registered.
 */
typedef void (*mmwlan_rx_cb_t)(uint8_t *header, unsigned header_len,
                               uint8_t *payload, unsigned payload_len,
                               void *arg);

/**
 * Register a receive callback.
 *
 * @note Only one receive callback may be registered. Further registration will overwrite the
 * previously registered callback.
 *
 * @note Only a single receive callback may be registered at a time.
 *
 * @param callback The callback to register (@c NULL to unregister).
 * @param arg Opaque argument to be passed to the callback.
 *
 * @return @ref MMWLAN_SUCCESS on success, else an appropriate error code.
 */
enum mmwlan_status mmwlan_register_rx_cb(mmwlan_rx_cb_t callback, void *arg);

```

See [mm-iot-esp32/framework/morselib/include/mmwlan.h at main · MorseMicro/mm-iot-esp32 · GitHub](https://github.com/MorseMicro/mm-iot-esp32/blob/main/framework/morselib/include/mmwlan.h) for more detail.

Another, place to look is [ESP-NETIF Developer's manual - ESP32 - — ESP-IDF Programming Guide v5.4 documentation](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/network/esp_netif_driver.html)

---

_[View the full topic](https://community.morsemicro.com/t/mm-iot-esp32-ip-layer/257)._
