While checking RIOT as an alternative R-Tos (linux, FreeRTOS) i tried to get the gnrc_networking example to run … To simplify things I started with a supported Board OLIMEX-Gateway Rev-F … After reading the docs I was able to build & flash the hnrc_networking example, but after starting => RTC_SLOW_CLK calibration value: 3528926 Auto init random,Auto init xtimer,Auto init gnrc_pktbuf,Auto init gnrc_pktdump,Auto init gnrc_ipv6, Auto init gnrc_udp,Auto init gnrc_ipv6_nib,Auto init gnrc_netif, initializing ESP32 Ethernet MAC (EMAC) device External clock input 50MHz on GPIO0, Base MAC address is not set, read default base MAC address from BLK0 of EFUSE, Auto init gnrc_rpl, main(): This is RIOT! (Version: 2021.04-devel-665-g872408) RIOT network stack example application, All up, running the shell now >emac start !!! emac reset done,phy_lan8720_init(), LAN8720 Registers: ALL = 0xffff ?? I get always Timed out waiting for PHY register 0xXX (XX of [2,3]) to have value 0xc0f0 (mask 0xfff0) regulary (1 /sec) Any Idea why this happened ??
I think the board is already supported as
You have to add
USEMODULE += olimex_esp32_gateway to your
Makefile to select the Gateway variant.
(Granted, this is a bit unusual and should better be moved to be it’s own board)
Thank you for your input, but while reading the docs I already add the USEMODULE += olimex_esp32_gateway In the Makefile of the example … And yes maintaining 2 Boards with one Board + USEMODULE Trick seems not to be the right choice… I think, there must be some Parameter (EMAC_XXXX) which are not correkt ?? Is my first RIOT tries, so perhaps also some stupid errors might happened ,
Something seems to be wrong with the Ethernet configuration there - maybe @gschorcht knows more?
If it helps you, you could use WiFi for now, should just be
USEMODULE += esp_wifi and then
CFLAGS += -DESP_WIFI_SSID=\"Your SSID\" CFLAGS += -DESP_WIFI_PASS=\"Your Password\"
WiFi is not an option (speed, latency,…) The planed app has to be able to handle > 10 Mbit/sec traffic continuesly … The Board is selected, because of its ETH_MAC …
Comparing the schematic with the MAC configuration doesn’t reveal any obvious errors.
What is the ‘Current value’ of the PHY registers you get in your error?
I get continuously : 0x2, 0x3 => 0xffff Timed out waiting for PHY register 0x3 to have value 0xc0f0 (mask 0xfff0). Current value 0xffff Timed out waiting for PHY register 0x2 to have value 0x0007 (mask 0xffff). Current value 0xffff Timed out waiting for PHY register 0x3 to have value 0xc0f0 (mask 0xfff0). Current value 0xffff
The problem seems to be that Rev. F of Olimex ESP32 Gateway is using another GPIO for the 50 MHz clock. While all revisions of Olimex ESP32-EVB as well as Olimex ESP32-GATEWAY up to Rev. C are using
GPIO0 as 50 MHz clock, Olimex ESP32-GATEWAY Rev. D and above are using
Unfortunatly, this pin is not yet configurable in board/esp32-olimex-evb/include/board.h because it wasn’t necessary before and I didn’t realize that it was changed with Olimex ESP32-GATEWAY Rev. D.
I have to check how you can workarround.
OK, I checked it again in more detail. Olimex ESP32-GATEWAY up to Rev. C used an external 50 MHz oscillator as clock input for the PHY tranceiver LAN8710A. However, from Rev. D it uses GPIO17 as clock for it. There is no external 50 MHz oscillator anymore and ESP32 is generating the clock at GPIO17.
EMAC_PHY_CLOCK_MODE has to be changed to
ETH_CLOCK_GPIO17_OUT in board/esp32-olimex-evb/include/board.h.
As a short-term workaround, you could try the following change in your board/esp32-olimex-evb/include/board.h to
#define EMAC_PHY_CLOCK_MODE ETH_CLOCK_GPIO17_OUT
As long-term solution, we have to consider different revisions of Olimex ESP32-GATEWAY.
@gschorcht Thank you for the information, I changed it as mentioned … The Test is not possible, because flash seems to be unable to reset the board, and at the moment I am at home … I need to change the baud rate for flashing to 115200, port is /dev/ttyUSB2 … The Device is adjust with PORT=/dev/ttxUSB2 but howto set the Baudrate ?? Anyway I build it (hopefully the GPIO-Pin 17 ist correctly init, and I will give feedback on Monday (latest…)
A baudrate of 115200 bps is used by default for ESP32 boards by the flasher program
@gschorcht: Okay back to the board, … => Success. I asked for the baudrate, because if I do make flash-only it results in … …/RIOT/dist/tools/esptool/esptool.py --chip esp32 --port /dev/ttyUSB2 --baud 460800 … So I do cut-copy-paste with 115200 …
Ok, I have to correct me, the default programmer speed is indeed 460800 baud. But, you can change it by setting the PROGRAMMER_SPEED environment variable using
BOARD=esp32-olimex-evb USEMODULE=olimex-esp32-gateway make ... PROGRAMMER_SPEED=115200
Are you sure that flashing this board doesn’t work with 460800 baud?
@gschorcht Ok I checked back and also flashing with 460800 succed (but very unreliable, means I test several times, and than it works, while using 115200 it just works about 100 % after pressing the reset button…)
I see. I have never seen such problems. As I said, you can set programmer speed at command line.
Can we also use
ETH_CLOCK_GPIO17_OUT on the older revisions or should we split the board definition?
No, the older version(s) uses different platine layouts, so
ETH_CLOCK_GPIO17_OUT just doesn’t work
there and vice versa …
maybe we need a new Parameter(s) for couper Ethernet on ESP32 Devices, because there are also different boards out there (e.g. WESP32) which uses
Parameter 1.) eth.CLOCK_GPIO0_IN ,
Parameter 2.) mdc = 16
Parameter 3.) mdio = 17 …
(see https://wesp32.com/files/wESP32-Product-Brief.pdf, page 13…)
maybe a table with the used combination(s) off these common Parameter helps ?