aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F3xx/SPI-N25Q128
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-05-11 11:29:20 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-05-11 11:29:20 +0000
commite6864865cc672b314ee987f1bf4fd3e793ffd0f6 (patch)
treed3462d8fff8da1be444994ee85679e8d2c148269 /testhal/STM32/STM32F3xx/SPI-N25Q128
parentc3d1d75f50ecfe9ae36f58de67d2baf57be1be39 (diff)
downloadChibiOS-e6864865cc672b314ee987f1bf4fd3e793ffd0f6.tar.gz
ChibiOS-e6864865cc672b314ee987f1bf4fd3e793ffd0f6.tar.bz2
ChibiOS-e6864865cc672b314ee987f1bf4fd3e793ffd0f6.zip
Flash demo updated.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9465 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32/STM32F3xx/SPI-N25Q128')
-rw-r--r--testhal/STM32/STM32F3xx/SPI-N25Q128/main.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/testhal/STM32/STM32F3xx/SPI-N25Q128/main.c b/testhal/STM32/STM32F3xx/SPI-N25Q128/main.c
index 021939419..ef9a06a41 100644
--- a/testhal/STM32/STM32F3xx/SPI-N25Q128/main.c
+++ b/testhal/STM32/STM32F3xx/SPI-N25Q128/main.c
@@ -119,22 +119,28 @@ int main(void) {
*/
n25q128ReadId(&flash, buffer, 17);
- /*
- * Writing then reading a pattern on a single page with final erase and
- * verify.
- */
+ /* Programming a pattern.*/
err = flashProgram(&flash, 0, pattern, 128);
if (err != FLASH_NO_ERROR)
chSysHalt("program error");
+
+ /* Reading it back.*/
err = flashRead(&flash, 0, buffer, 128);
if (err != FLASH_NO_ERROR)
chSysHalt("read error");
- err = flashStartEraseSector(&flash, 0);
+
+ /* Erasing the containing sector and waiting for completion.*/
+ (void) flashStartEraseSector(&flash, 0);
+ err = flashWaitErase((BaseFlash *)&flash);
if (err != FLASH_NO_ERROR)
chSysHalt("erase error");
+
+ /* Verifying the erase operation.*/
err = flashVerifyErase(&flash, 0);
if (err != FLASH_NO_ERROR)
chSysHalt("verify erase error");
+
+ /* Reading back for confirmation.*/
err = flashRead(&flash, 0, buffer, 128);
if (err != FLASH_NO_ERROR)
chSysHalt("read error");