ESP32 ethernet, SPI, JTAG pin questions

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: ESP32 ethernet, SPI, JTAG pin questions

Postby rudi ;-) » Fri Mar 03, 2017 2:16 am

colman wrote:I am using LAN8720, it always output the 50MHz RMII clock even though it is being reset, there is no clock enable/disable option via software programming.

Colman
do you use the LAN8720 Modul , the LAN8720 EVB from MC or own circuit?
is your gpio 0 pulled up? which value?

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: ESP32 ethernet, SPI, JTAG pin questions

Postby rudi ;-) » Fri Mar 03, 2017 2:35 am

colman wrote:.. there is no clock enable/disable option via software programming.
then you must do by self:

Code: Select all

#define PIN_PHY_POWER 17
..

Code: Select all

void phy_device_power_enable(bool enable)
{
    gpio_pad_select_gpio(PIN_PHY_POWER);
    gpio_set_direction(PIN_PHY_POWER,GPIO_MODE_OUTPUT);
    if(enable == true) {
        gpio_set_level(PIN_PHY_POWER, 1);
        ESP_LOGI(demo_tag, "phy_device_power_enable(TRUE)");
    } else {
        gpio_set_level(PIN_PHY_POWER, 0);
        ESP_LOGI(demo_tag, "power_enable(FALSE)");
    }
}
..

example:( your friend )

Code: Select all

void app_main()
{
    esp_err_t ret = ESP_OK;
    tcpip_adapter_init();
    esp_event_loop_init(NULL, NULL);

    eth_config_t config;
    config.phy_addr = CONFIG_PHY_ID;
    config.mac_mode = ETH_MODE_RMII;
    config.gpio_config = eth_gpio_config_rmii;
    config.tcpip_input = tcpip_adapter_eth_input;
    //Only FULLDUPLEX mode support flow ctrl now!
    config.flow_ctrl_enable = true;
    config.phy_init = phy_device_init;
    config.phy_check_init = phy_device_check_phy_init;
    config.phy_check_link = phy_device_check_phy_link_status;
    config.phy_get_speed_mode = phy_device_get_speed_mode;
    config.phy_get_duplex_mode = phy_device_get_duplex_mode;
    config.phy_get_partner_pause_enable = phy_device_get_partner_pause_enable;
 
 /* your friend */
    config.phy_power_enable = phy_device_power_enable;
 
    ret = esp_eth_init(&config);

    if(ret == ESP_OK) {
        esp_eth_enable();
        xTaskCreate(eth_task, "eth_task", 2048, NULL, (tskIDLE_PRIORITY + 2), NULL);
	
    }

}
hope this helps

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

colman
Posts: 37
Joined: Mon May 30, 2016 7:41 am

Re: ESP32 ethernet, SPI, JTAG pin questions

Postby colman » Fri Mar 03, 2017 8:11 am

I know I can disconnect it by adding a switch controlled by a GPIO, but there is no more GPIO left. So if possible, I prefer to use the 50MHz internal clock and make it output to external physical.

Colman

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: ESP32 ethernet, SPI, JTAG pin questions

Postby rudi ;-) » Fri Mar 03, 2017 3:37 pm

colman wrote:I know I can disconnect it by adding a switch controlled by a GPIO, but there is no more GPIO left.
sry i do not know, how much pins you use in your project, i do not know your project, so perhabs you can tell about more,
like i asked, would be helpfull to answere your question, which board or environment you use,
perhaps you can include a portexpander - basis on spi or i2c - so your pins would be not lees with this and you can use example 16 gpios more...

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: No registered users and 119 guests