1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #20299 from chrysn-pull-requests/nrf52-spi-bugs-2

cpu/nrf52 i2c: Wait for complete transmission when writing NOSTOP
This commit is contained in:
chrysn 2024-01-27 08:56:05 +00:00 committed by GitHub
commit 8f111a3c29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -126,6 +126,16 @@ static int finish(i2c_t dev, int inten_success_flag)
DEBUG("[i2c] finish: stop event occurred\n");
}
if (inten_success_flag & TWIM_INTEN_LASTTX_Msk) {
/* The interrupt is raised already when the last TX is started, but we
* have to wait until it was actually transmitted lest the transmission
* would be suppressed immediately by the next following write --
* careful here: enabling DEBUG introduces enough latency that the
* issue doesn't show up any more. */
while (bus(dev)->TXD.AMOUNT != bus(dev)->TXD.MAXCNT &&
!bus(dev)->EVENTS_ERROR) {}
}
if (bus(dev)->EVENTS_ERROR) {
bus(dev)->EVENTS_ERROR = 0;
if (bus(dev)->ERRORSRC & TWIM_ERRORSRC_ANACK_Msk) {