Expansion Board pin numbers vs LoPy pin numbers

  • Let me ask a naïve question, for which there is probably a very straightforward answer:

    Why is the pin numbering on the expansion board (beginning with 'G') completely different from the pin numbering on the LoPy (beginning with 'P')? The expansion board numbers also are not mentioned on the newly published Pin-Out overview.
    What am I missing?



  • Yes, the G numbers are to match the WiPy 1 (version 2 uses ESP32 like the LoPy), and the WiPy 1 in turn got their order from the GPIO pin order on the CC3200 processor it uses. LoPy's support for the G numbering is fairly explicitly to keep the expansion board the same, as the P names are all under machine.Pin.module and the G names are under machine.Pin.exp_board. By the way, those locations hold preexisting instances of all the pins, so can be used to access the few that currently crash (like G3/P16). That's one bug I plan to chase down after source release.

  • administrators

    @Jakko Yes

    from machine import Pin

  • Thanks Xykon, that makes sense.

    Is it then correct that both Pin('Px', ......) and Pin('Gx', .......) with x being the pin number, will be recognized by micropython?

  • administrators

    I'm assuming it was done to provide backwards compatibility for the WiPy1 expansion board.

Log in to reply

Pycom on Twitter