You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm configuring the rpipicow board for boot2_w25q080_4_padded_checksum (I first noticed my issue at slower flash speed, and sure enough, this is showing it more reliably). I'm also set to 133MHz now - so things should all be pretty standard.
#include"hardware/structs/xip_ctrl.h"
#include"hardware/flash.h"staticuint32_t boot2_copyout[64];
staticvoid__no_inline_not_in_flash_func(flash_enable_xip_via_boot2)(void) {
((void (*)(void))((intptr_t)boot2_copyout+1))();
}
void__no_inline_not_in_flash_func(setup) () {
rom_connect_internal_flash_fn connect_internal_flash_func = (rom_connect_internal_flash_fn)rom_func_lookup_inline(ROM_FUNC_CONNECT_INTERNAL_FLASH);
rom_flash_exit_xip_fn flash_exit_xip_func = (rom_flash_exit_xip_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_EXIT_XIP);
rom_flash_flush_cache_fn flash_flush_cache_func = (rom_flash_flush_cache_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_FLUSH_CACHE);
memcpy (boot2_copyout, (void *)XIP_BASE, sizeof (boot2_copyout));
__compiler_memory_barrier();
while (1) {
connect_internal_flash_func();
flash_exit_xip_func();
flash_flush_cache_func(); // Note this is needed to remove CSn IO force as well as cache flushingflash_enable_xip_via_boot2();
/* xip_ctrl_hw->flush = 1; while (!(xip_ctrl_hw->stat & XIP_STAT_FLUSH_READY_BITS)) tight_loop_contents();*//* int i = 0; while (i < 256) { *(volatile uint32_t *)(XIP_BASE + i) = 0; i += sizeof(uint32_t); }*/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) () {
}
I'm just looping through the steps of the Pico SDK for the flash functions here, and the LED stops blinking after a while.
The real project I noticed this in actually gets a bunch of 0x00's when reading XIP memory, when the issue occurs.
I can remove all the SDK ROM calls and just do the "->flush = 1;" code and get the same result. When I use the special method to invalidate cache by writing to it, it works fine, but of course I'd have to modify the SDK not to do its cache clear (and so "CSn IO force" would need its own code - whatever that is - so not going to happen).
I know why the LED stops blinking, but I don't know why XIP starts reading as 0x00's when using the SDK flash functions. Can anyone else replicate this? And are the any ideas on why it's happening?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
RE: #raspberrypi/pico-sdk#1984
I'm configuring the rpipicow board for boot2_w25q080_4_padded_checksum (I first noticed my issue at slower flash speed, and sure enough, this is showing it more reliably). I'm also set to 133MHz now - so things should all be pretty standard.
I'm just looping through the steps of the Pico SDK for the flash functions here, and the LED stops blinking after a while.
The real project I noticed this in actually gets a bunch of 0x00's when reading XIP memory, when the issue occurs.
I can remove all the SDK ROM calls and just do the "->flush = 1;" code and get the same result. When I use the special method to invalidate cache by writing to it, it works fine, but of course I'd have to modify the SDK not to do its cache clear (and so "CSn IO force" would need its own code - whatever that is - so not going to happen).
I know why the LED stops blinking, but I don't know why XIP starts reading as 0x00's when using the SDK flash functions. Can anyone else replicate this? And are the any ideas on why it's happening?
Beta Was this translation helpful? Give feedback.
All reactions