TS-7180 FRAM: Difference between revisions

From embeddedTS Manuals
(Created page with "== FRAM == The TS-7180 has an optional 16Kbit ferroelectric random access memory (FRAM) organized as 2KB. It is accessible via the SPI bus.")
 
No edit summary
Line 1: Line 1:
== FRAM ==
The TS-7180 has an optional 16Kbit ferroelectric random access memory (FRAM) organized as 2KB.  It is accessible via the SPI bus.
 
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-line.  Some examples of using this program follow.
 
<source lang=bash>
 
# 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"


The TS-7180 has an optional 16Kbit ferroelectric random access memory (FRAM) organized as 2KB. It is accessible via the SPI bus.
# 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>

Revision as of 11:39, 4 July 2017

The TS-7180 has an optional 16Kbit ferroelectric random access memory (FRAM) organized as 2KB. It is accessible via the SPI bus.

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

There is some sample code in the linux kernel Documentation folder that may be used for accessing SPI slaves from the command-line. Some examples of using this program follow.

# 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