Skip to content

Commit

Permalink
Set SPI TX/RX lengths even data is empty. Fixes #3868
Browse files Browse the repository at this point in the history
  • Loading branch information
Pertti Erkkilä committed Aug 21, 2023
1 parent e3bc6da commit d444983
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/machine/machine_nrf52xxx.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ func (spi SPI) Tx(w, r []byte) error {
}
spi.Bus.RXD.MAXCNT.Set(n)
r = r[n:]
} else {
spi.Bus.RXD.MAXCNT.Set(0)
}
if len(w) != 0 {
spi.Bus.TXD.PTR.Set(uint32(uintptr(unsafe.Pointer(&w[0]))))
Expand All @@ -305,6 +307,8 @@ func (spi SPI) Tx(w, r []byte) error {
}
spi.Bus.TXD.MAXCNT.Set(n)
w = w[n:]
} else {
spi.Bus.TXD.MAXCNT.Set(0)
}

// Do the transfer.
Expand Down

0 comments on commit d444983

Please sign in to comment.