Reduce flash clock for stability.
This commit is contained in:
parent
47699ff981
commit
b8306f40ae
|
@ -9,8 +9,8 @@
|
|||
|
||||
#define APP_FLASH_COMMAND_TIMEOUT (5000)
|
||||
|
||||
#define LED_G_Pin GPIO_PIN_1
|
||||
#define LED_G_GPIO_Port GPIOA
|
||||
#define LED_G_Pin GPIO_PIN_1
|
||||
#define LED_G_GPIO_Port GPIOA
|
||||
|
||||
#define APP_DBG_LED_SET(x) HAL_GPIO_WritePin(LED_G_GPIO_Port, LED_G_Pin, x)
|
||||
|
||||
|
@ -73,12 +73,11 @@ static void GPIO_Init(void) {
|
|||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(LED_G_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
}
|
||||
|
||||
static int QSPI_Init(void) {
|
||||
hqspi.Instance = QUADSPI;
|
||||
hqspi.Init.ClockPrescaler = 0;
|
||||
hqspi.Init.ClockPrescaler = 7;
|
||||
hqspi.Init.FifoThreshold = 4;
|
||||
hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_HALFCYCLE;
|
||||
hqspi.Init.FlashSize = APP_FLASH_BITS;
|
||||
|
@ -190,7 +189,7 @@ int Flash_ProgramPage(uint32_t addr, uint8_t *data, uint32_t len) {
|
|||
}
|
||||
|
||||
QSPI_CommandTypeDef cmd = {
|
||||
.Instruction = 0x32, /* Quad input page program with 4 byte address */
|
||||
.Instruction = 0x32, /* Quad input page program */
|
||||
.InstructionMode = QSPI_INSTRUCTION_1_LINE,
|
||||
.Address = addr,
|
||||
.AddressMode = QSPI_ADDRESS_1_LINE,
|
||||
|
@ -241,20 +240,21 @@ int Flash_EraseChip(void) {
|
|||
return -3;
|
||||
}
|
||||
|
||||
|
||||
APP_DBG_LED_SET(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Flash_Map(void) {
|
||||
QSPI_CommandTypeDef cmd = {
|
||||
.Instruction = 0xEB, /* Fast read quad IO */
|
||||
.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 */
|
||||
.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 = {
|
||||
|
|
|
@ -35,28 +35,28 @@ void HAL_QSPI_MspInit(QSPI_HandleTypeDef* qspiHandle) {
|
|||
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_LOW;
|
||||
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_LOW;
|
||||
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_LOW;
|
||||
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_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue