Merge pull request #7229 from dhalbert/rp2040-spi-mode-3
RP2040: have clock start high when SPI polarity high
This commit is contained in:
commit
96fc85cd18
@ -151,6 +151,15 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
|
||||
|
||||
spi_set_format(self->peripheral, bits, polarity, phase, SPI_MSB_FIRST);
|
||||
|
||||
// Workaround to start with clock line high if polarity=1. The hw SPI peripheral does not do this
|
||||
// automatically. See https://github.com/raspberrypi/pico-sdk/issues/868 and
|
||||
// https://forums.raspberrypi.com/viewtopic.php?t=336142
|
||||
// TODO: scheduled to be be fixed in pico-sdk 1.5.0.
|
||||
if (polarity) {
|
||||
hw_clear_bits(&spi_get_hw(self->peripheral)->cr1, SPI_SSPCR1_SSE_BITS); // disable the SPI
|
||||
hw_set_bits(&spi_get_hw(self->peripheral)->cr1, SPI_SSPCR1_SSE_BITS); // re-enable the SPI
|
||||
}
|
||||
|
||||
self->polarity = polarity;
|
||||
self->phase = phase;
|
||||
self->bits = bits;
|
||||
|
Loading…
Reference in New Issue
Block a user