TS-7180 FRAM: Difference between revisions

From embeddedTS Manuals
No edit summary
(Migrate to the transcluded FM25L16B page to reduce copies of the same text. The FM25L16B was updated to be more compatible with both platforms where its always included, and platforms where its optional.)
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The TS-7180 has an optional 16Kbit ferroelectric random access memory (FRAM) organized as 2KB.  It is accessible via the SPI bus.
{{:FM25L16B_FRAM}}


The FRAM may be accessed from userspace using the linux kernel's spidev device.  It will appear as "/dev/spidev2.2".


There is some [https://github.com/torvalds/linux/blob/master/tools/spi/spidev_test.c sample code] in the linux kernel Documentation folder that may be used for accessing SPI slaves from the command-lineSome examples of using this program follow.
The FRAM can be accessed as a flat file from Linux:
<syntaxhighlight lang=bash>
# xxd -a /sys/class/spi_master/spi2/spi2.2/eeprom | head
00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
000007f0: 0000 0000 0000 0000 0000 0000 0000 0030 ...............0
</syntaxhighlight>


<source lang=bash>
If U-Boot's [http://www.denx.de/wiki/view/DULG/UBootBootCountLimit bootcount tracking] environment variable is enabled, the last byte of FRAM is reserved for storing the boot count, and care should be taken to not overwrite it inadvertently. In U-Boot, the boot count can be accessed with the <code>fram</code> command.
 
# Read from address 0x0000
./spidev_test -D /dev/spidev2.2 -p "\x03\x00\x00\x00\x00"
 
# Enable writes
./spidev_test -D /dev/spidev2.2 -p "\x06"
 
# Read the status register to verify that bit #1 is now set
./spidev_test -D /dev/spidev2.2 -p "\x05\x00"
RX | 00 02
 
# Write to address 0x0000
./spidev_test -D /dev/spidev2.2 -p "\x02\x00\x00\x12\x34"
 
# Read back to verify
./spidev_test -D /dev/spidev2.2 -p "\x03\x00\x00\x00\x00"
RX | 00 00 00 12 34
 
</source>

Latest revision as of 15:27, 12 June 2023

This platform supports a soldered-down, non-volatile Ferroelectric RAM (FRAM) device. The Cypress FM25L16B is a 2 KiB FRAM device in a configuration not unlike an SPI EEPROM. The nature of FRAM means it is non-volatile, incredibly fast to write, and is specified with 100 trillion read/write cycles (per each of the 256 sequential 8 byte rows) with a 150 year data retention at temperatures below 65 °C. The device is connected to Linux and presents itself as a flat file that can be read and written like any standard Linux file.


The FRAM can be accessed as a flat file from Linux:

# xxd -a /sys/class/spi_master/spi2/spi2.2/eeprom | head
00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
000007f0: 0000 0000 0000 0000 0000 0000 0000 0030  ...............0

If U-Boot's bootcount tracking environment variable is enabled, the last byte of FRAM is reserved for storing the boot count, and care should be taken to not overwrite it inadvertently. In U-Boot, the boot count can be accessed with the fram command.