-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
I've identified an arithmetic underflow in the SPI read routines which seems to lead a deadlock, at least in my application.
The repeatability code is raspberrypi/pico-examples#101, in the case that the SPI slave starts while the SPI master is in the middle of a transmission. The slave correctly transmits 8 bytes and then deadlocks.
The flaw is in
| if (tx_remaining && spi_is_writable(spi) && rx_remaining - tx_remaining < fifo_depth) { |
tx_remaining is 248 while rx_remaining is 247. The operation underflows and gives a result of 0xFF FF FF FF FF FF FF FF.
I'm not 100% clear on what happens next, and it probably depends on the timing of signals coming in anyway. Either way, I think the arithmetic underflow is not intended.
Metadata
Metadata
Assignees
Labels
No labels