I'm working on a project where I'm using several buck converters controlled by the same MCU (ESP32) and I will be adding a digital Power monitor to each converter. but I'm concerned about the number of pins needed to do the communication between the converters and the MCU, if we're considering SPI then the application will need more pins than the MCU has. Is there any suggestions to solve this problem?

  • \$\begingroup\$ Schematic and/or block diagram please. Are you out of pins on your MCU? Choose a larger one? Use a port expander? \$\endgroup\$
    – winny
    Feb 8, 2023 at 13:13
  • 1
    \$\begingroup\$ Asking for recommendations which MCU to choose are off-topic. And what is best in your scenario is not known, because your requirements are unknown - we don't know what you value as best, is it slowest and cheapest or fastest and most expensive, because what the CPU has to do is unknown. \$\endgroup\$
    – Justme
    Feb 8, 2023 at 13:23
  • \$\begingroup\$ Obviously you wouldn't use 8 different SPI peripherals even if you could find a MCU that supports that many. Depending on how these are located physically, you could either control the /SS signal through a demux or implement a daisy chain. \$\endgroup\$
    – Lundin
    Feb 8, 2023 at 13:57
  • \$\begingroup\$ Specs that may be relevant to clarify the question are: total length of the bus/stubs, baudrate, EMC criteria (what kind of application is it), use of galvanic isolation or not, how often you need to sample each slave. \$\endgroup\$
    – Lundin
    Feb 8, 2023 at 14:01
  • \$\begingroup\$ What exactly do you mean by digital Power monitor? Why not considering I2C? Would only take 2 pins for multiple sensors. \$\endgroup\$
    – datenheim
    Feb 10, 2023 at 16:27

1 Answer 1


SPI uses 4 pins but multiple devices can share the same bus. Only 1 pin on the uC is needed for MISO, MOSI, and CLK. Every device shares those lines. Each device gets it's own CS (chip select) line. So that's 3 + (8*1) = 11 pins on the uC. Not as bad as 32 pins. Any controller that has SPI functionality and at least 8 extra IO pins should work here.

  • 2
    \$\begingroup\$ If you're really short on pins, you can use a 74HC138 or 238 3-to-8 decoder for active-low or active-high. Then you would just need 7 or 8 pins depending on if you need to deselect all chips by disabling the decoder. \$\endgroup\$
    – Roland W
    Feb 8, 2023 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.