pw_i2c_mcuxpresso: Add flag to reset interface once after timeout

In the face of SCL or SDA transients on the I2C lines, the host
interface has a tendency to lock up and refuse to send any
transactions along the wires after the lines return to normal
operation. In these cases, we really need to rebuild the entire
FlexCOMM and I2C interface.

  - On a `DeadlineExceeded` result from
    `InitiateNonBlockingTransferUntil`, reset the interface if the
    config is enabled to do so, and return the `DeadlineExceeded`
    error to allow the caller to retry the transaction or handle it
    themselves.
  - Split `Enable` and `Disabled` into locked and unlocked forms and
    add `ResetLocked` which uses the pre-locked forms to allow for an
    interface reset.

Bug: b/462589833
Bug: b/466512349
Test: While audio playback is occurring in 5s bursts on an RT595-based
  board, short the SCL line between the RT595 and an I2C amp using a
  piece of wire. Verify behavior with a logic analyzer.
Test: attempt to read a register from a non-existent device
Change-Id: I0bafb0e5fa9f4765c00df6bb5f9b6b9e7cb6552d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/353132
Copybara-Verified: Copybara Prod <copybara-worker-blackhole@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Pigweed-Auto-Submit: Austin Foxley <afoxley@google.com>
Tests-Not-Needed: Austin Foxley <afoxley@google.com>
Commit-Queue: Austin Foxley <afoxley@google.com>
Docs-Not-Needed: June Tate-Gans <jtgans@google.com>
Reviewed-by: Austin Foxley <afoxley@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
2 files changed
tree: 521066bd6c50f35ca4f7e17543476681344513b8
  1. .allstar/
  2. .gemini/
  3. .github/
  4. .vscode/
  5. build_overrides/
  6. docker/
  7. docs/
  8. kudzu/
  9. pw_alignment/
  10. pw_allocator/
  11. pw_analog/
  12. pw_android_toolchain/
  13. pw_arduino_build/
  14. pw_assert/
  15. pw_assert_basic/
  16. pw_assert_fuchsia/
  17. pw_assert_log/
  18. pw_assert_tokenized/
  19. pw_assert_trap/
  20. pw_assert_zephyr/
  21. pw_async/
  22. pw_async2/
  23. pw_async_basic/
  24. pw_async_fuchsia/
  25. pw_atomic/
  26. pw_base64/
  27. pw_bloat/
  28. pw_blob_store/
  29. pw_bluetooth/
  30. pw_bluetooth_hci/
  31. pw_bluetooth_profiles/
  32. pw_bluetooth_proxy/
  33. pw_bluetooth_sapphire/
  34. pw_boot/
  35. pw_boot_cortex_m/
  36. pw_build/
  37. pw_build_android/
  38. pw_build_info/
  39. pw_build_mcuxpresso/
  40. pw_bytes/
  41. pw_change/
  42. pw_channel/
  43. pw_checksum/
  44. pw_chre/
  45. pw_chrono/
  46. pw_chrono_embos/
  47. pw_chrono_freertos/
  48. pw_chrono_rp2040/
  49. pw_chrono_stl/
  50. pw_chrono_threadx/
  51. pw_chrono_zephyr/
  52. pw_cli/
  53. pw_cli_analytics/
  54. pw_clock_tree/
  55. pw_clock_tree_mcuxpresso/
  56. pw_compilation_testing/
  57. pw_config_loader/
  58. pw_console/
  59. pw_containers/
  60. pw_cpu_exception/
  61. pw_cpu_exception_cortex_m/
  62. pw_cpu_exception_risc_v/
  63. pw_crypto/
  64. pw_digital_io/
  65. pw_digital_io_linux/
  66. pw_digital_io_mcuxpresso/
  67. pw_digital_io_rp2040/
  68. pw_digital_io_zephyr/
  69. pw_display/
  70. pw_dma_mcuxpresso/
  71. pw_docgen/
  72. pw_doctor/
  73. pw_elf/
  74. pw_emu/
  75. pw_env_setup/
  76. pw_env_setup_zephyr/
  77. pw_file/
  78. pw_flatbuffers/
  79. pw_format/
  80. pw_function/
  81. pw_fuzzer/
  82. pw_grpc/
  83. pw_hdlc/
  84. pw_hex_dump/
  85. pw_i2c/
  86. pw_i2c_linux/
  87. pw_i2c_mcuxpresso/
  88. pw_i2c_rp2040/
  89. pw_i2c_zephyr/
  90. pw_ide/
  91. pw_interrupt/
  92. pw_interrupt_cortex_m/
  93. pw_interrupt_freertos/
  94. pw_interrupt_zephyr/
  95. pw_intrusive_ptr/
  96. pw_json/
  97. pw_kernel/
  98. pw_kvs/
  99. pw_libc/
  100. pw_libcxx/
  101. pw_log/
  102. pw_log_android/
  103. pw_log_basic/
  104. pw_log_fuchsia/
  105. pw_log_null/
  106. pw_log_rpc/
  107. pw_log_string/
  108. pw_log_tokenized/
  109. pw_log_zephyr/
  110. pw_malloc/
  111. pw_malloc_freelist/
  112. pw_malloc_freertos/
  113. pw_metric/
  114. pw_module/
  115. pw_multibuf/
  116. pw_multisink/
  117. pw_numeric/
  118. pw_package/
  119. pw_perf_test/
  120. pw_persistent_ram/
  121. pw_polyfill/
  122. pw_preprocessor/
  123. pw_presubmit/
  124. pw_protobuf/
  125. pw_protobuf_compiler/
  126. pw_random/
  127. pw_random_fuchsia/
  128. pw_result/
  129. pw_ring_buffer/
  130. pw_router/
  131. pw_rpc/
  132. pw_rpc_transport/
  133. pw_rust/
  134. pw_sensor/
  135. pw_snapshot/
  136. pw_software_update/
  137. pw_span/
  138. pw_spi/
  139. pw_spi_linux/
  140. pw_spi_mcuxpresso/
  141. pw_spi_rp2040/
  142. pw_status/
  143. pw_stm32cube_build/
  144. pw_stream/
  145. pw_stream_shmem_mcuxpresso/
  146. pw_stream_uart_linux/
  147. pw_stream_uart_mcuxpresso/
  148. pw_string/
  149. pw_symbolizer/
  150. pw_sync/
  151. pw_sync_baremetal/
  152. pw_sync_embos/
  153. pw_sync_freertos/
  154. pw_sync_stl/
  155. pw_sync_threadx/
  156. pw_sync_zephyr/
  157. pw_sys_io/
  158. pw_sys_io_ambiq_sdk/
  159. pw_sys_io_arduino/
  160. pw_sys_io_baremetal_lm3s6965evb/
  161. pw_sys_io_baremetal_stm32f429/
  162. pw_sys_io_emcraft_sf2/
  163. pw_sys_io_mcuxpresso/
  164. pw_sys_io_rp2040/
  165. pw_sys_io_stdio/
  166. pw_sys_io_stm32cube/
  167. pw_sys_io_zephyr/
  168. pw_system/
  169. pw_target_runner/
  170. pw_thread/
  171. pw_thread_embos/
  172. pw_thread_freertos/
  173. pw_thread_stl/
  174. pw_thread_threadx/
  175. pw_thread_zephyr/
  176. pw_tls_client/
  177. pw_tls_client_boringssl/
  178. pw_tls_client_mbedtls/
  179. pw_tokenizer/
  180. pw_toolchain/
  181. pw_trace/
  182. pw_trace_tokenized/
  183. pw_transfer/
  184. pw_uart/
  185. pw_uart_mcuxpresso/
  186. pw_unit_test/
  187. pw_uuid/
  188. pw_varint/
  189. pw_watch/
  190. pw_web/
  191. pw_work_queue/
  192. seed/
  193. targets/
  194. third_party/
  195. zephyr/
  196. .bazelignore
  197. .bazelrc
  198. .bazelversion
  199. .black.toml
  200. .clang-format
  201. .clang-tidy
  202. .git-blame-ignore-revs
  203. .gitattributes
  204. .gitignore
  205. .gn
  206. .mypy.ini
  207. .prettierignore
  208. .prettierrc.cjs
  209. .pw_ide.yaml
  210. .pylintrc
  211. .ruff.toml
  212. activate.bat
  213. Android.bp
  214. AUTHORS
  215. bootstrap.bat
  216. bootstrap.fish
  217. bootstrap.sh
  218. BUILD.bazel
  219. BUILD.gn
  220. BUILDCONFIG.gn
  221. CMakeLists.txt
  222. GEMINI.md
  223. go.mod
  224. go.sum
  225. Kconfig.zephyr
  226. LICENSE
  227. MODULE.bazel
  228. MODULE.bazel.lock
  229. modules.gni
  230. OWNERS
  231. package.json
  232. pigweed.json
  233. PIGWEED_MODULES
  234. pw
  235. README.md
  236. REPO.bazel
  237. rustfmt.toml
  238. tsconfig.json
  239. workflows.json
  240. WORKSPACE
  241. WORKSPACE_OWNERS
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links