From 7d83e768331c329139f9f7f3dd1641ff06a1040d Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sat, 1 Apr 2023 23:46:14 +0200 Subject: [PATCH] rp2040: use 4MHz as default frequency for SPI This matches other SPI implementations. I think the original value of 115200 was from a confusion with UART. --- src/machine/machine_rp2040_spi.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/machine/machine_rp2040_spi.go b/src/machine/machine_rp2040_spi.go index 3c67fdbf..5dc31e8e 100644 --- a/src/machine/machine_rp2040_spi.go +++ b/src/machine/machine_rp2040_spi.go @@ -136,7 +136,7 @@ func (spi SPI) GetBaudRate() uint32 { } // Configure is intended to setup/initialize the SPI interface. -// Default baudrate of 115200 is used if Frequency == 0. Default +// Default baudrate of 4MHz is used if Frequency == 0. Default // word length (data bits) is 8. // Below is a list of GPIO pins corresponding to SPI0 bus on the rp2040: // @@ -152,7 +152,7 @@ func (spi SPI) GetBaudRate() uint32 { // // No pin configuration is needed of SCK, SDO and SDI needed after calling Configure. func (spi SPI) Configure(config SPIConfig) error { - const defaultBaud uint32 = 115200 + const defaultBaud uint32 = 4 * MHz if config.SCK == 0 && config.SDO == 0 && config.SDI == 0 { // set default pins if config zero valued or invalid clock pin supplied. switch spi.Bus {