3117 views|6 replies

1305

Posts

0

Resources
The OP
 

How to detect and confirm the actual size of the RP2040 onboard SPI FlashRAM? [Copy link]

We know that the RP2040 onboard SPI FlashRAM supports up to 16MByte (128Mbit). So, how can we know the real size of a RP2040 onboard SPI FlashRAM?

1. The device model is erased and cannot be seen directly.

2. I don’t want to solder the SPI FlashRAM off the board and read it with a programmer.

3. I tried to insert the USB drive into the PC, write a file larger than 18MByte in the form of a USB flash drive, close the folder and reopen it (without plugging in or unplugging the RP2040 board), and the file larger than 18MByte is readable normally. But if I eject the USB drive and then reinsert it into the PC and enter the USB flash drive form, the file disappears. I guess it is not actually written into the USB flash drive, but stored in the cache. So this method of detecting the actual size of the RP2040 onboard SPI FlashRAM does not work.

I'd like to see if anyone has a good way to easily check the actual size of the RP2040 onboard SPI FlashRAM.

This post is from Mobile and portable

Latest reply

It is indeed a parameter set at compile time, and then can be read in a certain way. Micropython generally does not directly read the physical address space, but directly creates, writes, and reads files through files, which is much simpler than sectors. However, you need to be particularly careful when writing files, because the flash write speed is relatively slow. If there is a large amount of writing, it is easy to conflict with other functions and cause some problems.   Details Published on 2023-1-2 10:45
 
 

1w

Posts

25

Resources
2
 

If you are using the UF2 bootloader, writing a file is actually updating the program. If the file format is incorrect, it will not be updated. The file you read is actually cached by the computer.

If you use MicroPython, you can check the size of Flash and RAM by the following method (this method is universal and supported by most MicroPython versions, but please note that the system will occupy some space, so the actual value is smaller than the actual physical size):

First enter REPL and enter the following command:

flash

import os

d = os.statvfs('/flash')

# File size

d[0]*d[2]

# Remaining space size

d[0]*d[3]

ram

import gc

gc.mem_free()+gc.mem_alloc()

This post is from Mobile and portable

Comments

Is the size obtained by d[0]*d[3] the actual size of the SPI Flash or the size configured in the code?  Details Published on 2023-1-1 22:28
Is the size obtained by d[0]*d[3] the actual size of the SPI Flash or the size configured in the code?  Details Published on 2023-1-1 20:56
 
 
 

1305

Posts

0

Resources
3
 

Thank you! What is the unit of d[0]*d[3]? Byte?

This post is from Mobile and portable
 
 
 

1305

Posts

0

Resources
4
 

In addition, is this checking the size of the onboard SPI Flash?

This post is from Mobile and portable
 
 
 

1305

Posts

0

Resources
5
 
dcexpert posted on 2023-1-1 14:13 If it is under UF2 bootloader, writing a file is actually updating the program. If the file format is incorrect, it will not be updated. The file you read is actually calculating...

Is the size obtained by d[0]*d[3] the actual size of the SPI Flash or the size configured in the code?

This post is from Mobile and portable
 
 
 

1305

Posts

0

Resources
6
 
dcexpert posted on 2023-1-1 14:13 If it is under UF2 bootloader, writing a file is actually updating the program. If the file format is incorrect, it will not be updated. The file you read is actually calculating...

I think this size is the size of the SPI Flash selected when the code is compiled into the firmware. It is not the actual size of the SPI Flash.

So the question is: in the MicroPython world, how does it manage the SPI Flash space? Can I read and write the space at a specified physical address?

This post is from Mobile and portable

Comments

It is indeed a parameter set during compilation, and then it can be read in a certain way. Micropython generally does not directly read the physical address space, but directly creates, writes, and reads files through files, which is much simpler than sectors. However, you need to be particularly careful when writing files, because fla  Details Published on 2023-1-2 10:45
 
 
 

1w

Posts

25

Resources
7
 

It is indeed a parameter set at compile time, and then can be read in a certain way.

Micropython generally does not directly read the physical address space, but directly creates, writes, and reads files through files, which is much simpler than sectors. However, you need to be particularly careful when writing files, because the flash write speed is relatively slow. If there is a large amount of writing, it is easy to conflict with other functions and cause some problems.

This post is from Mobile and portable
 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list