Skip to content

Commit 071f9f0

Browse files
adustm0xc0170
authored andcommitted
Fix Address.Size and AlternateByes.Size by shifting them
The ST HAL code is waiting for the correctly shifted vlue (for a direct write into the HW register)
1 parent f3f8d26 commit 071f9f0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

targets/TARGET_STM/qspi_api.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ void qspi_prepare_command(const qspi_command_t *command, QSPI_CommandTypeDef *st
8181
st_command->AddressSize = 0;
8282
} else {
8383
st_command->Address = command->address.value;
84-
st_command->AddressSize = command->address.size;
84+
/* command->address.size needs to be shifted by QUADSPI_CCR_ADSIZE_Pos */
85+
st_command->AddressSize = (command->address.size << QUADSPI_CCR_ADSIZE_Pos) & QUADSPI_CCR_ADSIZE_Msk;
8586
}
8687

8788
switch (command->alt.bus_width) {
@@ -104,6 +105,8 @@ void qspi_prepare_command(const qspi_command_t *command, QSPI_CommandTypeDef *st
104105
st_command->AlternateBytesSize = 0;
105106
} else {
106107
st_command->AlternateBytes = command->alt.value;
108+
/* command->AlternateBytesSize needs to be shifted by QUADSPI_CCR_ABSIZE_Pos */
109+
st_command->AlternateBytesSize = (command->alt.size << QUADSPI_CCR_ABSIZE_Pos) & QUADSPI_CCR_ABSIZE_Msk;
107110
st_command->AlternateBytesSize = command->alt.size;
108111
}
109112

0 commit comments

Comments
 (0)