Hi everyone,
I'm in the middle of a project and am starting to run out of available GPIOs.
To save a pin, I was wondering if it's possible to use a single GPIO (for example, P0.13) as the SCK for two different SPI master instances, like SPI1 and SPI3.
The two SPI peripherals would be used mutually exclusively, never at the same time. My thinking is that I could dynamically reconfigure the pin mapping in software between transactions. For instance:
-
Initialize my device and map P0.13 to
SPI1.SCK. -
Perform all necessary transactions on the SPI1 bus.
-
When I need to switch, I would uninit the SPI1 peripheral, disconnect the pin, and then re-initialize it to be used by
SPI3.SCK.
Has anyone tried this? I'm curious if this approach is feasible and if there are any significant drawbacks I should be aware of, like timing overhead or potential bus glitches during the reconfiguration.
Any advice or alternative solutions for managing pin shortages would be greatly appreciated!
Thanks in advance.
Oriol
