2025-05-23 5:03 AM - last edited on 2025-05-24 2:06 AM by Andrew Neil
I’m after some recommendations for a communication protocol between two stm32’s. One will be on a BMS board controlling a battery monitor IC and reading a fuel gauge and another will be on a seperate board with a charger and a power supply. The communication will mainly be the BMS stm32 sending battery statistics to the other board but there could be some two way communication. My plan is to make the BMS board standalone so it may not always be communicating with another stm32. I was originally thinking just UART but a quick google shows that CAN or SMBus may also be popular. I’m not sure of the advantages or disadvantages of going with different protocols. I haven’t used CAN or SMBus before but I could definitely look into it if that’s a better way to go. There might also be a possibility in the future for me to stack multiple BMS boards together to get more power output if that sways the decision on the communication protocol.
2025-05-23 5:57 AM - edited 2025-05-23 6:01 AM
By "BMS" I guess you mean Battery Monitoring System - rather than Building Monitoring System, or anything else?
Please also give more context:
That you're using an STM32 would make (virtually) no difference to the choice.
2025-05-23 6:02 AM
Yes it’s a battery management system that will have probably 7s Li-ion batteries. At the moment I’m planning on making a portable light, just at a hobby project level I guess you’d probably say. I was mainly wondering if there is kind of a standard way of communicating to try and keep things standard if I ever did decide to use it for another project.
2025-05-23 8:22 AM
Between two boards, with low bandwidth data, UART is simplest and best.
2025-05-23 8:46 AM - edited 2025-05-24 2:07 AM
@La246 wrote:I was mainly wondering if there is kind of a standard way of communicating to try and keep things standard if I ever did decide to use it for another project.
IF there was such a standard, it would have to be independent of what microcontroller you used - not specific to STM32.
I've edited the title to reflect this.
2025-05-23 6:38 PM
Would UART still be a good choice if I had three boards? Two BMS boards talking to the one main controller.
2025-05-23 7:10 PM
To reduce wiring, I would look into CAN (GND, power, CAN_L, CAN_H). Easier to downgrade to low-pin MCUs (48 pins or even lower with external CAN transceiver). Actually, I had an idea of making 2-wire CAN+power some time ago. UART is still very good if you connect 3 boards to one main board. The only problem is that with each new board you will have 2 less free pins on the main MCU. If you will do hot plug do not forget to turn off framing error checks on the STM32 UART.
2025-05-24 2:00 AM
@Georgy Moshkin wrote:UART is still very good if you connect 3 boards to one main board. The only problem is that with each new board you will have 2 less free pins on the main MCU.
Not if you use a bus configuration; eg, RS485.
Can even be done with just open-collector drivers ...
Probably more common in "Small" MCUs than CAN ?