We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

How to turn off the ephy so I can use those 4 pins for GPIO?



  • Does anybody know how to turn OFF the EPHY on omega2+ so that I can use rx-, rx+, tx-, and tx+ as regular GPIO lines?

    Also what are the names of GPIO numbers of those EPHY pins (rx-,rx+, tx-, tx+)?

    Thanks





  • Hello,

    I saw that link already thanks, I tried doing that, but after disabling ephy with that command

    omega2-ctrl gpiomux set ephy gpio

    How then do I access the GPIO pins after executing this command?

    What are the GPIO pin names of the rx-, rx+, tx-, tx+ pins that the ephy was using?

    Are they GPIO-50, GPIO-51, GPIO-52, GPIO-53 etc, its not written anywhere.

    Thanks



  • @nsmith The ephy group only allows you to use GPIO43, not the eth pins, take a look at the data sheet for MT7688 used by Omega2:

    http://wiki.amperka.ru/_media/продукты:onion-omega2:mt7688_datasheet.pdf

    It sounds like you just need more GPIO? Why not use Omega2S the surface mounted version which exposes additional GPIO.



  • Thanks for the info, I just checked digikey, Omega2S cost $10 more than Omega2+, hard to justify spending extra $10 just to get 4 port lines, the product im making is very price sensitive.

    Do you guys know any other alternative products similar to onion chips?

    I tried VoCore2, its even smaller than Onion and runs OpenWRT as well. I bought one before i tried omega2+ but I couldnt get it to work. Onion worked immediately out of the box thats why i picked it, and it uses docker so everything is self contained, I even built the OpenWRT from scratch with onion with zero problems inside the docker, but now im stuck with the GPIO problem.



  • Hi @nsmith

    The omega2-ctrl ephy option is a bit misnamed as it has nothing to do with the phy lines, but only allows switching GPIO43 pin between GPIO and Ethernet Port 0 activity LED, exactly the same way as wled does for GPIO44. IMHO that option should be named (or aliased, keeping ephy for backward compatibility) eled.

    There are 4 more such LED/GPIO switches for the other Ethernet ports 1..4 (irrelevant for Omega2, but possibly useful for the Omega2S which has all those lines exposed). Details see description of ´GPIO2_MODE`register in the MT7688 datasheet page 62.

    Anyway, what you are looking for is AGPIO_CFG (page 59 of the datasheet), and in particular bit 16, EPHY_P0_DIS. If you set that bit to 1, the 4 Ethernet port 0 phy lines become GPIO 33..36.

    You can toggle that bit with

    # first have a look tomake sure the other bits are as expected
    # reading AGPIO_CFG should return 0x001E01FF
    devmem 0x1000003C 32
    # now only change bit 16 and write it back to
    # disable Ethernet and get GPIO 33..36
    devmem 0x1000003C 32 0x001F01FF
    

    I never disabled Ethernet port 0 so far, but I did enable port 1..4 this way and as far as I know the only part of the software that ever touches AGPIO_CFG is the boot loader. The ethernet driver seems not to know about or mess with it. So I guess you'd be safe by switching to GPIO sometime early in your startup once. No guarantee though 😉

    You cannot avoid (without changing the boot loader) having a short period of time during boot where these pins will be in Ethernet PHY mode and thus output pretty random patterns. It depends on what you connect to these pins if this is acceptable or not...



  • This might help, https://github.com/dumtux/agpio-switch-mt7688
    I wrote this for enabling all 5 ethernet ports for Ethernet switch.
    But I think you can modify this for disabling all of them to use digital I/O, by modifying AGPIO_CFG.


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.