Page 1 of 1

Invalid pin D6-D8

Posted: Sat May 28, 2016 12:19 pm
by jms
machine.Pin(any of 6 to 8) gives me an "invalid Pin" exception on a few week old build of version 1.8 . That's a lot of missing GPIO !

Is this a known problem or likely to be an issue with the build I picked up ?

Now I look into it modpybpin.c has this

Code: Select all

const pyb_pin_obj_t pyb_pin_obj[16 + 1] = {
    {{&pyb_pin_type}, 0, FUNC_GPIO0, PERIPHS_IO_MUX_GPIO0_U},
    {{&pyb_pin_type}, 1, FUNC_GPIO1, PERIPHS_IO_MUX_U0TXD_U},
    {{&pyb_pin_type}, 2, FUNC_GPIO2, PERIPHS_IO_MUX_GPIO2_U},
    {{&pyb_pin_type}, 3, FUNC_GPIO3, PERIPHS_IO_MUX_U0RXD_U},
    {{&pyb_pin_type}, 4, FUNC_GPIO4, PERIPHS_IO_MUX_GPIO4_U},
    {{&pyb_pin_type}, 5, FUNC_GPIO5, PERIPHS_IO_MUX_GPIO5_U},
    {{NULL}, 0, 0, 0},
    {{NULL}, 0, 0, 0},
    {{NULL}, 0, 0, 0},
    {{&pyb_pin_type}, 9, FUNC_GPIO9, PERIPHS_IO_MUX_SD_DATA2_U},
    {{&pyb_pin_type}, 10, FUNC_GPIO10, PERIPHS_IO_MUX_SD_DATA3_U},
    {{NULL}, 0, 0, 0},
    {{&pyb_pin_type}, 12, FUNC_GPIO12, PERIPHS_IO_MUX_MTDI_U},
    {{&pyb_pin_type}, 13, FUNC_GPIO13, PERIPHS_IO_MUX_MTCK_U},
    {{&pyb_pin_type}, 14, FUNC_GPIO14, PERIPHS_IO_MUX_MTMS_U},
    {{&pyb_pin_type}, 15, FUNC_GPIO15, PERIPHS_IO_MUX_MTDO_U},
    // GPIO16 is special, belongs to different register set, and
    // otherwise handled specially.
    {{&pyb_pin_type}, 16, -1, -1},
};
I'm obviously going to tweak it for my board (mini D1) but perhaps there's a better way of doing this.

Jon

Re: Invalid pin D6-D8

Posted: Sun May 29, 2016 5:41 pm
by Almoturg
These pins are used for the internal flash, they are not available on your board anyway. See here, the pin numbers in micropython are the ESP-8266 ones (e.g. GPIO5) which are not the ones printed on your board.

Re: Invalid pin D6-D8

Posted: Mon May 30, 2016 11:15 am
by jms
For reasons unknown the tweaks I made to the code to map the Dn labels to GPIO didn't work but at least it was a learning experience and I may as well use a more stock build.

Thank you for making it clear (and I should have twigged in the first place).

Jon