From dea3ec71b617841fb43c17e09308c37ab7030a55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Tue, 23 Apr 2019 16:25:29 +0200 Subject: [PATCH] [ion/external_flash] Fix JEDECid command --- ion/src/device/shared/drivers/external_flash.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ion/src/device/shared/drivers/external_flash.cpp b/ion/src/device/shared/drivers/external_flash.cpp index c84c8b5a3..539510e43 100644 --- a/ion/src/device/shared/drivers/external_flash.cpp +++ b/ion/src/device/shared/drivers/external_flash.cpp @@ -425,10 +425,16 @@ void WriteMemory(uint8_t * destination, const uint8_t * source, size_t length) { void JDECid(uint8_t * manufacturerID, uint8_t * memoryType, uint8_t * capacityType) { unset_memory_mapped_mode(); - send_command(Command::ReadJEDECID); - *manufacturerID = QUADSPI.DR()->get(); - *memoryType = QUADSPI.DR()->get(); - *capacityType = QUADSPI.DR()->get(); + struct JEDECId { + uint8_t manufacturerID; + uint8_t memoryType; + uint8_t capacityType; + }; + JEDECId id; + send_read_command(Command::ReadJEDECID, reinterpret_cast(FlashAddressSpaceSize), reinterpret_cast(&id), sizeof(id)); + *manufacturerID = id.manufacturerID; + *memoryType = id.memoryType; + *capacityType = id.capacityType; set_as_memory_mapped(); }