From f8f2ea1763d1494c0f51fe941e4ee324eeb0a572 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 4 Jun 2016 08:28:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9567 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/STM32L4xx/QSPI-N25Q128/main.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'testhal/STM32') diff --git a/testhal/STM32/STM32L4xx/QSPI-N25Q128/main.c b/testhal/STM32/STM32L4xx/QSPI-N25Q128/main.c index 08e82a9ea..ffac546d2 100644 --- a/testhal/STM32/STM32L4xx/QSPI-N25Q128/main.c +++ b/testhal/STM32/STM32L4xx/QSPI-N25Q128/main.c @@ -14,6 +14,8 @@ limitations under the License. */ +#include + #include "ch.h" #include "hal.h" @@ -107,6 +109,11 @@ int main(void) { m25qObjectInit(&m25q); m25qStart(&m25q, &m25qcfg1); + /* Reading.*/ + err = flashRead(&m25q, 0, buffer, 128); + if (err != FLASH_NO_ERROR) + chSysHalt("read error"); + /* Erasing the first sector and waiting for completion.*/ (void) flashStartEraseSector(&m25q, 0); err = flashWaitErase((BaseFlash *)&m25q); @@ -135,6 +142,13 @@ int main(void) { m25qMemoryUnmap(&m25q); /* Reading it back.*/ + memset(buffer, 0, 128); + err = flashRead(&m25q, 16, buffer, 128); + if (err != FLASH_NO_ERROR) + chSysHalt("read error"); + + /* Reading it back.*/ + memset(buffer, 0, 128); err = flashRead(&m25q, 0, buffer, 128); if (err != FLASH_NO_ERROR) chSysHalt("read error"); -- cgit v1.2.3