Skip to content

Commit f2599f4

Browse files
Xpresso: qspi_write fix
Due to the data buffer is loaded in two steps the whole block needs protection from being interrupted
1 parent e69a7c9 commit f2599f4

File tree

1 file changed

+3
-0
lines changed
  • targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api

1 file changed

+3
-0
lines changed

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/qspi_api.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "pinmap.h"
3535
#include "PeripheralPins.h"
3636
#include "qspi_device.h"
37+
#include "platform/mbed_critical.h"
3738

3839
/* Look-up table entry indices */
3940
#define LUT1_SEQ_INDEX 0 // Pre-defined read sequence
@@ -267,6 +268,7 @@ qspi_status_t qspi_write(qspi_t *obj, const qspi_command_t *command, const void
267268
return QSPI_STATUS_INVALID_PARAMETER;
268269
}
269270

271+
core_util_critical_section_enter();
270272
/* Prepare the write command */
271273
qspi_prepare_command(obj, command, data, to_write, NULL, 0);
272274

@@ -295,6 +297,7 @@ qspi_status_t qspi_write(qspi_t *obj, const qspi_command_t *command, const void
295297
if (to_write) {
296298
QSPI_WriteBlocking(base, (uint32_t *)data_send, to_write);
297299
}
300+
core_util_critical_section_exit();
298301

299302
while (QSPI_GetStatusFlags(base) & (kQSPI_Busy | kQSPI_IPAccess)) {
300303
}

0 commit comments

Comments
 (0)