1929 views|3 replies

1w

Posts

25

Resources
The OP
 

[SAMR21 new gameplay] 31. Using NVM storage [Copy link]

 
This post was last edited by dcexpert on 2019-10-17 10:55

In SAMR21, part of the flash space can be used to simulate EEPROM, which is called NVM (Non-Volatile Memory). Using EEPROM is simpler than flash, and bytes can be read and written directly without the need for page management like flash.

In the current version of CircuitPython, 256 bytes are allocated as NVM. The use of NVM is very simple. You only need to reference nvm through the microcontroller module. As shown below:

>>> import microcontroller
>>> from microcontroller import nvm
>>> nvm
<ByteArray>
>>> len(nvm)
256
>>> nvm[0]
255
>>> nvm[0]=5
>>> 


nvm is a bytearray array with a size of 256 bytes, which can be read and written byte by byte. The default data is 255 (0xFF). After writing data, the NVM content of the chip will be automatically modified and will not be lost after power failure. This content is originally created by dcexpert

, a user of EEWORLD forum. If you need to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source

Latest reply

I thought it was nvme from the title   Details Published on 2019-10-17 20:33
 
 

1w

Posts

25

Resources
2
 

In circuitpython, the NVM size set for different chips is also different. Because the flash of SAMR21/D21 is small, only 256KB, only 256 bytes of NVM are set. On the 512KB SAMD51, the NVM size is 8192.

 
 
 

6423

Posts

17

Resources
3
 

I thought it was nvme from the title

Personal signaturetraining
 
 
 

1w

Posts

25

Resources
4
 
Bai Ding posted on 2019-10-17 20:33 I thought it was nvme from the title

 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

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