@@ -107,7 +107,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
107107 continue ;
108108 }
109109 //store pins if not
110- self -> sck = & mcu_spi_sck_list [j ];
110+ self -> sck = & mcu_spi_sck_list [i ];
111111 self -> mosi = & mcu_spi_mosi_list [j ];
112112 self -> miso = & mcu_spi_miso_list [k ];
113113 break ;
@@ -196,7 +196,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
196196 self -> handle .Init .CLKPolarity = SPI_POLARITY_LOW ;
197197 self -> handle .Init .CLKPhase = SPI_PHASE_1EDGE ;
198198 self -> handle .Init .NSS = SPI_NSS_SOFT ;
199- self -> handle .Init .BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16 ;
199+ self -> handle .Init .BaudRatePrescaler = SPI_BAUDRATEPRESCALER_256 ;
200200 self -> handle .Init .FirstBit = SPI_FIRSTBIT_MSB ;
201201 self -> handle .Init .TIMode = SPI_TIMODE_DISABLE ;
202202 self -> handle .Init .CRCCalculation = SPI_CRCCALCULATION_DISABLE ;
@@ -383,20 +383,20 @@ void common_hal_busio_spi_unlock(busio_spi_obj_t *self) {
383383
384384bool common_hal_busio_spi_write (busio_spi_obj_t * self ,
385385 const uint8_t * data , size_t len ) {
386- HAL_StatusTypeDef result = HAL_SPI_Transmit (& self -> handle , (uint8_t * )data , (uint16_t )len , 2 );
386+ HAL_StatusTypeDef result = HAL_SPI_Transmit (& self -> handle , (uint8_t * )data , (uint16_t )len , 5 );
387387 return result == HAL_OK ? 1 : 0 ;
388388}
389389
390390bool common_hal_busio_spi_read (busio_spi_obj_t * self ,
391391 uint8_t * data , size_t len , uint8_t write_value ) {
392- HAL_StatusTypeDef result = HAL_SPI_Receive (& self -> handle , data , (uint16_t )len , 2 );
392+ HAL_StatusTypeDef result = HAL_SPI_Receive (& self -> handle , data , (uint16_t )len , 5 );
393393 return result == HAL_OK ? 1 : 0 ;
394394}
395395
396396bool common_hal_busio_spi_transfer (busio_spi_obj_t * self ,
397397 uint8_t * data_out , uint8_t * data_in , size_t len ) {
398398 HAL_StatusTypeDef result = HAL_SPI_TransmitReceive (& self -> handle ,
399- data_out , data_in , (uint16_t )len ,2 );
399+ data_out , data_in , (uint16_t )len ,5 );
400400 return result == HAL_OK ? 1 : 0 ;
401401}
402402
0 commit comments