@@ -105,12 +105,12 @@ bool spi_flash_sector_command(uint8_t command, uint32_t address) {
105
105
106
106
bool spi_flash_write_data (uint32_t address , uint8_t * data , uint32_t data_length ) {
107
107
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 );
108
109
// Write the SPI flash write address into the bytes following the command byte.
109
110
address_to_bytes (address , request + 1 );
110
111
if (!flash_enable ()) {
111
112
return false;
112
113
}
113
- common_hal_busio_spi_configure (& supervisor_flash_spi_bus , spi_flash_baudrate , 0 , 0 , 8 );
114
114
bool status = common_hal_busio_spi_write (& supervisor_flash_spi_bus , request , 4 );
115
115
if (status ) {
116
116
status = common_hal_busio_spi_write (& supervisor_flash_spi_bus , data , data_length );
@@ -126,12 +126,12 @@ bool spi_flash_read_data(uint32_t address, uint8_t *data, uint32_t data_length)
126
126
request [0 ] = CMD_FAST_READ_DATA ;
127
127
command_length = 5 ;
128
128
}
129
+ common_hal_busio_spi_configure (& supervisor_flash_spi_bus , spi_flash_baudrate , 0 , 0 , 8 );
129
130
// Write the SPI flash read address into the bytes following the command byte.
130
131
address_to_bytes (address , request + 1 );
131
132
if (!flash_enable ()) {
132
133
return false;
133
134
}
134
- common_hal_busio_spi_configure (& supervisor_flash_spi_bus , spi_flash_baudrate , 0 , 0 , 8 );
135
135
bool status = common_hal_busio_spi_write (& supervisor_flash_spi_bus , request , command_length );
136
136
if (status ) {
137
137
status = common_hal_busio_spi_read (& supervisor_flash_spi_bus , data , data_length , 0xff );
0 commit comments