Skip to content

Commit c8d4b90

Browse files
authored
Merge pull request #14392 from jeromecoutant/PR_WB_QSPI
STM32WB: enable QSPI for custom boards
2 parents 866855d + 8064178 commit c8d4b90

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

targets/TARGET_STM/TARGET_STM32WB/objects.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,19 @@ struct trng_s {
141141
RNG_HandleTypeDef handle;
142142
};
143143

144+
#if DEVICE_QSPI
145+
struct qspi_s {
146+
QSPI_HandleTypeDef handle;
147+
QSPIName qspi;
148+
PinName io0;
149+
PinName io1;
150+
PinName io2;
151+
PinName io3;
152+
PinName sclk;
153+
PinName ssel;
154+
};
155+
#endif
156+
144157
#ifdef __cplusplus
145158
}
146159
#endif

targets/TARGET_STM/qspi_api.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ qspi_status_t qspi_prepare_command(const qspi_command_t *command, QSPI_CommandTy
258258
// these are target specific settings, use default values
259259
st_command->SIOOMode = QSPI_SIOO_INST_EVERY_CMD;
260260
st_command->DdrMode = QSPI_DDR_MODE_DISABLE;
261+
#if defined(QSPI_DDR_HHC_ANALOG_DELAY)
261262
st_command->DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
263+
#endif
262264

263265
if (command->address.disabled == true) {
264266
st_command->AddressMode = QSPI_ADDRESS_NONE;
@@ -800,10 +802,10 @@ qspi_status_t qspi_write(qspi_t *obj, const qspi_command_t *command, const void
800802

801803
st_command.NbData = *length;
802804

803-
if (HAL_QSPI_Command(&obj->handle, &st_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
805+
if (HAL_QSPI_Command(&obj->handle, &st_command, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
804806
status = QSPI_STATUS_ERROR;
805807
} else {
806-
if (HAL_QSPI_Transmit(&obj->handle, (uint8_t *)data, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
808+
if (HAL_QSPI_Transmit(&obj->handle, (uint8_t *)data, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
807809
status = QSPI_STATUS_ERROR;
808810
}
809811
}
@@ -849,10 +851,10 @@ qspi_status_t qspi_read(qspi_t *obj, const qspi_command_t *command, void *data,
849851

850852
st_command.NbData = *length;
851853

852-
if (HAL_QSPI_Command(&obj->handle, &st_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
854+
if (HAL_QSPI_Command(&obj->handle, &st_command, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
853855
status = QSPI_STATUS_ERROR;
854856
} else {
855-
if (HAL_QSPI_Receive(&obj->handle, data, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
857+
if (HAL_QSPI_Receive(&obj->handle, data, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
856858
status = QSPI_STATUS_ERROR;
857859
}
858860
}
@@ -920,7 +922,7 @@ qspi_status_t qspi_command_transfer(qspi_t *obj, const qspi_command_t *command,
920922

921923
st_command.NbData = 1;
922924
st_command.DataMode = QSPI_DATA_NONE; /* Instruction only */
923-
if (HAL_QSPI_Command(&obj->handle, &st_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
925+
if (HAL_QSPI_Command(&obj->handle, &st_command, HAL_QSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
924926
status = QSPI_STATUS_ERROR;
925927
return status;
926928
}

0 commit comments

Comments
 (0)