Setup flash pins on Sparkfun SAMD51 Micromod

This commit is contained in:
George White 2022-04-17 17:18:45 +00:00
parent f502703e52
commit 0ba93b20e5
3 changed files with 28 additions and 0 deletions

View File

@ -26,6 +26,9 @@
#include "supervisor/board.h"
#include "mpconfigboard.h"
#include "common-hal/microcontroller/Pin.h"
#include "hal/include/hal_gpio.h"
#include "py/mphal.h"
void board_init(void) {
}
@ -39,3 +42,23 @@ void reset_board(void) {
void board_deinit(void) {
}
void external_flash_setup(void) {
// Do not reset the external flash write-protect and hold pins high
never_reset_pin_number(PIN_PB22);
never_reset_pin_number(PIN_PB23);
// note: using output instead of input+pullups because the pullups are a little weak
// Set the WP pin high
gpio_set_pin_function(PIN_PB22, GPIO_PIN_FUNCTION_OFF);
gpio_set_pin_direction(PIN_PB22, GPIO_DIRECTION_OUT);
gpio_set_pin_level(PIN_PB22, true);
// Set the HOLD pin high
gpio_set_pin_function(PIN_PB23, GPIO_PIN_FUNCTION_OFF);
gpio_set_pin_direction(PIN_PB23, GPIO_DIRECTION_OUT);
gpio_set_pin_level(PIN_PB23, true);
// Add some delay to give the pins time to get set
// mp_hal_delay_ms(3000);
}

View File

@ -27,3 +27,7 @@
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
// The external flash chip has WP (write-protect) and hold pins we should ignore
#define IGNORE_PIN_PB22
#define IGNORE_PIN_PB23

View File

@ -13,3 +13,4 @@ EXTERNAL_FLASH_DEVICES = W25Q128JVxM
LONGINT_IMPL = MPZ
CIRCUITPY_PS2IO = 1
CIRCUITPY_EXTERNAL_FLASH_SETUP = 1