Abort an asynchronous I2C operation

floitsch_toit
Posts: 43
Joined: Wed Jun 29, 2022 4:25 pm
Location: Aarhus, Denmark
Contact:

Abort an asynchronous I2C operation

Postby floitsch_toit » Wed Mar 12, 2025 11:31 am

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?

ahsrabrifat
Posts: 201
Joined: Sat Jan 18, 2025 2:31 pm

Re: Abort an asynchronous I2C operation

Postby ahsrabrifat » Sat Mar 15, 2025 2:28 pm

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.

Who is online

Users browsing this forum: Amazon [Bot], Baidu [Spider], ChatGPT-User, Qwantbot and 2 guests