ETH_CLOCK_GPIO0_OUT not working (No clock output)

kitts82
Posts: 12
Joined: Mon Dec 18, 2017 11:57 am

ETH_CLOCK_GPIO0_OUT not working (No clock output)

Postby kitts82 » Sun Jun 16, 2019 2:09 pm

I'm testing ethernet with the ESP32-PICO-KIT + Waveshare LAN8720 module.

I got ethernet working as per https://sautter.com/blog/ethernet-on-es ... g-lan8720/ but I now want to use GPIO0 as clock output instead of input.

To achieve this, I removed R12 and R14 resistors on the waveshare board and jumped between R12 and R14 with one of the 33ohm resistors so that the R_RXCLK pin on the board is connected to the CLKIN pin of the chip through the 33ohm resistor.

I changed one line of the code to read "config.clock_mode = ETH_CLOCK_GPIO0_OUT".

On trying this code i get the error "emac: Timed out waiting for PHY register 0x2 to have value 0x0007(mask 0xffff). Current value 0xffff". On checking with an oscilloscope, i do not see any clock generated on the GPIO0 pin.

What am I doing wrong? Any help is appreciated.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: ETH_CLOCK_GPIO0_OUT not working (No clock output)

Postby WiFive » Sun Jun 16, 2019 2:48 pm

Which esp-idf version do you use?

kitts82
Posts: 12
Joined: Mon Dec 18, 2017 11:57 am

Re: ETH_CLOCK_GPIO0_OUT not working (No clock output)

Postby kitts82 » Mon Jun 17, 2019 7:08 am

WiFive wrote:
Sun Jun 16, 2019 2:48 pm
Which esp-idf version do you use?
git master.
$ git describe
v4.0-dev-837-g58df1d93b

kitts82
Posts: 12
Joined: Mon Dec 18, 2017 11:57 am

Re: ETH_CLOCK_GPIO0_OUT not working (No clock output)

Postby kitts82 » Mon Jun 17, 2019 7:45 am

Just to be sure, I checked out release/v3.2 and switched the compiler to recommended version (5.2) but the problem is the same.

kitts82
Posts: 12
Joined: Mon Dec 18, 2017 11:57 am

Re: ETH_CLOCK_GPIO0_OUT not working (No clock output)

Postby kitts82 » Mon Jun 17, 2019 12:30 pm

Does the 50MHz clock have any relation to configuring the lan8720? Why does register setup fail when I disconnect the oscillator? I can see the clock on the scl line.

kitts82
Posts: 12
Joined: Mon Dec 18, 2017 11:57 am

Re: ETH_CLOCK_GPIO0_OUT not working (No clock output)

Postby kitts82 » Tue Jun 18, 2019 10:20 am

Is there anyway to debug this? I would like to avoid the extra pin to enable the oscillator and the cost of the oscillator itself. Hence, I would like to use GPIO0_OUT. GPIO16 and GPIO17 are unavailable on PICO-D4.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: ETH_CLOCK_GPIO0_OUT not working (No clock output)

Postby WiFive » Tue Jun 18, 2019 8:19 pm

The lan8720 needs a clock to do anything, not sure why there is no output on gpio0 for you

kitts82
Posts: 12
Joined: Mon Dec 18, 2017 11:57 am

Re: ETH_CLOCK_GPIO0_OUT not working (No clock output)

Postby kitts82 » Wed Jun 19, 2019 6:31 am

WiFive wrote:
Tue Jun 18, 2019 8:19 pm
The lan8720 needs a clock to do anything, not sure why there is no output on gpio0 for you
Yes. I can confirm that on the same setup the config fails when I simply disable the 50MHz clock.


I checked again with an oscilloscope with GPIO0 open (disconnected from LAN8720) and i can see that ~50MHz clock does come on GPIO0 when setup with GPIO0_OUT but I noticed that the amplitude of the clock is very small (~0.2V peak to peak) while the same from the oscillator is nearly 2V peak to peak. Could this have anything to do with it?

kitts82
Posts: 12
Joined: Mon Dec 18, 2017 11:57 am

Re: ETH_CLOCK_GPIO0_OUT not working

Postby kitts82 » Thu Jun 20, 2019 11:50 pm

Is there any way to increase the clock out amplitude as I suspect that to be the problem?

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], ESP_Sprite, Majestic-12 [Bot] and 27 guests