Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
36211baf
Commit
36211baf
authored
Jun 02, 2022
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stm32/boards/LEGO_HUB_NO6: Make all SPI flash transfers use 32-bit addr.
Signed-off-by:
Damien George
<
damien@micropython.org
>
parent
87fbceef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
17 deletions
+8
-17
ports/stm32/boards/LEGO_HUB_NO6/bdev.c
ports/stm32/boards/LEGO_HUB_NO6/bdev.c
+0
-14
ports/stm32/boards/LEGO_HUB_NO6/mpconfigboard.h
ports/stm32/boards/LEGO_HUB_NO6/mpconfigboard.h
+8
-3
No files found.
ports/stm32/boards/LEGO_HUB_NO6/bdev.c
View file @
36211baf
...
...
@@ -28,8 +28,6 @@
#include "storage.h"
#include "spi.h"
#define CMD_EXIT_4_BYTE_ADDRESS_MODE (0xE9)
STATIC
const
spi_proto_cfg_t
spi_bus
=
{
.
spi
=
&
spi_obj
[
1
],
// SPI2 hardware peripheral
.
baudrate
=
25000000
,
...
...
@@ -50,15 +48,3 @@ const mp_spiflash_config_t spiflash_config = {
};
spi_bdev_t
spi_bdev
;
int32_t
board_bdev_ioctl
(
void
)
{
int32_t
ret
=
spi_bdev_ioctl
(
&
spi_bdev
,
BDEV_IOCTL_INIT
,
(
uint32_t
)
&
spiflash_config
);
// Exit 4-byte address mode
uint8_t
cmd
=
CMD_EXIT_4_BYTE_ADDRESS_MODE
;
mp_hal_pin_write
(
MICROPY_HW_SPIFLASH_CS
,
0
);
spi_proto
.
transfer
(
MP_OBJ_FROM_PTR
(
&
spi_bus
),
1
,
&
cmd
,
NULL
);
mp_hal_pin_write
(
MICROPY_HW_SPIFLASH_CS
,
1
);
return
ret
;
}
ports/stm32/boards/LEGO_HUB_NO6/mpconfigboard.h
View file @
36211baf
...
...
@@ -78,6 +78,10 @@
#define MICROPY_HW_BLE_UART_BAUDRATE_SECONDARY (921600)
#define MICROPY_HW_BLE_BTSTACK_CHIPSET_INSTANCE btstack_chipset_cc256x_instance()
// External SPI flash starts in 32-bit addressing mode, so make all SPI flash
// transfers use the explicit 32-bit addressing instructions.
#define MICROPY_HW_SPI_ADDR_IS_32BIT(addr) (1)
// SPI flash, for R/W storage
// The first 1MiB is skipped because it's used by the built-in bootloader
// Note: MICROPY_HW_SPIFLASH_OFFSET_BYTES must be a multiple of MP_SPIFLASH_ERASE_BLOCK_SIZE
...
...
@@ -92,11 +96,9 @@
#define MICROPY_HW_SPIFLASH_MOSI (MICROPY_HW_SPI2_MOSI)
// SPI flash, block device config
extern
int32_t
board_bdev_ioctl
(
void
);
extern
struct
_spi_bdev_t
spi_bdev
;
#define MICROPY_HW_BDEV_IOCTL(op, arg) ( \
(op) == BDEV_IOCTL_NUM_BLOCKS ? (MICROPY_HW_SPIFLASH_SIZE_BITS / 8 / FLASH_BLOCK_SIZE) : \
(op) == BDEV_IOCTL_INIT ?
board_bdev_ioctl(
) : \
(op) == BDEV_IOCTL_INIT ?
spi_bdev_ioctl(&spi_bdev, (op), (uint32_t)&spiflash_config
) : \
spi_bdev_ioctl(&spi_bdev, (op), (arg)) \
)
...
...
@@ -134,6 +136,9 @@ extern struct _spi_bdev_t spi_bdev;
/******************************************************************************/
// Function declarations
extern
const
struct
_mp_spiflash_config_t
spiflash_config
;
extern
struct
_spi_bdev_t
spi_bdev
;
void
board_init
(
void
);
void
board_mboot_cleanup
(
int
reset_mode
);
void
board_mboot_led_init
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment