Skip to content
bennierex edited this page May 16, 2015 · 9 revisions

Note

I currently only own a Navio RAW, which has a different FRAM chip than the Navio+. The code should be compatible with the FRAM chip on the Navio+, but you cannot use the extra storage offered by that version. I will update this a.s.a.p.

Basic Usage

>>> import navio
>>> nio = navio.Navio()
>>> nio.FRAM_write(0, b'abcdefg')
>>> nio.FRAM_read(0, 7)
b'abcdefg'

>>> # Clear all stored data
>>> nio.FRAM_clear()

>>> # Perform FRAM read/write test
>>> "FRAM test OK!" if nio.FRAM_test() else "FRAM test failed!"
'FRAM test OK!'

Methods and properties

instance method FRAM_read(address, length)

Reads length bytes from FRAM, starting at location address.

Returns: (read-only bytes-like object) Data read from FRAM.
Parameters:

  • address: (int) Memory address to start the read from. Valid addresses range from 0 to 511.
  • length: (int) Number of bytes to read. Maximum 127 bytes can be read at once.

raises ValueError if you try to read more than 127 bytes at once.
raises ValueError if you try to read beyond the FRAM boundary.
raises IOError if there is an error reading the data.

instance method FRAM_write(address, data)

Writes data to FRAM, starting at address address.

Returns: None
Parameters:

  • address: (int) Memory address to start writing at. Valid addresses range from 0 to 511.
  • data: (bytes-like object) Data to write. Maximum 127 bytes can be written at once.

raises ValueError if you try to write more than 127 bytes at once.
raises ValueError if you try to write beyond the FRAM boundary.
raises IOError if there is an error writing to the FRAM.

instance method FRAM_clear()

Clears all data stored in FRAM.

Returns: None

raises IOError if there is an error clearing the FRAM.

instance method FRAM_test()

Tests FRAM read/write operations.
This tries to write some data to a random memory location and then read back the same data. It restores the original data at that location when finished. If the test fails, the data at the test location might be partially or fully overwritten by the test-data, so be sure to check all stored data if this happens.

Returns: (int) 1 on succes, 0 on failure.

Clone this wiki locally