Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erase exit with error #25

Open
creatron opened this issue Mar 25, 2023 · 0 comments
Open

Erase exit with error #25

creatron opened this issue Mar 25, 2023 · 0 comments

Comments

@creatron
Copy link

uint8_t erase_flash (void), exit with a timeout, but the program still manages to program the chip.

The erase_flash return status is ignored, thus the error is 'not visible.

I changed the function to log the error on the serial terminal. I always get timeout 2, even if the timeout is 1 sec.

/** ---------------------------------------------------------------------------

  • @brief erase_flash

  • @return uint8_t
    */
    uint8_t erase_flash (void)
    {
    gprintf ("\r\n Erasing flash.. please wait ..");
    write_register(0x4001e504, 2);

    long timeout = millis();
    while (read_register(0x4001e400) != 1)
    {
    if (millis()-timeout > TIMEOUT)
    {
    gprintf ( "\r\n Erasing timeout 1 ..");
    return 1;
    }
    }

    write_register(0x4001e50c, 1);

    timeout = millis();
    while (read_register(0x4001e400) != 1)
    {
    if(millis()-timeout > TIMEOUT)
    {
    gprintf ( "\r\n Erasing timeout 2...");
    return 1;
    }
    }
    write_register(0x4001e504, 0);
    timeout = millis();
    while (read_register(0x4001e400) != 1)
    {
    if(millis()-timeout > TIMEOUT)
    {
    gprintf ("\r\n Erasing timeout 3...");
    return 1;
    }
    }
    gprintf ( "\r\n Erasing done ..");
    return 0;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant