File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed
ports/broadcom/common-hal/busio Expand file tree Collapse file tree 3 files changed +6
-3
lines changed 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,
98
98
self -> sda_pin = sda ;
99
99
self -> scl_pin = scl ;
100
100
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 );
102
102
uint16_t clock_divider = source_clock / frequency ;
103
103
self -> peripheral -> DIV_b .CDIV = clock_divider ;
104
104
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,
87
87
mp_raise_NotImplementedError (translate ("Half duplex SPI is not implemented" ));
88
88
}
89
89
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.
90
92
for (size_t i = 0 ; i < NUM_SPI ; i ++ ) {
91
93
if (spi_in_use [i ]) {
92
94
continue ;
@@ -157,6 +159,7 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
157
159
common_hal_reset_pin (self -> MOSI );
158
160
common_hal_reset_pin (self -> MISO );
159
161
self -> clock = NULL ;
162
+ spi_in_use [self -> index ] = false;
160
163
161
164
if (self -> index == 1 ||
162
165
self -> index == 2 ) {
@@ -198,7 +201,7 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
198
201
SPI0_Type * p = spi [self -> index ];
199
202
p -> CS = polarity << SPI0_CS_CPOL_Pos |
200
203
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 );
202
205
uint16_t clock_divider = source_clock / baudrate ;
203
206
if (source_clock % baudrate > 0 ) {
204
207
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) {
460
460
461
461
void common_hal_busio_uart_set_baudrate (busio_uart_obj_t * self , uint32_t baudrate ) {
462
462
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 );
464
464
UART1 -> BAUD = ((source_clock / (baudrate * 8 )) - 1 );
465
465
} else {
466
466
ARM_UART_PL011_Type * pl011 = uart [self -> uart_id ];
You can’t perform that action at this time.
0 commit comments