From 8da072d8af64945a4597b9831057491d36cfed23 Mon Sep 17 00:00:00 2001 From: Martin Kojtal <0xc0170@gmail.com> Date: Thu, 23 Nov 2017 14:54:32 +0000 Subject: [PATCH] QSPI STM32: set default command values to none --- targets/TARGET_STM/qspi_api.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/targets/TARGET_STM/qspi_api.c b/targets/TARGET_STM/qspi_api.c index a412e679d6..37eab642c1 100644 --- a/targets/TARGET_STM/qspi_api.c +++ b/targets/TARGET_STM/qspi_api.c @@ -49,6 +49,9 @@ void qspi_prepare_command(const qspi_command_t *command, QSPI_CommandTypeDef *st case QSPI_CFG_BUS_QUAD: st_command->InstructionMode = QSPI_INSTRUCTION_4_LINES; break; + default: + st_command->InstructionMode = QSPI_INSTRUCTION_NONE; + break; } st_command->Instruction = command->instruction.value; @@ -69,7 +72,7 @@ void qspi_prepare_command(const qspi_command_t *command, QSPI_CommandTypeDef *st st_command->AddressMode = QSPI_ADDRESS_4_LINES; break; default: - st_command->AddressMode = QSPI_ADDRESS_1_LINE; + st_command->AddressMode = QSPI_ADDRESS_NONE; break; } @@ -88,7 +91,7 @@ void qspi_prepare_command(const qspi_command_t *command, QSPI_CommandTypeDef *st st_command->AlternateByteMode = QSPI_ALTERNATE_BYTES_4_LINES; break; default: - st_command->AlternateByteMode = QSPI_ALTERNATE_BYTES_1_LINE; + st_command->AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE; break; } @@ -107,7 +110,7 @@ void qspi_prepare_command(const qspi_command_t *command, QSPI_CommandTypeDef *st st_command->DataMode = QSPI_DATA_4_LINES; break; default: - st_command->DataMode = QSPI_DATA_1_LINE; + st_command->DataMode = QSPI_DATA_NONE; break; } } @@ -162,8 +165,6 @@ qspi_status_t qspi_frequency(qspi_t *obj, int hz) { qspi_status_t status = QSPI_STATUS_OK; - // TODO calculate prescalers properly, needs some work - // HCLK drives QSPI int div = HAL_RCC_GetHCLKFreq() / hz; if (div > 256 || div < 1) {