EMAC receive not working

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

Re: EMAC receive not working

Postby rudi ;-) » Thu Mar 09, 2017 12:44 am

to do on Olimex ESP32 EVB REV-A
with LAN8710A

have not remove RM3
have cut the “pullup” line between LAN8710A and RM3
so we can use the “pullup” later for other gpio by connect on the pin

steps:

we must
1) cut RM3 single line (LAN8710A) CRS_DV pulled up node
2) remove R21 ( pulled up )
3) cut GPIO18 line (backside ) from RM3 (LAN8710A CRS_DV) line
4) connect on header 19(“CRS_DV”) ,26(“I2C_SDA”) by wire

pics:
====
before cut RM3 single line
Image

and here steps
Image
Image

controll:
you will see only a fine cut on the RM3 sinlge line
R21 was removed
Image

GPIO18
we can use it later by connect a wire and connect to a pinheader pin
so we save the gpio18 for later. we can connect the gpio18
then on backside where we cut the line from CRS_DV
this node to GPIO18 has also disturbed

now i will remove the flying osz and
i will use “GPIO16” as int CLK again and
will update infos here at weekend

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

RobinC
Posts: 45
Joined: Sat Feb 04, 2017 5:29 pm

Re: EMAC receive not working

Postby RobinC » Thu Mar 09, 2017 3:23 pm

Good details Rudi. Guess Olimex needs to do a new spin on the board.

Robin

RobinC
Posts: 45
Joined: Sat Feb 04, 2017 5:29 pm

Re: EMAC receive not working

Postby RobinC » Sat Apr 08, 2017 9:22 pm

Made a little "ESP32 Etherbase" ethernet proto board for the devkit-c. Working well with the LAN8720A.

Robin
Attachments
IMG_0644.JPG
IMG_0644.JPG (2.37 MiB) Viewed 20698 times
IMG_0641.JPG
IMG_0641.JPG (2.2 MiB) Viewed 20698 times

www220
Posts: 34
Joined: Wed Dec 21, 2016 7:21 am

Re: EMAC receive not working

Postby www220 » Tue Apr 11, 2017 11:33 am

使用了lan8720+外部晶振?如何避免gpio0进入下载模式的?

RobinC
Posts: 45
Joined: Sat Feb 04, 2017 5:29 pm

Re: EMAC receive not working

Postby RobinC » Tue Apr 11, 2017 2:26 pm

Yes, lan8720 with 50Mhz crystal. I use GPIO17 from the stock master tree used in phy_device_power_enable() to connect to the enable pin on the crystal. I also had to add a 100 ohm resister between the crystal and the ESP32 to prevent current drain that lowered the clock voltage.

Robin

www220
Posts: 34
Joined: Wed Dec 21, 2016 7:21 am

Re: EMAC receive not working

Postby www220 » Sat Apr 15, 2017 11:28 am

rudi ;-) wrote:
RobinC wrote:Very cool Rudi. How are you generating the clock?
hi robin

try this:

Code: Select all

..
#include "soc/emac_ex_reg.h"
extern void rtc_plla_ena(bool ena, uint32_t sdm0, uint32_t sdm1, uint32_t sdm2, uint32_t o_div);
..

Code: Select all


PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO16_U, FUNC_GPIO16_EMAC_CLK_OUT);
REG_SET_FIELD(EMAC_EX_CLKOUT_CONF_REG, EMAC_EX_CLK_OUT_H_DIV_NUM, 0);
REG_SET_FIELD(EMAC_EX_CLKOUT_CONF_REG, EMAC_EX_CLK_OUT_DIV_NUM, 0);
REG_CLR_BIT(EMAC_EX_CLK_CTRL_REG, EMAC_EX_EXT_OSC_EN);
REG_SET_BIT(EMAC_EX_CLK_CTRL_REG, EMAC_EX_INT_OSC_EN);
think there is a small mistake in the params
but try this:

Code: Select all

// f_out = f_xtal * (sdm2 + 4) / (2 * (o_div + 2))
//   = 40.000.000,00 *  (1 + 4) / (2 * ( 0 + 2) ) 
//   = 40.000.000,00 *  ( 5) / (2 * ( 2) )
//   = 40.000.000,00 *  ( 5) / (4 )
//   = 200.000.000,00  / ( 4 )
//   = 50.000.000,00 
//   = 50 MHz

// param0= ena
// param1=smd2
// param2=o_div
// param3=?
// param4=?

rtc_plla_ena(1, 1, 0, 0, 0); // 50 MHz
// rtc_plla_ena(1, 5, 1, 0, 0); // 60 MHz
// rtc_plla_ena(1, 0, 2, 0, 0); //  20 MHz ( glass clear)
best wishes
rudi ;-)
rtc_plla_ena(1, 1, 0, 0, 0); // 50 MHz
这个函数一直卡死无法返回,不知道原来测试时需要修改其他地方的代码吗?

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

Re: EMAC receive not working

Postby rudi ;-) » Sat Apr 15, 2017 11:01 pm

@www220
hope this helps
https://esp32.com/viewtopic.php?start=20&t=813#p6100

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

www220
Posts: 34
Joined: Wed Dec 21, 2016 7:21 am

Re: EMAC receive not working

Postby www220 » Sun Apr 16, 2017 2:09 am

rudi ;-) wrote:@www220
hope this helps
https://esp32.com/viewtopic.php?start=20&t=813#p6100

best wishes
rudi ;-)
就是按照这个写的,现在是apll使能失败,不知道是不是使用了新版本的idf的缘故,现在我用的idf2.0

www220
Posts: 34
Joined: Wed Dec 21, 2016 7:21 am

Re: EMAC receive not working

Postby www220 » Sun Apr 16, 2017 2:47 am

/* wait for calibration end */
while (!(I2C_READREG_MASK_RTC(I2C_APLL, I2C_APLL_OR_CAL_END))) {
/* use ets_delay_us so the RTC bus doesn't get flooded */
ets_delay_us(1);
}

这个循环一直跳不出去

Who is online

Users browsing this forum: pubsub and 61 guests