ESP32-LAN8720 custom board: get no IP address

bruchmueller
Posts: 18
Joined: Tue Apr 19, 2022 2:36 pm

ESP32-LAN8720 custom board: get no IP address

Postby bruchmueller » Thu Jul 28, 2022 4:20 pm

Dear all,

we made a custom board, where we now have the 3th revision. The ESP32-WROVER is connected via RMII to a LAN8720. The earlier Revisions had an ESP32-WROOM, and the Ethernet always came up. We used an 74LVC1G3157 analog switch between GPIO0on the ESP32, and the REFCLOCKO on the LAN8720, in all 3 versions. The difference between the last revision (with working Ethernet) and this revision is, that in the last revision the analog switch was activated by a ESP32-GPIO, and now by a reset monitor, what enables the analog switch 200ms after the ESP32-EN lines goes high.
The ESP32 scan some pins, like GPIO0 after boot, to enter bootloader mode or override intern settings. That's why the REFCLOCKO can not be hard wired from the LAN8720, but instead is delayed activated. But that all look ok, and I am not sure if this is the reason, why we not get an IP address.

I flashed the example from ../esp/esp-idf/examples/ethernet/basic on the board, and here is the output:
.....
D (1439) efuse: In EFUSE_BLK0__DATA1_REG is used 8 bits starting with 0 bit
D (1449) efuse: In EFUSE_BLK0__DATA2_REG is used 8 bits starting with 16 bit
D (1469) esp_eth: new ethernet driver @0x3ffbd4c4
I (1469) esp_eth.netif.netif_glue: 4c:75:25:5b:c6:db
I (1469) esp_eth.netif.netif_glue: ethernet attached to netif
D (1469) esp_eth: ---> esp_eth_start after -> ESP_GOTO_ON_FALSE(eth_driver, ESP_ERR_INVALID_ARG, err, TAG, ...);
D (1479) esp_eth: ---> esp_eth_start after atomic_compare_exchange_strong
D (5489) esp_eth: ---> esp_eth_start after phy->negotiate
D (5489) event: running post ETH_EVENT:0 with handler 0x400d9d20 and context 0x3ffbd590 on loop 0x3ffb8dcc
0x400d9d20: eth_action_start at /home/micha/esp/esp-idf/components/esp_eth/src/esp_eth_netif_glue.c:125

D (5489) esp_eth.netif.netif_glue: eth_action_start: 0x3ffbd538, 0x3f406048, 0, 0x3ffbd6d8, 0x3ffbd4c4
D (5499) esp_netif_handlers: esp_netif action has started with netif0x3ffb9cf8 from event_id=0
D (5509) esp_netif_lwip: check: remote, if=0x3ffb9cf8 fn=0x400dc25c
0x400dc25c: esp_netif_start_api at /home/micha/esp/esp-idf/components/esp_netif/lwip/esp_netif_lwip.c:700


D (5509) esp_eth: ---> esp_eth_start after esp_event_post
D (5509) esp_netif_lwip: esp_netif_start_api 0x3ffb9cf8
D (5519) esp_netif_lwip: esp_netif_get_hostname esp_netif:0x3ffb9cf8
D (5529) esp_netif_lwip: check: local, if=0x3ffb9cf8 fn=0x400dcb18
0x400dcb18: esp_netif_update_default_netif_lwip at /home/micha/esp/esp-idf/components/esp_netif/lwip/esp_netif_lwip.c:188


D (5539) esp_netif_lwip: esp_netif_update_default_netif_lwip 0x3ffb9cf8
V (5539) esp_netif_lwip: esp_netif_is_netif_up esp_netif:0x3ffb9cf8
D (5549) esp_netif_lwip: call api in lwip: ret=0x0, give sem
D (5559) event: running post ETH_EVENT:0 with handler 0x400d6724 and context 0x3ffbd698 on loop 0x3ffb8dcc
0x400d6724: eth_event_handler at /home/micha/esp/eth_basic/main/ethernet_example_main.c:45

I (5569) eth_example: Ethernet Started
D (5569) esp_eth: ---> esp_eth_start after get_link
D (5579) esp_eth: ---> esp_eth_start after esp_timer_start_periodic

After the code ->eth_example: Ethernet Started<- is reached, it wait forever to receive the IP address.
The switch, where the ESP32 is connected with a Ethernet cable, does not show a device present. The green LED on the RJ45 connector on the ESP32 board light permanent, the orange LED blinks after power on or reset and is then off. The LEDs are controlled by the LAN8720

Does somebody have an idea, what could be the reason for the error? We have triple checked the hardware, and can not see why it should not work. Any hint is highly welcome.

ESP_LJH
Posts: 387
Joined: Tue May 18, 2021 9:21 am

Re: ESP32-LAN8720 custom board: get no IP address

Postby ESP_LJH » Mon Aug 01, 2022 9:15 am

Let me make sure, schematic is always the same, but when you use ESP32-WROVER ( WROVER or WROVER-B/E ? ), error arises? Address pin is configured correctly? And hardware setting corresponds to software setting, right?
Better to provide schematic for use to check.

bruchmueller
Posts: 18
Joined: Tue Apr 19, 2022 2:36 pm

Re: ESP32-LAN8720 custom board: get no IP address

Postby bruchmueller » Mon Aug 01, 2022 8:51 pm

ESP_LJH wrote:
Mon Aug 01, 2022 9:15 am
Let me make sure, schematic is always the same, but when you use ESP32-WROVER ( WROVER or WROVER-B/E ? ), error arises? Address pin is configured correctly? And hardware setting corresponds to software setting, right?
Better to provide schematic for use to check.
Dear ESP_LJH,

thanks for looking into our case. I have attached both schematics: the working ESP32-WROOM (our version 2) and the ethernet-not-working version with the WROVER module (our version 3). Both use an external oscillator, and the ESP32 receive the 50MHz RMII clock on GPIO0. Both use 3157 analog switch, to disconnect the oscillator at boot time, because the ESP32-GPIO0 is read at boot time.
The difference between both versions is:
with the WROOM version, the switching of GPIO0 was done by a I2C-IOexpander
with the WROVER version, the switching of GPIO0 was done by a 200ms delay of the reset circuit, means 200ms AFTER the EN pin of the WROVER modules goes high, the analog switch connect to the ESP32-GPIO0
Attachments
WROOM_LAN8720.pdf
working LAN8720 with the WROOM32 module
(630.12 KiB) Downloaded 791 times
WROVER_LAN8720.pdf
Ethernet problem with the WROVER
(529.31 KiB) Downloaded 826 times

ESP_ondrej
Posts: 211
Joined: Fri May 07, 2021 10:35 am

Re: ESP32-LAN8720 custom board: get no IP address

Postby ESP_ondrej » Mon Aug 01, 2022 8:58 pm

Do you observe the same behavior on multiple boards or you tested just one?

bruchmueller
Posts: 18
Joined: Tue Apr 19, 2022 2:36 pm

Re: ESP32-LAN8720 custom board: get no IP address

Postby bruchmueller » Tue Aug 02, 2022 10:18 am

ESP_ondrej wrote:
Mon Aug 01, 2022 8:58 pm
Do you observe the same behavior on multiple boards or you tested just one?
We have the same problem on 2 boards. It does not look to be a production issue.

I have just tested all 4 WROVER board, we have. They all show the same behavior.

ESP_ondrej
Posts: 211
Joined: Fri May 07, 2021 10:35 am

Re: ESP32-LAN8720 custom board: get no IP address

Postby ESP_ondrej » Tue Aug 02, 2022 11:25 am

How do you synchronize your init code in ESP32 with that 200ms delay added in the last HW revision?

bruchmueller
Posts: 18
Joined: Tue Apr 19, 2022 2:36 pm

Re: ESP32-LAN8720 custom board: get no IP address

Postby bruchmueller » Tue Aug 02, 2022 2:21 pm

ESP_ondrej wrote:
Tue Aug 02, 2022 11:25 am
How do you synchronize your init code in ESP32 with that 200ms delay added in the last HW revision?
we just added a vTaskDelay(1000) before the Ethernet initialization. We use the eth_basic example project from ESP-IDF,

void app_main(void)
{
int count = 0;

printf("Start probem begin STEP %d\n", count++); fflush(stdout);
vTaskDelay(1000); <- we added 1 second delay here
printf("Start probem begin STEP %d\n", count++); fflush(stdout);
// Initialize TCP/IP network interface (should be called only once in application)
ESP_ERROR_CHECK(esp_netif_init());
printf("Start probem begin STEP %d\n", count++); fflush(stdout);
// Create default event loop that running in background
ESP_ERROR_CHECK(esp_event_loop_create_default());
printf("Start probem begin STEP %d\n", count++); fflush(stdout);

I also try to increase these time to 10 seconds, but with no other result
Last edited by bruchmueller on Wed Aug 03, 2022 6:13 am, edited 1 time in total.

bruchmueller
Posts: 18
Joined: Tue Apr 19, 2022 2:36 pm

Re: ESP32-LAN8720 custom board: get no IP address

Postby bruchmueller » Tue Aug 02, 2022 2:26 pm

ESP_ondrej wrote:
Tue Aug 02, 2022 11:25 am
How do you synchronize your init code in ESP32 with that 200ms delay added in the last HW revision?
Do we need to do anything on the ESP32 side, other then just wait until the LAN8720 is up and sourcing the 50MH clock into ESP32-GPIO0? And after this happens, starting the Ethernet initialization?

ESP_ondrej
Posts: 211
Joined: Fri May 07, 2021 10:35 am

Re: ESP32-LAN8720 custom board: get no IP address

Postby ESP_ondrej » Wed Aug 03, 2022 7:34 am

I just wanted to make sure you start initialization of the PHY after the CLK is stable. It seems you do.

However, I noticed one other difference between the schematics revisions. You replaced J1 (RJ45 with transformers) to different part number. Eth_LEDGreen- (nINTSEL) is not pulled down as used to be and is wired to diode anode instead of cathode. Hence the LED indication does not work and it could also possible affect selection of REFCLKO?? It is strange though that you are able to initialize internal EMAC which should not be possible without CLK. However, it worth to investigate since I didn't find any other issue...

bruchmueller
Posts: 18
Joined: Tue Apr 19, 2022 2:36 pm

Re: ESP32-LAN8720 custom board: get no IP address

Postby bruchmueller » Wed Aug 03, 2022 3:14 pm

ESP_ondrej wrote:
Wed Aug 03, 2022 7:34 am
I just wanted to make sure you start initialization of the PHY after the CLK is stable. It seems you do.

However, I noticed one other difference between the schematics revisions. You replaced J1 (RJ45 with transformers) to different part number. Eth_LEDGreen- (nINTSEL) is not pulled down as used to be and is wired to diode anode instead of cathode. Hence the LED indication does not work and it could also possible affect selection of REFCLKO?? It is strange though that you are able to initialize internal EMAC which should not be possible without CLK. However, it worth to investigate since I didn't find any other issue...
Hi ESP_ondrej,
I have to admit, that the schematic of the previous version did not had the pull-down from LAN8720-pin2(LED2/nINTSEL). We soldered that resistor (2k2) by hand, and only after we soldered that resistor by hand, the Ethernet was working. That's why we added R54 in the current schematic. I forgot about that, sorry.

Second, the green LED on the schematic of the previous version is shown wrong. The schematic symbol shows the Anode and Cathode flipped, the netnames are correct. The assembled RJ45 connector is the HR911105A (https://datasheet.lcsc.com/lcsc/1811141 ... C12074.pdf), and it have the Anode on pin 9, Cathode on pin 10. We didn't realize this schematic mistake before.

1. You are right, we used a different RJ45 connector, what have PoE pins. We checked several times the pinout of the RJ45 connector, including the LED Anode and Cathode. It all look correct on the current board (and a mess on the previous board).

2. We measure the ESP32-GPIO0 pin with our scope, on both the working board and the problem board. We see a sine signal with 50MHz going into the ESP32-GPIO0. When we press the Reset button, the 50MHz signal disappears, as it should. And when releasing the Reset button, the 50MHz signal arrive again at the ESP32-GPIO0. (The sine 50MHz is only 280mV, but so on both boards) This lead me to the conclusion
- Oscillator for the LAN8720 is working,
- the LAN8720 is configured correctly, because it outputs the REFCLOCKO,
- the ESP32-GPIO0 receive the 50MHz clock signal after the 200ms delay.

3. I have measured the internal regulator 1.2V of the LAN8720. It outputs 1.2V, what its stabilized with C13+C14 (2.2uF+100nF).

LEDs:
Eth_LEDGreen+ goes, via 330R resistor, to 3.3V (on both old and new boards), green LED Anode. The previous (working) board schematic, shows Anode/Cathode of the green LED flipped, but layout and datasheet is correct.

Eth_LEDGreen- goes to LAN8720-pin 2, and pull down with 2k2 to GND (in the old version, we had hand soldered that resistor), green LED Cathode. Again, the schematic of the previous (working) board shows Anode and Cathode wrong, but schematic and datasheet are correct.

Eth_LEDYellow+ goes to LAN8720-pin 3, (on both old and new boards), yellow LED Anode.

Eth_LEDYellow- goes, via a 330R resistor, to GND (on both the old and new boards), yellow LED Cathode. In the new board schematic, the yellow LED Cathode does not have a netname, but its connected via R5 to GND.



The LAN8720 PHYAD0 is pulled down with 2k2 -> Phy Address = 0
The LAN8720 nINTSEL is pulled down with 2k2 -> LAN8720 is REF_CLK Out Mode.
The LAN8720 MODE0(RXD0), MODE1(RXD1) and MODE2(ERS_DV) are pulled UP with 2k2, so MODE[2:0] is 111. -> All capable. Auto-negotiation enabled.

After power on, the green LED of the RJ45 connector is permanent on. But on the Ethernet switch, no light on the port where its plug ed in. The yellow LED never goes on.

I soldered a 22uF capacitor on the LAN8720-VDD2A, but no success so far.

Could it be, that something on the auto-negotiation goes wrong? Is there a way to encircle the error by adding more debug info in software?

Who is online

Users browsing this forum: No registered users and 133 guests