Maximum tested frequency is ~27MHz.

This commit is contained in:
Yilin Sun 2023-04-16 22:32:06 +08:00
parent c6cb4e1421
commit 6d619be606
Signed by: imi415
GPG Key ID: 17F01E106F9F5E0A
3 changed files with 14 additions and 12 deletions

View File

@ -10,7 +10,7 @@ void BOARD_InitBootPeripherals(void) {
void BOARD_InitQUADSPI(void) {
hqspi.Instance = QUADSPI;
hqspi.Init.ClockPrescaler = 1;
hqspi.Init.ClockPrescaler = 2;
hqspi.Init.FifoThreshold = 24;
hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_HALFCYCLE;
hqspi.Init.FlashSize = 22;

View File

@ -30,28 +30,28 @@ void BOARD_InitBootPins(void) {
GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_6;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
}

View File

@ -42,13 +42,15 @@ boot_fail_loop:
static int app_map_qspi(void) {
QSPI_CommandTypeDef cmd = {
.Instruction = 0xEB, /* Fast read quad IO with 4 byte address <1-4-4> */
.InstructionMode = QSPI_INSTRUCTION_1_LINE,
.AddressMode = QSPI_ADDRESS_4_LINES,
.AddressSize = QSPI_ADDRESS_24_BITS,
.AlternateByteMode = QSPI_ALTERNATE_BYTES_4_LINES,
.DataMode = QSPI_DATA_4_LINES,
.DummyCycles = 4U,
.Instruction = 0xEB, /* Fast read quad IO <1-4-4> */
.InstructionMode = QSPI_INSTRUCTION_1_LINE,
.AddressMode = QSPI_ADDRESS_4_LINES,
.AddressSize = QSPI_ADDRESS_24_BITS,
.AlternateByteMode = QSPI_ALTERNATE_BYTES_4_LINES,
.AlternateBytesSize = QSPI_ALTERNATE_BYTES_8_BITS,
.AlternateBytes = 0xF0,
.DataMode = QSPI_DATA_4_LINES,
.DummyCycles = 4U,
};
QSPI_MemoryMappedTypeDef mmap = {