• AVR Freaks

Hot!best way to reset LAN8720

Author
ffb.boy.30
Super Member
  • Total Posts : 204
  • Reward points : 0
  • Joined: 2016/08/31 00:59:51
  • Location: 0
  • Status: offline
2018/03/10 01:19:03 (permalink)
0

best way to reset LAN8720

Hi,
I'm using an LAN8720 daughter board with my Pic32MZ and I would like to know what is the solution to make the board reboot .
I'm looking for a software solution because I've no access to the board.
I've a heartbeat exchange and when I lost him I reboot the reboot the board.
Thanks you
#1

9 Replies Related Threads

    RISC
    Super Member
    • Total Posts : 5379
    • Reward points : 0
    • Status: offline
    Re: best way to reset LAN8720 2018/03/11 04:57:28 (permalink)
    0
    Hi,
    Check this thread : http://www.microchip.com/forums/m1005422.aspx
    Regards
     
    #2
    ffb.boy.30
    Super Member
    • Total Posts : 204
    • Reward points : 0
    • Joined: 2016/08/31 00:59:51
    • Location: 0
    • Status: offline
    Re: best way to reset LAN8720 2018/03/15 00:54:48 (permalink)
    0
    Hi,
    Sorry but I don't want to reset the PIC but only the LAN8720.
    Sometime I lost the communication and I can't reset the PIC only the LAN8720.
    I don't find the code with Harmony
     
    #3
    rainad
    Super Member
    • Total Posts : 1226
    • Reward points : 0
    • Joined: 2009/05/01 13:39:25
    • Location: 0
    • Status: offline
    Re: best way to reset LAN8720 2018/03/15 10:27:57 (permalink)
    0
    The PHY has a control register that can reset it.
    If you use Harmony and the MIIM driver, it's very easy to perform a write to that particular register.
     
    #4
    ffb.boy.30
    Super Member
    • Total Posts : 204
    • Reward points : 0
    • Joined: 2016/08/31 00:59:51
    • Location: 0
    • Status: offline
    Re: best way to reset LAN8720 2018/03/16 03:21:21 (permalink)
    0
    Yes but how can I detect that the card is offline ?
    Never use the miim driver is there a sample which explain how to do the job.
    Because if I reset the board I suppose I need to initialize all the PHY register like the Harmony do automatically at startup.
     
    #5
    rainad
    Super Member
    • Total Posts : 1226
    • Reward points : 0
    • Joined: 2009/05/01 13:39:25
    • Location: 0
    • Status: offline
    Re: best way to reset LAN8720 2018/03/16 09:05:45 (permalink)
    0
    Just read a PHY register that's read only and has known contents: like version ID, manufacturer ID, capabilities, etc. If you read valid info, then the PHY is there. If you read just 0xff, then there's no PHY.
    Of course the PHY needs to be initialized before using it, like everything else.
    The MIIM driver just allows you to read or write a PHY register, nothing else.
    #6
    nornor
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2018/04/11 07:02:59
    • Location: 0
    • Status: offline
    Re: best way to reset LAN8720 2019/07/19 02:48:35 (permalink)
    0
    hello,
     
    do you have some sample code to read version ID, manufacturer ID etc ... ? 
     
    I tried to look further the driver of the phy in the tcpip stack to help but i'm confused, there are too much parameters... and i tried to use TCPIP_STACK_NetIsLinked, TCPIP_STACK_NetIsUp, TCPIP_STACK_NetIsReady but in my case, it didn't work to see if the card is offline. (there are true.)
     
    thanks ! 
    #7
    rainad
    Super Member
    • Total Posts : 1226
    • Reward points : 0
    • Joined: 2009/05/01 13:39:25
    • Location: 0
    • Status: offline
    Re: best way to reset LAN8720 2019/07/19 07:39:03 (permalink)
    0
    Look at the tcp/ip console. There are miim commands to read/write PHY registers.
    That will show you how the functions need to be used.
     
    #8
    nornor
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2018/04/11 07:02:59
    • Location: 0
    • Status: offline
    Re: best way to reset LAN8720 2019/07/23 06:45:51 (permalink)
    0
    ok, finally succeeded to read the phy with miim commands, thanks for the advice. Now i have to soft reset the phy, for now it didn't work with writing in the register of the phy. I tried with : 
    miimOpHandle = miimObj->DRV_MIIM_Write(miimHandle, Op_rIx, Op_phyAdd, miimWrData, DRV_MIIM_OPERATION_FLAG_NONE, &Op_pOpResult);
    with register rIx = 0, phyAdd = 0, miimWrData = 0x8000, and wait with a state machine, that should be ok. But nothing happens, the phy stay in is state. 
    Maybe it's not enough to reset, the phy have to be deinitialize and reinitialize ? 
    any advice ? thanks ! :) 
    post edited by nornor - 2019/07/23 06:47:13
    #9
    rainad
    Super Member
    • Total Posts : 1226
    • Reward points : 0
    • Joined: 2009/05/01 13:39:25
    • Location: 0
    • Status: offline
    Re: best way to reset LAN8720 2019/07/23 08:06:10 (permalink)
    0
    I'd suggest using an I/O pin to hard reset the PHY. Do  a test first and see if this solves the issue. If so, this function could be added at the stack initialization sequence there is a callback that you can register.
     
    #10
    Jump to:
    © 2019 APG vNext Commercial Version 4.5