Skip to content

Commit 5b70fa0

Browse files
committed
enable internal SPI intercepts. can brick USB
1 parent 3a5de7e commit 5b70fa0

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

ports/stm32f4/boards/meowbit_v121/mpconfigboard.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#define BOARD_NO_VBUS
4040

4141
// On-board flash
42-
// #define SPI_FLASH_MOSI_PIN (&pin_PB15)
43-
// #define SPI_FLASH_MISO_PIN (&pin_PB14)
44-
// #define SPI_FLASH_SCK_PIN (&pin_PB13)
45-
// #define SPI_FLASH_CS_PIN (&pin_PB01)
42+
#define SPI_FLASH_MOSI_PIN (&pin_PB15)
43+
#define SPI_FLASH_MISO_PIN (&pin_PB14)
44+
#define SPI_FLASH_SCK_PIN (&pin_PB13)
45+
#define SPI_FLASH_CS_PIN (&pin_PB01)

ports/stm32f4/boards/meowbit_v121/mpconfigboard.mk

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ USB_PRODUCT = "Meowbit"
44
USB_MANUFACTURER = "Kittenbot"
55
USB_DEVICES = "CDC,MSC"
66

7-
# SPI_FLASH_FILESYSTEM = 1
8-
# EXTERNAL_FLASH_DEVICE_COUNT = 1
9-
# EXTERNAL_FLASH_DEVICES = W25Q16JV_IQ
10-
# LONGINT_IMPL = MPZ
7+
SPI_FLASH_FILESYSTEM = 1
8+
EXTERNAL_FLASH_DEVICE_COUNT = 1
9+
EXTERNAL_FLASH_DEVICES = W25Q16JV_IQ
10+
LONGINT_IMPL = MPZ
1111

12-
INTERNAL_FLASH_FILESYSTEM = 1
13-
LONGINT_IMPL = NONE
12+
# INTERNAL_FLASH_FILESYSTEM = 1
13+
# LONGINT_IMPL = NONE
1414

1515
MCU_SERIES = m4
1616
MCU_VARIANT = stm32f4
1717
MCU_SUB_VARIANT = stm32f401xe
1818
MCU_PACKAGE = 64
1919
CMSIS_MCU = STM32F401xE
20-
LD_FILE = boards/STM32F401_fs.ld
20+
LD_FILE = boards/STM32F401.ld
2121
TEXT0_ADDR = 0x08010000
2222
TEXT1_ADDR = 0x08020000

ports/stm32f4/boards/meowbit_v121/pins.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "shared-bindings/board/__init__.h"
2+
#include "supervisor/spi_flash_api.h"
23

34
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
45
{ MP_ROM_QSTR(MP_QSTR_LED_RED), MP_ROM_PTR(&pin_PB04) },
@@ -59,5 +60,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
5960
{ MP_ROM_QSTR(MP_QSTR_P0), MP_ROM_PTR(&pin_PA00) },
6061
{ MP_ROM_QSTR(MP_QSTR_P3), MP_ROM_PTR(&pin_PB00) },
6162

63+
{ MP_ROM_QSTR(MP_QSTR_INTERNAL_SPI), MP_ROM_PTR(&spi) },
6264
};
6365
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

supervisor/spi_flash_api.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131

3232
#include "supervisor/shared/external_flash/devices.h"
3333

34+
#include "shared-bindings/busio/SPI.h"
35+
36+
extern busio_spi_obj_t spi; //Used to share SPI bus on some boards
37+
3438
// This API is implemented for both normal SPI peripherals and QSPI peripherals.
3539

3640
bool spi_flash_command(uint8_t command);

0 commit comments

Comments
 (0)