Skip to content

Issues with flash writes when VGA PIO output is running (Pico stock speed: 125MHz) #1984

@XZCE

Description

@XZCE

I'm seeing this in someone else's project (a proper SDK one, but I usually use the Arduino-Pico environment as shown here)...

#include "hardware/structs/xip_ctrl.h"

static uint32_t boot2_copyout[64];

void __no_inline_not_in_flash_func(setup) () {
    memcpy (boot2_copyout, (void *)XIP_BASE, sizeof (boot2_copyout));
    while (1) {
        xip_ctrl_hw->flush = 1;
        while (!(xip_ctrl_hw->stat & XIP_STAT_FLUSH_READY_BITS))
          tight_loop_contents();

        if (memcmp ((void *)XIP_BASE, boot2_copyout, sizeof (boot2_copyout)) != 0)
            break; // Something's wrong!

        digitalWrite (LED_BUILTIN, HIGH);
        delay (100);
        digitalWrite (LED_BUILTIN, LOW);
        delay (100);
    }
}

void __no_inline_not_in_flash_func(loop) () {
}

Back to the real project: I've created a flash memory update routine, and I'm flushing the cache to verify a write, but sometimes it fails to read back any written data - this sketch has the least code which shows what's failing.

Eventually, the memory compare doesn't get back what's in the flash memory chip and the LED stops flashing.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions