For generic builds should MicroPython assign pins based on the chip series #19810
|
Would it make more sense for MicroPython to have a per chip pin assignment for generic ESP32 builds rather than the current way in which there a few exceptions for some chips and every other chip gets assigned arbitrary pins? I ask this based on discussion #19805. I've looked at a few data sheets from Espressif (C5, C6) series and there are differences in where pins are based on the chip series. Espressif also release their own DevKit boards that from what I can tell a lot of other manufactures also follow? So would it make sense for MicroPython to align the defaults to follow such boards? |
Replies: 4 comments 4 replies
|
Given the number of boards on the market, this will lead to an incalculable number of versions. |
|
Am I right in understanding that what you're asking for is that the GENERIC boards have pin definitions that match one of the standard Espressif boards for each chip? Probably the DevKitC form-factor as a default (though sometimes the DevKitM is a popular option). I guess...it wouldn't be a bad idea? Though it doesn't add much. The GENERIC boards are just that, generic, they should work for pretty much all boards - as a reasonable starting point - for the given chipset. (Note that boards can already have their own pin definitions - see practically every other non-generic board - it's just that the GENERIC boards don't.) |
|
The generic boards do not have pin definitions. You have to use the GPIO numbers to specify a Pin. Vendor-specific board may have Pin definition by a pins.csv in the respective board directory. The define symbolic names for the pins and are meant to be identical to the silk screen printing of the board. |
|
Just to clarify this point, which was also resolved in the linked discussion point: ESP32 family hardware peripherals can usually assign their pins at runtime, so although there are default pin numbers in MicroPython the recommended approach is to pick whatever pins are convenient in the physical world and pass the pin numbers to the constructor. There are some special cases where a pin number is fixed (for example ADC channels, built-in USB, low power peripherals - this last one is not currently supported in MicroPython.) Also some pins on some chips are input-only, so they can only be assigned input functions. There are some boards where, for example, there is an onboard I2C bus with some devices on that particular board design. For a board like this MicroPython changes the default pins to match for convenience. This is one of the few reasons to use a particular board firmware instead of a "generic" ESP32 firmware, although you can usually get the same behaviour from the generic firmware by specifying the pin numbers in Python code. |
Just to clarify this point, which was also resolved in the linked discussion point:
ESP32 family hardware peripherals can usually assign their pins at runtime, so although there are default pin numbers in MicroPython the recommended approach is to pick whatever pins are convenient in the physical world and pass the pin numbers to the constructor.
There are some special cases where a pin number is fixed (for example ADC channels, built-in USB, low power peripherals - this last one is not currently supported in MicroPython.) Also some pins on some chips are input-only, so they can only be assigned input functions.
There are some boards where, for example, there is an onboard I2C bus with so…