diff --git a/src/main/drivers/bus_spi.c b/src/main/drivers/bus_spi.c index 70a7e7fd4c..44e70c7d08 100644 --- a/src/main/drivers/bus_spi.c +++ b/src/main/drivers/bus_spi.c @@ -415,6 +415,7 @@ static void spiIrqHandler(const extDevice_t *dev) // The end of the segment list has been reached bus->curSegment = nextSegments; nextSegment->u.link.dev = NULL; + nextSegment->u.link.segments = NULL; spiSequenceStart(nextDev); } else { // The end of the segment list has been reached, so mark transactions as complete diff --git a/src/main/drivers/bus_spi_ll.c b/src/main/drivers/bus_spi_ll.c index 8f41bea014..87b1844066 100644 --- a/src/main/drivers/bus_spi_ll.c +++ b/src/main/drivers/bus_spi_ll.c @@ -691,11 +691,12 @@ void spiSequenceStart(const extDevice_t *dev) // If a following transaction has been linked, start it if (bus->curSegment->u.link.dev) { - const extDevice_t *nextDev = bus->curSegment->u.link.dev; - busSegment_t *nextSegments = (busSegment_t *)bus->curSegment->u.link.segments; busSegment_t *endSegment = (busSegment_t *)bus->curSegment; + const extDevice_t *nextDev = endSegment->u.link.dev; + busSegment_t *nextSegments = (busSegment_t *)endSegment->u.link.segments; bus->curSegment = nextSegments; endSegment->u.link.dev = NULL; + endSegment->u.link.segments = NULL; spiSequenceStart(nextDev); } else { // The end of the segment list has been reached, so mark transactions as complete diff --git a/src/main/drivers/bus_spi_stdperiph.c b/src/main/drivers/bus_spi_stdperiph.c index 03b3d90ce0..c419238ada 100644 --- a/src/main/drivers/bus_spi_stdperiph.c +++ b/src/main/drivers/bus_spi_stdperiph.c @@ -418,11 +418,12 @@ void spiSequenceStart(const extDevice_t *dev) // If a following transaction has been linked, start it if (bus->curSegment->u.link.dev) { - const extDevice_t *nextDev = bus->curSegment->u.link.dev; - busSegment_t *nextSegments = (busSegment_t *)bus->curSegment->u.link.segments; busSegment_t *endSegment = (busSegment_t *)bus->curSegment; + const extDevice_t *nextDev = endSegment->u.link.dev; + busSegment_t *nextSegments = (busSegment_t *)endSegment->u.link.segments; bus->curSegment = nextSegments; endSegment->u.link.dev = NULL; + endSegment->u.link.segments = NULL; spiSequenceStart(nextDev); } else { // The end of the segment list has been reached, so mark transactions as complete