Skip to content

Commit 37e10d4

Browse files
committed
Be more careful when initing the board outside the VM.
1 parent 03be42a commit 37e10d4

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

ports/atmel-samd/common-hal/busio/SPI.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,16 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
8989
Sercom* sercom = NULL;
9090
uint8_t sercom_index;
9191
uint32_t clock_pinmux = 0;
92-
bool mosi_none = mosi == mp_const_none;
93-
bool miso_none = miso == mp_const_none;
92+
bool mosi_none = mosi == mp_const_none || mosi == NULL;
93+
bool miso_none = miso == mp_const_none || miso == NULL;
9494
uint32_t mosi_pinmux = 0;
9595
uint32_t miso_pinmux = 0;
9696
uint8_t clock_pad = 0;
9797
uint8_t mosi_pad = 0;
9898
uint8_t miso_pad = 0;
9999
uint8_t dopo = 255;
100+
101+
// Special case for SAMR boards.
100102
#ifdef PIN_PC19
101103
if (miso == &pin_PC19) {
102104
if (mosi == &pin_PB30 && clock == &pin_PC18) {

ports/atmel-samd/supervisor/port.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ safe_mode_t port_init(void) {
171171

172172
init_shared_dma();
173173

174+
// Reset everything into a known state before board_init.
175+
reset_port();
176+
174177
// Init the board last so everything else is ready
175178
board_init();
176179

0 commit comments

Comments
 (0)