Page 1 of 1

Abort an asynchronous I2C operation

Posted: Wed Mar 12, 2025 11:31 am
by floitsch_toit
Is there a good way to abort an asynchronous I2C operation?

Am I allowed to 'i2c_master_bus_rm_device' a device for which an asynchronous operation is currently in process? Would/should it get aborted?

Can I shut down the whole bus ('i2c_del_master_bus') if an operation is still in process?

Re: Abort an asynchronous I2C operation

Posted: Sat Mar 15, 2025 2:28 pm
by ahsrabrifat
ESP-IDF does not provide a direct API to abort an in-progress asynchronous I²C operation. If you are using i2c_master_cmd_begin(), set a short timeout so that operations do not block indefinitely. You can manually reset the I²C bus by reinitializing it if you detect an operation getting stuck.