File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed
ports/atmel-samd/boards/sparkfun_samd51_micromod Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 26
26
27
27
#include "supervisor/board.h"
28
28
#include "mpconfigboard.h"
29
+ #include "common-hal/microcontroller/Pin.h"
30
+ #include "hal/include/hal_gpio.h"
31
+ #include "py/mphal.h"
29
32
30
33
void board_init (void ) {
31
34
}
@@ -39,3 +42,23 @@ void reset_board(void) {
39
42
40
43
void board_deinit (void ) {
41
44
}
45
+
46
+ void external_flash_setup (void ) {
47
+ // Do not reset the external flash write-protect and hold pins high
48
+ never_reset_pin_number (PIN_PB22 );
49
+ never_reset_pin_number (PIN_PB23 );
50
+
51
+ // note: using output instead of input+pullups because the pullups are a little weak
52
+ // Set the WP pin high
53
+ gpio_set_pin_function (PIN_PB22 , GPIO_PIN_FUNCTION_OFF );
54
+ gpio_set_pin_direction (PIN_PB22 , GPIO_DIRECTION_OUT );
55
+ gpio_set_pin_level (PIN_PB22 , true);
56
+
57
+ // Set the HOLD pin high
58
+ gpio_set_pin_function (PIN_PB23 , GPIO_PIN_FUNCTION_OFF );
59
+ gpio_set_pin_direction (PIN_PB23 , GPIO_DIRECTION_OUT );
60
+ gpio_set_pin_level (PIN_PB23 , true);
61
+
62
+ // Add some delay to give the pins time to get set
63
+ // mp_hal_delay_ms(3000);
64
+ }
Original file line number Diff line number Diff line change 27
27
// USB is always used internally so skip the pin objects for it.
28
28
#define IGNORE_PIN_PA24 1
29
29
#define IGNORE_PIN_PA25 1
30
+
31
+ // The external flash chip has WP (write-protect) and hold pins we should ignore
32
+ #define IGNORE_PIN_PB22
33
+ #define IGNORE_PIN_PB23
Original file line number Diff line number Diff line change @@ -13,3 +13,4 @@ EXTERNAL_FLASH_DEVICES = W25Q128JVxM
13
13
LONGINT_IMPL = MPZ
14
14
15
15
CIRCUITPY_PS2IO = 1
16
+ CIRCUITPY_EXTERNAL_FLASH_SETUP = 1
You can’t perform that action at this time.
0 commit comments