You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ag...@apache.org on 2022/09/26 23:14:05 UTC

[mynewt-core] 01/01: da146x: hal_flash: Fix rdid issue on Gigadevice

This is an automated email from the ASF dual-hosted git repository.

agross pushed a commit to branch flash-autoconfigure-fix
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 1bdae1a68ac5bb16c8fe0005e241640ab912febe
Author: Andy Gross <an...@juul.com>
AuthorDate: Mon Sep 26 18:13:16 2022 -0500

    da146x: hal_flash: Fix rdid issue on Gigadevice
    
    This patch moves the set manual mode and adds a busy status check before
    executing the read rdid qspi command.  On gigadevice flash devices, the read
    rdid would fail intermittently due to the device not being ready for the
    command.
    
    Signed-off-by: Andy Gross <an...@juul.com>
---
 hw/mcu/dialog/da1469x/src/hal_flash.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/mcu/dialog/da1469x/src/hal_flash.c b/hw/mcu/dialog/da1469x/src/hal_flash.c
index 7d5c69832..6004e2594 100644
--- a/hw/mcu/dialog/da1469x/src/hal_flash.c
+++ b/hw/mcu/dialog/da1469x/src/hal_flash.c
@@ -430,6 +430,9 @@ qspi_read_rdid(const struct hal_flash *dev)
     int i;
     uint32_t result;
 
+    da1469x_qspi_mode_manual(dev);
+    da1469x_qspi_wait_busy(dev);
+
     /* Issue a read rdid command (0x9F) and get 24 bit response */
     QSPIC->QSPIC_CTRLBUS_REG = QSPIC_QSPIC_CTRLBUS_REG_QSPIC_EN_CS_Msk;
     da1469x_qspi_write8(dev, 0x9f);
@@ -454,7 +457,6 @@ da1469x_hff_mcu_custom_init(const struct hal_flash *dev)
     uint32_t primask;
 
     __HAL_DISABLE_INTERRUPTS(primask);
-    da1469x_qspi_mode_manual(dev);
 
     /* detect flash device and use correct configuration */
     config = qspi_read_rdid(dev);