ESP32-POE netboot wired ethernet

Started by marekm, April 25, 2025, 02:17:37 PM

Previous topic - Next topic

marekm

I'm working on an application that will be put in a difficult to access place (on a 12m high mast where it sends data from an accelerometer and a wind speed sensor, not using WiFi/BT just wired Ethernet with PoE), would like to be able to update the software without risk of bricking.

Is there some kind of existing open source bootloader that could be put into the flash, do the usual DHCP+TFTP to configure the network and load the application from the server to RAM (can executable code be put in the external PSRAM?) and run it there?  If it crashes, power-cycle the board to reload the updated software from the server.  No need to flash the application permanently, as it depends on the server anyway to process the data.  Kind of like diskless boot of a PC from a boot ROM on the network card - is this possible?

The prototype is built into the case of this anemometer https://www.amazon.pl/seav-Seav-anemometr-nowy/dp/B07ZJWLG3S which has just enough room inside for the ESP32-POE board (the smaller non-isolated one) and small board with digital SPI MEMS accelerometer (EVAL-ADXL355Z, the most expensive part).

LubOlimex

Technical support and documentation manager at Olimex

marekm

I've looked into OTA but it's not exactly what I'm looking for.
Over the wire (not air), dedicated VLAN not on the Internet so it doesn't have to be secure.
No flash writes, no configuration stored on board (only by DHCP), load and run from RAM every time (so no wear on the flash and no way to lose access to the device, except with special firmware that runs from RAM and updates the boot flash, but that should be very rare and well tested on the ground first).
It doesn't have to be ESP32-POE, but that board has just the right size and PoE built-in (too little space available for separate PoE DC/DC modules).
Can be 48V active or 24V passive PoE, will be powered from MikroTik CRS318-16P-2S+OUT which can do either.
Need just two devices so makes no sense to design custom boards, just use what is already available.
A few years ago I've done something similar on a Blackfin DSP board where U-boot in flash boots ucLinux to RAM over DHCP+TFTP. Linux support for that architecture was dropped and I left that job a bit later, maybe I was the last user :)

LubOlimex

The first sentence:

"The OTA update mechanism allows a device to update itself based on data received while the normal firmware is running (for example, over Wi-Fi, Bluetooth or Ethernet)."

Check here also (find in page "Ethernet"):

https://github.com/espressif/esp-idf/blob/master/examples/system/ota/README.md
Technical support and documentation manager at Olimex

marekm

Good to see OTA works over wired Ethernet too, but as I understand, it still writes the flash, and the device would need some kind of user interface (like a button) to start the update.  But my device will be difficult to access physically (high on a mast), and the only button to speak of is remote PoE power-cycle.  So I'm looking how to make simple firmware that will initialize the network (set up the MAC and PHY, get IP via DHCP) then load the software from a server (specified by DHCP options) via TFTP to RAM (only, no flash writes) and start it there - at this point the boot firmware is no longer needed, RAM used by it can be freed and used by the newly loaded application.  The "network boot loader" would probably need to be careful not to overwrite itself with the newly loaded image, probably located at a non-standard RAM address.  Has anything like this been done on this platform before?

LubOlimex

Theoretically it should be possible but I am not sure if it had been done or if it is supported. And if that is the case the software effort will be really taxing - writing low-level and registers code.

Unfortunately, my knowledge goes just that far, and it is best idea to search and ask in the espressif forums if this had been done. They'd know the software stuff better.
Technical support and documentation manager at Olimex