Pygate - ethernet reliability issues



  • Hi,
    I cannot confirm your problem.
    For me, the Pygate with PoE has been working correctly for several days.
    Unfortunately you do not specify which board you use on the PyGate, so only a few general tips:

    • Is the firmware on the board up to date and did you select PyGate in the firmware programming tool?

    • Did you cut off the pins of the RJ45 socket on the bottom of the PoE module to prevent shortcuts with the heatsink?

    • Maybe your PyGate or PoE module is defective. In this case, please contact sales@pycom.io.

    Here is my code that works with Ethernet:
    boot.py

    # boot.py -- run on boot-up
    import machine
    import pycom
    
    # We want to save a little bit power
    # Disable Heartbeat LED
    pycom.heartbeat_on_boot(False)
    # Disable WIFI completely
    pycom.wifi_on_boot(False)
    # Proceed with main.py
    machine.main('main.py')
    

    main.py

    from network import ETH
    from machine import RTC
    import time
    import machine
    import pycom
    
    # Define callback function for Pygate events
    def machine_cb (arg):
        evt = machine.events()
        if (evt & machine.PYGATE_START_EVT):
            # Green
            pycom.rgbled(0x103300)
        elif (evt & machine.PYGATE_ERROR_EVT):
            # Red
            pycom.rgbled(0x331000)
        elif (evt & machine.PYGATE_STOP_EVT):
            # RGB off
            pycom.rgbled(0x000000)
    
    # register callback function
    machine.callback(trigger = (machine.PYGATE_START_EVT | machine.PYGATE_STOP_EVT | machine.PYGATE_ERROR_EVT), handler=machine_cb)
    
    # Connect to Ethernet Network
    eth = ETH()
    eth.ifconfig(config=('172.17.1.5','255.255.255.0','172.17.1.1','172.17.1.1'))
    
    while not eth.isconnected():
        time.sleep(1)
    
    print("")
    print("ETH Connection established")
    
    # Sync time via NTP server for GW timestamps on Events
    rtc = RTC()
    rtc.ntp_sync(server="0.de.pool.ntp.org")
    
    # Read the GW config file from Filesystem
    fp = open('/flash/config.json','r')
    buf = fp.read()
    
    # Start the Pygate
    machine.pygate_init(buf)
    

    Hope this helps, best regards
    Peter


Log in to reply
 

Pycom on Twitter