TS-7180 FRAM: Difference between revisions
From embeddedTS Manuals
mNo edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
The TS-7180 has | The TS-7180 has 4Kbit ferroelectric random access memory (FRAM) organized as 512B. 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". | The FRAM may be accessed from userspace using the linux kernel's spidev device. It will appear as "/dev/spidev2.2". | ||
Line 8: | Line 8: | ||
# Read from address 0x0000 | # Read from address 0x0000 | ||
./spidev_test -D /dev/spidev2.2 -p "\x03 | ./spidev_test -D /dev/spidev2.2 -p "\x03\x00\x00" | ||
RX | 00 00 00 | RX | 00 00 00 | ||
# Set the FRAM_WP# line high | |||
tshwctl -a 5 -w 3 | |||
# Enable writes | # Enable writes | ||
Line 19: | Line 22: | ||
# Write to address 0x0000 | # Write to address 0x0000 | ||
./spidev_test -D /dev/spidev2.2 -p "\x02 | ./spidev_test -D /dev/spidev2.2 -p "\x02\x00\x12" | ||
# Read back to verify | # Read back to verify | ||
./spidev_test -D /dev/spidev2.2 -p "\x03 | ./spidev_test -D /dev/spidev2.2 -p "\x03\x00\x00" | ||
RX | | RX | 00 00 12 | ||
# Disable writes | |||
./spidev_test -D /dev/spidev2.2 -p "\x04" | |||
</source> | </source> |
Revision as of 17:09, 4 July 2017
The TS-7180 has 4Kbit ferroelectric random access memory (FRAM) organized as 512B. 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"
RX | 00 00 00
# Set the FRAM_WP# line high
tshwctl -a 5 -w 3
# 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\x12"
# Read back to verify
./spidev_test -D /dev/spidev2.2 -p "\x03\x00\x00"
RX | 00 00 12
# Disable writes
./spidev_test -D /dev/spidev2.2 -p "\x04"