I have got an STM32H743VIT6 dev board which I'm trying to build firmware for.
I copied the configurations of NUCLEO_H743ZI and started from there. However, there are still some questions I haven't got the answers after hours of searching regarding the config of mpconfigboard.h... So I turn to the forum for help.
- CPU & USB clock settings
Code: Select all
// The board has an 8MHz HSE, the following gives 480MHz CPU speed
// VCOClock = HSE * PLLN / PLLM = 8 MHz * 480 / 4 = 960 MHz
// SYSCLK = VCOClock / PLLP = 960 MHz / 2 = 480 MHz
#define MICROPY_HW_CLK_PLLM (4)
#define MICROPY_HW_CLK_PLLN (480)
#define MICROPY_HW_CLK_PLLP (2)
#define MICROPY_HW_CLK_PLLQ (4)
#define MICROPY_HW_CLK_PLLR (2)
// The USB clock is set using PLL3
#define MICROPY_HW_CLK_PLL3M (4)
#define MICROPY_HW_CLK_PLL3N (120)
#define MICROPY_HW_CLK_PLL3P (2)
#define MICROPY_HW_CLK_PLL3Q (5)
#define MICROPY_HW_CLK_PLL3R (2)
// 4 wait states
#define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_4
Question #2: How to correctly set the USB clock with HW_CLK_PLL3* (or what's the equation for proper calculation)? I saw some discussions here: viewtopic.php?f=12&t=7504&start=10, but couldn't get a conclusion about it.
Question #3: Did I set the wait states correctly (FLASH_LATENCY_4)? That was from the settings of NUCLEO_H743ZI as well.
- Extenal SPI Flash & Extenal QSPI Flash
https://www.programmersought.com/article/29676545292/
https://github.com/mcauser/BLACK_F407VE ... figboard.h
https://github.com/micropython/micropyt ... figboard.h
Code: Select all
// 1 = use internal flash (2 MByte)
// 0 = use onboard SPI flash (8 MByte) Winbond W25Q64
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1)
// If using onboard SPI flash
#if !MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
// Winbond W25Q64 QSPI Flash = 64 Mbit (8 Mbyte)
#define MICROPY_HW_SPIFLASH_SIZE_BITS (64 * 1024 * 1024)
#define MICROPY_HW_SPIFLASH_CS (pin_B12)
#define MICROPY_HW_SPIFLASH_SCK (pin_B13)
#define MICROPY_HW_SPIFLASH_MISO (pin_B14)
#define MICROPY_HW_SPIFLASH_MOSI (pin_B15)
#define MICROPY_HW_QSPIFLASH_SIZE_BITS_LOG2 (28)
#define MICROPY_HW_QSPIFLASH_CS (pin_B10)
#define MICROPY_HW_QSPIFLASH_SCK (pin_B2)
#define MICROPY_HW_QSPIFLASH_IO0 (pin_D11)
#define MICROPY_HW_QSPIFLASH_IO1 (pin_D12)
#define MICROPY_HW_QSPIFLASH_IO2 (pin_E2)
#define MICROPY_HW_QSPIFLASH_IO3 (pin_A1)
extern const struct _mp_spiflash_config_t spiflash_config;
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 ? spi_bdev_ioctl(&spi_bdev, (op), (uint32_t)&spiflash_config) : \
spi_bdev_ioctl(&spi_bdev, (op), (arg)) \
)
#define MICROPY_HW_BDEV_READBLOCKS(dest, bl, n) spi_bdev_readblocks(&spi_bdev, (dest), (bl), (n))
#define MICROPY_HW_BDEV_WRITEBLOCKS(src, bl, n) spi_bdev_writeblocks(&spi_bdev, (src), (bl), (n))
#endif
Code: Select all
#define MICROPY_HW_SPIFLASH_ENABLE_CACHE (1)
#define MICROPY_HW_BDEV_SPIFLASH_EXTENDED (&spi_bdev) // for extended block protocol
Here's the schematics: Thanks in advance for the help!