Is it possible to enabled multiple functionality on single pin by assigning definition on mpconfigboard.h, e.g like this (note that B10 and B11 can be used as uart OR i2c) :
mpconfigboard.h
#define MICROPY_HW_UART3_TX (pin_B10)
#define MICROPY_HW_UART3_RX (pin_B11)
#define MICROPY_HW_I2C2_SCL (pin_B10)
#define MICROPY_HW_I2C2_SDA (pin_B11)
and later on, in .py application, we called :
uart3 = pyb.UART(3, 9600)
an in some OTHERS application on different board with B10 and B11 assigned as i2c, we do :
i2c2 = pyb.I2C(2, pyb.I2C.MASTER)
The point is, I want to use single, unchanged micropython image, to support multiple hardware application.
multi peripheral functionality on same pin
-
- Posts: 81
- Joined: Fri Sep 02, 2016 9:26 am
Re: multi peripheral functionality on same pin
That should work fine.
You can use the pins_af.py from the build directory for your board, and the examples/pins.py file to print out the current settings of the alternate functions and verify that things are setup the way you think they are.
You can use the pins_af.py from the build directory for your board, and the examples/pins.py file to print out the current settings of the alternate functions and verify that things are setup the way you think they are.
Re: multi peripheral functionality on same pin
Maybe I am not seeing it, but it seems like the CAN interface is one of the few that do not let me pass different pin assignments to, like SPI.
I looked up the pin alternative function from the REPL and both B13 and B5 do not show CAN as options, even though I know from the STM32CUBEMX and the DFU documentation say it is.
How would you go about doing this?
I looked up the pin alternative function from the REPL and both B13 and B5 do not show CAN as options, even though I know from the STM32CUBEMX and the DFU documentation say it is.
How would you go about doing this?
_______________
Travis Travelstead
Travis Travelstead
Re: multi peripheral functionality on same pin
Ignore that last post. I posted on the wrong topic, and have not yet found how I can delete a post.
_______________
Travis Travelstead
Travis Travelstead