Skip to content

Commit cfa7e8a

Browse files
fix #5948 Adding back the SPI configuration to spi_flash_read/write_data
Removing this configures will break cases where the flash is on a shared SPI bus with a device that has different settings. This is rare but possible.
1 parent 23fb5f6 commit cfa7e8a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

supervisor/shared/external_flash/spi_flash.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ bool spi_flash_sector_command(uint8_t command, uint32_t address) {
105105

106106
bool spi_flash_write_data(uint32_t address, uint8_t *data, uint32_t data_length) {
107107
uint8_t request[4] = {CMD_PAGE_PROGRAM, 0x00, 0x00, 0x00};
108+
common_hal_busio_spi_configure(&supervisor_flash_spi_bus, spi_flash_baudrate, 0, 0, 8);
108109
// Write the SPI flash write address into the bytes following the command byte.
109110
address_to_bytes(address, request + 1);
110111
if (!flash_enable()) {
@@ -125,6 +126,7 @@ bool spi_flash_read_data(uint32_t address, uint8_t *data, uint32_t data_length)
125126
request[0] = CMD_FAST_READ_DATA;
126127
command_length = 5;
127128
}
129+
common_hal_busio_spi_configure(&supervisor_flash_spi_bus, spi_flash_baudrate, 0, 0, 8);
128130
// Write the SPI flash read address into the bytes following the command byte.
129131
address_to_bytes(address, request + 1);
130132
if (!flash_enable()) {

0 commit comments

Comments
 (0)