Skip to content

Commit 87a5e47

Browse files
authored
Merge pull request #11631 from maciejbocianski/qspi_frequency_test_fix
Qspi frequency test fix
2 parents 98072b2 + d541866 commit 87a5e47

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

TESTS/mbed_hal/qspi/flash_configs/SiliconLabs/EFM32GG11_STK3701/flash_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@
2323
#define QSPI_SECTOR_COUNT 1024 // for MX25R3235F
2424
#endif
2525

26+
#define QSPI_MIN_FREQUENCY 2000000
27+
2628
#endif // MBED_QSPI_FLASH_CONFIG_H

TESTS/mbed_hal/qspi/main.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ using namespace utest::v1;
4242

4343

4444

45+
#ifndef QSPI_MIN_FREQUENCY
4546
#define QSPI_MIN_FREQUENCY 1000000
47+
#endif
4648

4749
// max write size is usually page size
4850
#define DATA_SIZE_256 (QSPI_PAGE_SIZE)
@@ -344,18 +346,17 @@ void qspi_frequency_test(void)
344346
ret = qspi_init(&qspi.handle, QPIN_0, QPIN_1, QPIN_2, QPIN_3, QSCK, QCSN, freq, 0);
345347
TEST_ASSERT_EQUAL(QSPI_STATUS_OK, ret);
346348

347-
do {
349+
while (ret == QSPI_STATUS_OK && freq >= QSPI_MIN_FREQUENCY) {
348350
// check if the memory is working properly
349351
qspi.cmd.configure(MODE_1_1_1, ADDR_SIZE_24, ALT_SIZE_8);
350-
352+
ret = qspi_frequency(&qspi.handle, freq);
351353
flash_init(qspi);
352354
_qspi_write_read_test(qspi, WRITE_1_1_1, ADDR_SIZE_24, ALT_SIZE_8, WRITE_SINGLE, READ_1_1_1, ADDR_SIZE_24, ALT_SIZE_8, READ_SINGLE, TEST_REPEAT_SINGLE, DATA_SIZE_256, TEST_FLASH_ADDRESS);
353355

354356
utest_printf("frequency setting %d [Hz] - OK\r\n", freq);
355357

356358
freq /= 2;
357-
ret = qspi_frequency(&qspi.handle, freq);
358-
} while (ret == QSPI_STATUS_OK && freq >= QSPI_MIN_FREQUENCY);
359+
}
359360

360361
qspi_free(&qspi.handle);
361362
}

0 commit comments

Comments
 (0)