2024-12-20 07:47 AM
Hi,
I want to use a single low-level module to handle up to three I2C buses at the same time using the HAL library and using the interrupt for all communications with the relative callback. Is it possible to use a single write/read/callback function for all transactions on all three buses at the same time. Are there any problems if the callback is interrupted to handle another interrupt of another I2C bus with higher priority?
Best regards,
Domenico
2024-12-20 02:55 PM
As long as you have different data buffer or structure for each bus then you will be fine. But if you are sharing the same data buffer, then you'll get conflicts as 1 of the bus will over write the other bus data.
2024-12-21 05:44 PM
Should be no problems doing this with HAL. Get one instance working first and it should be straightfoward to move to multiple. They will all use different handles.
I2C interrupts pre-empting should not cause issues. However I2C is so slow compared to interrupt execution speed that I'd set them all at the same priority.