Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5342

General • Re: Reading and writing flash (W25Q128JVS)

$
0
0
I appreciate you taking the time to reply.

1. Sure, I can switch it to hex if that'll help somebody else.
2. The code is already about as simple as can be (~3 or 4 consequential lines, a handful of debugging statements).
3. I've started to do that which confuses me even more. E.g. starting at 1024*1024*2 (2MB) where my flash code is <1MB, I'm seeing non-zero non-0xFF values. Probably remnants from old programs that didn't get erased.

But I guess if you or nobody sees a specific problem, then my questions are more fundamental:

1. Is this an appropriate way to get the last sector address? #define FLASH_LAST_SECTOR (PICO_FLASH_SIZE_BYTES - FLASH_SECTOR_SIZE)

2. When reading it back, is adding XIP_BASE sufficient when working with this larger flash (W25Q128JVS) ?

3. Is my assumption correct that the erased memory should be 0xFF?

4. If 1&2&3 are "yes" then why does my code and output above defy that logic?

In summary:

Code:

flash_range_erase((PICO_FLASH_SIZE_BYTES - FLASH_SECTOR_SIZE), FLASH_SECTOR_SIZE);flash_range_program((PICO_FLASH_SIZE_BYTES - FLASH_SECTOR_SIZE), (uint8_t *)buffer, FLASH_PAGE_SIZE);// *(uint8_t *)(XIP_BASE + PICO_FLASH_SIZE_BYTES - FLASH_SECTOR_SIZE) DOES NOT EQUAL buffer[0]

Statistics: Posted by mstrat — Tue Aug 13, 2024 6:13 pm



Viewing all articles
Browse latest Browse all 5342

Trending Articles