File tree Expand file tree Collapse file tree
ports/broadcom/common-hal/busio Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
9898 self -> sda_pin = sda ;
9999 self -> scl_pin = scl ;
100100
101- uint32_t source_clock = vcmailbox_get_clock_rate_measured (VCMAILBOX_CLOCK_CORE );
101+ uint32_t source_clock = vcmailbox_get_clock_rate (VCMAILBOX_CLOCK_CORE );
102102 uint16_t clock_divider = source_clock / frequency ;
103103 self -> peripheral -> DIV_b .CDIV = clock_divider ;
104104
Original file line number Diff line number Diff line change @@ -87,6 +87,8 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
8787 mp_raise_NotImplementedError (translate ("Half duplex SPI is not implemented" ));
8888 }
8989
90+ // BCM_VERSION != 2711 have 3 SPI but as listed in peripherals/gen/pins.c two are on
91+ // index 0, once one index 0 SPI is found the other will throw an invalid_pins error.
9092 for (size_t i = 0 ; i < NUM_SPI ; i ++ ) {
9193 if (spi_in_use [i ]) {
9294 continue ;
@@ -157,6 +159,7 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
157159 common_hal_reset_pin (self -> MOSI );
158160 common_hal_reset_pin (self -> MISO );
159161 self -> clock = NULL ;
162+ spi_in_use [self -> index ] = false;
160163
161164 if (self -> index == 1 ||
162165 self -> index == 2 ) {
@@ -198,7 +201,7 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
198201 SPI0_Type * p = spi [self -> index ];
199202 p -> CS = polarity << SPI0_CS_CPOL_Pos |
200203 phase << SPI0_CS_CPHA_Pos ;
201- uint32_t source_clock = vcmailbox_get_clock_rate_measured (VCMAILBOX_CLOCK_CORE );
204+ uint32_t source_clock = vcmailbox_get_clock_rate (VCMAILBOX_CLOCK_CORE );
202205 uint16_t clock_divider = source_clock / baudrate ;
203206 if (source_clock % baudrate > 0 ) {
204207 clock_divider += 2 ;
Original file line number Diff line number Diff line change @@ -460,7 +460,7 @@ uint32_t common_hal_busio_uart_get_baudrate(busio_uart_obj_t *self) {
460460
461461void common_hal_busio_uart_set_baudrate (busio_uart_obj_t * self , uint32_t baudrate ) {
462462 if (self -> uart_id == 1 ) {
463- uint32_t source_clock = vcmailbox_get_clock_rate_measured (VCMAILBOX_CLOCK_CORE );
463+ uint32_t source_clock = vcmailbox_get_clock_rate (VCMAILBOX_CLOCK_CORE );
464464 UART1 -> BAUD = ((source_clock / (baudrate * 8 )) - 1 );
465465 } else {
466466 ARM_UART_PL011_Type * pl011 = uart [self -> uart_id ];
You can’t perform that action at this time.
0 commit comments