julianoes commented on code in PR #18771:
URL: https://github.com/apache/nuttx/pull/18771#discussion_r3121434067
##########
drivers/mtd/w25n.c:
##########
@@ -697,12 +1088,37 @@ static ssize_t w25n_bwrite(FAR struct mtd_dev_s *dev,
off_t startblock,
for (i = 0; i < nblocks; i++)
{
uint32_t page = startblock + i;
+ int attempt;
- /* Write Enable must be set before Program Load */
+ for (attempt = 0; attempt < 2; attempt++)
+ {
+ /* Write Enable must be set before each Program Load. */
+
+ w25n_writeenable(priv);
+ w25n_load_buffer(priv, 0, buf + (i * W25N_PAGE_SIZE),
+ W25N_PAGE_SIZE);
+ ret = w25n_program_execute(priv, page);
+ if (ret == OK || ret != -EIO)
+ {
+ break;
+ }
+
+ /* Program failed (P-FAIL). Remap the underlying block and retry;
+ * the chip will route the next program to the spare PBA. The
+ * data buffer is reloaded above on the retry pass.
+ */
+
+ syslog(LOG_WARNING,
Review Comment:
This would be an important warning. Do we only show those in debug mode?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]