EMAC receive not working

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

Re: EMAC receive not working

Postby www220 » Wed Mar 01, 2017 4:28 am

点赞,必须的

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

Re: EMAC receive not working

Postby www220 » Wed Mar 01, 2017 8:13 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 ;-)
lan8720使用esp的clk工作正常吗?

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

Re: EMAC receive not working

Postby rudi ;-) » Fri Mar 03, 2017 12:05 am

hi robin, hi www220

have plan to do on weekend, but could not wait:

ESP32 generate 50 MHz for xRefer and X_in ( LAN8710A )
clk ok, SMI ok, now create the header for LAN8710A for DHCP and IP
IMG_6055_s.jpg
IMG_6055_s.jpg (124.32 KiB) Viewed 14766 times
( clk small curved cause have not filtered pinheader )
IMG_6048_s.jpg
IMG_6048_s.jpg (101.5 KiB) Viewed 14766 times
now we have
tlk110
LAN8720

and append
LAN8710A
its the Olimex ESP32 EVB REV A Board
( edit: now we try to get the ip )

best wishes
rudi ;-)
Last edited by rudi ;-) on Wed Mar 08, 2017 11:24 am, edited 1 time in total.
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

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

Re: EMAC receive not working

Postby rudi ;-) » Fri Mar 03, 2017 12:06 am

www220 wrote:
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 ;-)
lan8720使用esp的clk工作正常吗?
@www220
a big Yes ;-)

:mrgreen:

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

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

Re: EMAC receive not working

Postby rudi ;-) » Sun Mar 05, 2017 1:43 pm

@www220

get the thing runing with Intern RMII Clk 50 MHz
sometimes i can ping, somtimes there is a long time for it.
sometimes i get no ip. i will try some things like delay's before each register change
and others.

it makes difference sence to run the clk_on process with a try on difference process
have tried:

Code: Select all

// xTaskCreate(&clk_on_task, "clk_on_task", 2048, NULL, (tskIDLE_PRIORITY + 2), NULL);
// xTaskCreatePinnedToCore(&clk_on_task, "clk_on_task", 2048, ParamPTR, 1, NULL, 0);


// core 0: no ip
// core 1: sometimes an ip
// xTaskCreatePinnedToCore(&clk_on_task, "clk_on_task", 2048, NULL, configMAX_PRIORITIES - 1 , NULL, 1); 
and a play on Process Priority

it will take a litle more time to figure it out what the best is.
from my test i can say, in general it is possible to create clk from esp,
to use it is sometimes difference and depending on the art of created "RTOS" process for it

To the comparison i will try this with the silicon rev1 again.

The clk itself is stable, I think the process PRIORITIES / creating claims a lot
So that only a few time slots remain for the processing for ip and ping answere.
Let's see what we can optimize together on the rtos
In the moment I use the external clk for project development and expansion and try to move it later intern rmii clk

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 » Tue Mar 07, 2017 11:06 am

使用外部clk就涉及到gpio0冲突的问题,现在还没有什么完美的解决方案

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

Re: EMAC receive not working

Postby rudi ;-) » Tue Mar 07, 2017 11:45 am

www220 wrote:使用外部clk就涉及到gpio0冲突的问题,现在还没有什么完美的解决方案
clk sig is ok ( rigol )
mdc, mdio is ok, can read and set register
only i get no ip

perhabs you ( or robin ) see a mistake in the used header for LAN8710A

#define BASIC_MODE_CONTROL_REG (0x0)
#define SOFTWARE_RESET BIT(15)

#define BASIC_MODE_STATUS_REG (0x1)
#define AUTO_NEGOTIATION_COMPLETE BIT(5)
#define LINK_STATUS BIT(2)

#define PHY_IDENTIFIER_REG (0x2)
#define OUI_MSB_21TO6_DEF 0x0007

#define AUTO_NEG_ADVERTISEMENT_REG (0x4)
#define ASM_DIR BIT(11)
#define PAUSE BIT(10)

#define PHY_LINK_PARTNER_ABILITY_REG (0x5)
#define PARTNER_PAUSE BIT(10)

#define SOFTWARE_STRAP_CONTROL_REG (0x9)
#define SW_STRAP_CONFIG_DONE BIT(15)
#define AUTO_MDIX_ENABLE BIT(14)
#define AUTO_NEGOTIATION_ENABLE BIT(13)
#define AN_1 BIT(12)
#define AN_0 BIT(11)
#define LED_CFG BIT(10)
#define RMII_ENHANCED_MODE BIT(9)

#define PHY_SPECIAL_CONTROL_STATUS_REG (0x1f)
#define AUTO_NEGOTIATION_DONE BIT(12)
#define SPEED_DUPLEX_INDICATION_10T_HALF 0x04
#define SPEED_DUPLEX_INDICATION_10T_FULL 0x14
#define SPEED_DUPLEX_INDICATION_100T_HALF 0x08
#define SPEED_DUPLEX_INDICATION_100T_FULL 0x18
#define SPEED_INDICATION_100T BIT(3)
#define SPEED_INDICATION_10T BIT(2)
#define DUPLEX_INDICATION_FULL BIT(4)
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 » Tue Mar 07, 2017 9:58 pm

Have you verified the 8710 is working with an external crystal or oscillator? I didn't get an IP until I connected crs/dv to gpio27. Are you seeing the DHCP request on your server?

Robin

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

Re: EMAC receive not working

Postby rudi ;-) » Wed Mar 08, 2017 11:20 am

RobinC wrote:Have you verified the 8710 is working with an external crystal or oscillator? I didn't get an IP until I connected crs/dv to gpio27. Are you seeing the DHCP request on your server?

Robin
hi robin
saw it :) after posting - need a scalpel again on weekend :roll:
let you know how i get on the REV-A :mrgreen:
CRS_DV_GPIO18_p1_rc.jpg
CRS_DV_GPIO18_p1_rc.jpg (83.67 KiB) Viewed 14663 times
RM3- CRS_DV LAN8710A ..GPIO18
R21- FUNC_GPIO27_EMAC_RX_DV on it for using I2C pulled up and other )
IMG_6094_rc.jpg
IMG_6094_rc.jpg (212.55 KiB) Viewed 14663 times
best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

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

Re: EMAC receive not working

Postby rudi ;-) » Wed Mar 08, 2017 11:19 pm

@robin

without words
LAN8710A_pinged.png
LAN8710A_pinged.png (63.76 KiB) Viewed 14627 times
:ugeek:

best wishes
rudi ;-)

need few hacks/mods on EVB-REV-A
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: Baidu [Spider] and 81 guests