ESP32-POE getting garbage input

Started by anicolao, March 27, 2025, 08:08:39 AM

Previous topic - Next topic

anicolao

I have built and installed micropython firmware on two similar Olimex boards, a GATEWAY device and an ESP32-POE device.

Things are mostly working, but on the POE device I often see garbage provided as input to the micropython REPL. I don't have a clear understanding of why this might be/where the garbage characters are coming from—it's as though something is connected to serial and providing input into the console, but all I have connected is the ethernet cable for network and power, and I am accessing the REPL via the websocket interface.

I would attempt to ignore it, but occasionally the garbage input includes a control-C which interrupts the micropython code I am running and is a showstopper.

Ideas on how to debug/understand what's happening would be very helpful. Note that the GATEWAY device which is in most respects the same does not exhibit the problem; only the PoE device does.

LubOlimex

Is it only during boot or also user software that is throwing garbage?

It is probably wrong baud rate or terminal settings, try with 115200. Try with another serial terminal software.

It can be also wrong settings of the environment or bad USB cable/port.
Technical support and documentation manager at Olimex

LubOlimex

Which pins exactly do you use for the serial output in the GATEWAY and in the POE? Maybe there is some specific multiplexing in the PoE that causes it. Maybe some other hardware is attached to that serial line?
Technical support and documentation manager at Olimex

anicolao

Thanks for the responses so far.

Quote from: LubOlimex on March 31, 2025, 02:55:20 PMWhich pins exactly do you use for the serial output in the GATEWAY and in the POE? Maybe there is some specific multiplexing in the PoE that causes it. Maybe some other hardware is attached to that serial line?

I am not using the serial output at all. The device is connected to a PoE ethernet cable, and all access is over the network.

Quote from: LubOlimex on March 31, 2025, 08:18:41 AMIs it only during boot or also user software that is throwing garbage?

It is not only during boot. It can happen at any time; and the garbage is independent of the characters I type or whether I am typing at all; plus the characters I type go through no problem, and the output from the REPL is never corrupted; only the input stream.

Since there is no serial connection, the suggestions about baud rates do not apply.

In a different scenario, I was also using the device over USB with nothing connected to the ethernet port. Surprisingly, I saw the same garbage effect there, though much less frequently.

I have bought a second board and will attempt to reproduce with it. I suspect my first board has a fault, but I don't know how to track it down.

anicolao

I had hoped my new device wouldn't ahve the issue, but unfortunately it does. Here's what it looks like:

>>> logger.tail()
2000-01-01 05:14:51 UTC (41708ms): 0
2000-01-01 05:14:51 UTC (0004ms): 1
2000-01-01 05:14:51 UTC (0004ms): 2
2000-01-01 05:14:51 UTC (0005ms): 3
2000-01-01 05:14:51 UTC (0005ms): 4
2000-01-01 05:14:51 UTC (0004ms): 5
2000-01-01 05:14:51 UTC (0005ms): 6
2000-01-01 05:14:51 UTC (0005ms): 7
2000-01-01 05:14:51 UTC (0005ms): 8
2000-01-01 05:14:51 UTC (0004ms): 9
>>> logger.tail():<>~:~w~
Traceback (most recent call last):
  File "<stdin>", line 1
SyntaxError: invalid syntax
>>> logger.tail()
2000-01-01 05:14:51 UTC (41708ms): 0
2000-01-01 05:14:51 UTC (0004ms): 1
2000-01-01 05:14:51 UTC (0004ms): 2
2000-01-01 05:14:51 UTC (0005ms): 3
2000-01-01 05:14:51 UTC (0005ms): 4
2000-01-01 05:14:51 UTC (0004ms): 5
2000-01-01 05:14:51 UTC (0005ms): 6
2000-01-01 05:14:51 UTC (0005ms): 7
2000-01-01 05:14:51 UTC (0005ms): 8
2000-01-01 05:14:51 UTC (0004ms): 9
>>> ce"":
Traceback (most recent call last):
  File "<stdin>", line 1
SyntaxError: invalid syntax

I typed the first logger.tail(); the second one seems the result of an up-arrow keycode followed by the ascii garbage :<>~:~w~,; then I repeated the logger.tail(), and then there's more ascii garbage.

The garbage strings are in the interpreter's history, showing that from Micropython's perspective I typed these characters.

Nothing is connected to USB; I am connected to the REPL via a websocket over ethernet. The device is not running much: the micropython interpreter and the code that tails the log file is about it. The device was recently reset by the watchdog timer.

LubOlimex

Based on your tests I'd assume it is due it:

- some difference between the hardware design of ESP32-POE and ESP32-GATEWAY;
- some software issue in Microphyton's settings that doesn't reflect the hardware differences between ESP32-POE and ESP32-GATEWAY.

So let me get this straight:

1. You tested with just ESP32-POE and USB cable (no other hardware connected to ESP32-POE). And sometimes you see garbage output?

2. Did you test with another code just to confirm it is not an issue with the software? Something alternative or simpler?
Technical support and documentation manager at Olimex

anicolao

Quote from: LubOlimex on April 07, 2025, 08:12:30 AM- some difference between the hardware design of ESP32-POE and ESP32-GATEWAY;
- some software issue in Microphyton's settings that doesn't reflect the hardware differences between ESP32-POE and ESP32-GATEWAY.

I believe it must be the first, a hardware flaw in the ESP-POE; though I can look into the second a bit.

Quote from: LubOlimex on April 07, 2025, 08:12:30 AMSo let me get this straight:

1. You tested with just ESP32-POE and USB cable (no other hardware connected to ESP32-POE). And sometimes you see garbage output?

No, ths is wrong on two counts. First of all, I am not using the USB cable at all generally; PoE ethernet alone is connected to the device and that is when the problem occurs most frequently. Secondly, it is not garbage output, it is garbage input. Of course the garage input also causes output errors, but the output is never corrupted.

Now it does happen to be the case that I have also seen the issue with just the USB cable connected, but very rarely. Partly because I do not use it in this mode very often, perhaps.

Quote from: LubOlimex on April 07, 2025, 08:12:30 AM2. Did you test with another code just to confirm it is not an issue with the software? Something alternative or simpler?

I haven't tested with something simpler than using Micropython over the network. If you have a proposal of a simpler test, I'd be interested to hear it; I'm not actually aware of any other software that has the ability to provide a console-like experience over sockets instead of via the USB port.

anicolao

Digging into your suggestion that it is a software issue in my build of Micropython, I found that there is a board configuration specifically for OLIMEX_ESP32_POE and the firmware I built was for a "Generic" ESP32 board. So building the firmware for the Olimex board specifically seems an important next step!

LubOlimex

Power control pin for the Ethernet is different between GATEWAY and POE, this might affect the start up of the Ethernet PHY:

https://docs.micropython.org/en/latest/esp32/quickref.html

https://micropython.org/download/OLIMEX_ESP32_POE/
Technical support and documentation manager at Olimex

anicolao

Quote from: LubOlimex on April 07, 2025, 04:48:22 PMPower control pin for the Ethernet is different between GATEWAY and POE, this might affect the start up of the Ethernet PHY

Yes, that's true. If the power pin isn't turned on the esp throws an error about a wrong OID or something like that. My code checks the machine's unique id to decide if it is on the GATEWAY, the PoE device, or the Ind-PoE device and sets the pin appropriately in each case (5, 12, 12 respectively). Without that the ethernet wouldn't work at all as the FET that controls it wouldn't be on/it would have no power.

I had hoped that perhaps using the official central build for the Olimex PoE device that the micropython site provides instead of the generic binary I had built would solve the problem, but unfortunately it just reproduced again for me, so it's not a question of how I built the firmware. I also looked through the configuration differences between the generic build and the custom board info for the Olimex and didn't spot an obvious smoking gun. So a software issue is still possible, but seems less likely than I'd hoped when I realized that I was using a generic image rather than the board specific image.

anicolao

To my great surprise, this evening the problem reproduced on the GATEWAY device as well. So in fact it happens on all three boards, which admittedly are all running the same firmware and software.

On the GATEWAY it happened hwen I first connected the device to the USB port.

LubOlimex

Did you also post in the micropython forums (https://forum.micropython.org/) or their GitHub Discussions (https://github.com/orgs/micropython/discussions/categories/esp32)? They would probably know better, also a lot of people from the community are familiar with our boards. It is worth a shot.
Technical support and documentation manager at Olimex