From d74a132735c362bdb7fec3462395dc7b799d5dc0 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Fri, 31 Mar 2023 23:27:43 +0200 Subject: [PATCH] rp2040: fix max SPI frequency I think the previous numbers came from an older revision of the datasheet? They're certainly not in the current revision, which gives 62.5MHz as the maximum speed. --- src/machine/machine_rp2040_spi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/machine/machine_rp2040_spi.go b/src/machine/machine_rp2040_spi.go index d21ad1f82..b623c1294 100644 --- a/src/machine/machine_rp2040_spi.go +++ b/src/machine/machine_rp2040_spi.go @@ -114,7 +114,7 @@ func (spi SPI) Transfer(w byte) (byte, error) { func (spi SPI) SetBaudRate(br uint32) error { const freqin uint32 = 125 * MHz - const maxBaud uint32 = 66.5 * MHz // max output frequency is 66.5MHz on rp2040. see Note page 527. + const maxBaud uint32 = 62.5 * MHz // max output frequency is 62.5MHz on rp2040, see page 507 // Find smallest prescale value which puts output frequency in range of // post-divide. Prescale is an even number from 2 to 254 inclusive. var prescale, postdiv uint32