NRF52840: How to get the actual Nordic API Error that caused the QSPIF SFDP Read Error

I have a custom board with an External NOR based flash, which supports the SFDP feature. Currently when using the QSPIF Block Device API to read and write to the Flash, the Block Device Initialization fails with error below:

QSPIF_BD_ERROR_PARSING_FAILED = -4002, SFDP Parsing failed

However I am trying to figure out the actual Nordic error that is causing this failure and If I add a printf statement in the mbed-os\targets\TARGET_NORDIC\TARGET_NRF5x\qspi_api.c in the sfdp_read method, the actual error is not being printed out, so I was wondering if there is a way to get the actual Nordic API error when the SFDP read fails?

FYI this the external flash we are using on the custom board is Winbond W25Q80DVSNIG

Thanks,
Ajay

Any thoughts mbed-os team?

This may not solve your issue, and isn’t best practice, but I’ve used the following before in a pinch.

If you dig down to the offending file (e.g. nrfx_spim.c/nrfx_spi.c) within the NRF SDK in mbed, and then insert the following near the top of the file:

#ifdef NRFX_LOG_DEBUG
#undef NRFX_LOG_DEBUG
#define NRFX_LOG_DEBUG(...) printf("NRFX_DEBUG: " __VA_ARGS__); printf("\n")
#endif

#ifdef NRFX_LOG_INFO
#undef NRFX_LOG_INFO
#define NRFX_LOG_INFO(...) printf("NRFX_INFO: " __VA_ARGS__); printf("\n")
#endif

#ifdef NRFX_LOG_WARNING
#undef NRFX_LOG_WARNING
#define NRFX_LOG_WARNING(...) printf("NRFX_WARNING: " __VA_ARGS__); printf("\n")
#endif

#ifdef NRFX_LOG_ERROR
#undef NRFX_LOG_ERROR
#define NRFX_LOG_ERROR(...) printf("NRFX_ERROR: " __VA_ARGS__); printf("\n")
#endif

This should allow you to see some of the NRFX log messages that are occurring in the NRF SPI file. The log messages may give you more information about your issue.

Regarding the QSPIF_BD_ERROR_PARSING_FAILED error specifically, I would recommend confirming that the NOR flash that you are using is configured for the correct address length (i.e. 3-byte address or 4-byte address).

@ajayk Hey, Have you fixed this issue, I have same issue , can you share the latest progress. I use custom board is EBYTE_E73