Skip to content

Commit

Permalink
Initial development
Browse files Browse the repository at this point in the history
  • Loading branch information
SV-Zanshin committed Sep 3, 2017
1 parent a02d50a commit eab7f97
Show file tree
Hide file tree
Showing 9 changed files with 234 additions and 89 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ ehthumbs.db
# Folder config file
Desktop.ini

# Work in progress folder
WorkInProgress/
# Recycle Bin used on file shares
$RECYCLE.BIN/

Expand Down Expand Up @@ -47,10 +45,11 @@ $RECYCLE.BIN/
Network Trash Folder
Temporary Items
.apdisk

# Files and directories from the Atmel Studio Arduino IDE
.vs
__vm
Debug
*.atsln
*.componentinfo.xml
*.cppproj
*.cppproj
78 changes: 72 additions & 6 deletions Examples/ReadWrite/ReadWrite.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
/*******************************************************************************************************************
** Example program for reading and writing to the Fujitsu SRAM memory **
** Example program for reading and writing to one or more Fujitsu SRAM memory devices on the I2C microLAN. FRAM **
** memory is static RAM which offers many Read/Write cycles and the description of the MB85 family is found at **
** http://www.fujitsu.com/global/products/devices/semiconductor/memory/fram/ and the corresponding datasheets are **
** at http://www.fujitsu.com/global/products/devices/semiconductor/memory/fram/lineup/#standard **
** Adafruit has two of these memories available on breakout boards, https://www.adafruit.com/product/1897 and **
** https://www.adafruit.com/product/1897 (this one is SPI, but the chip is also available as I2C **
** **
** The program makes use of the https://github.com/SV-Zanshin/MB85_FRAM library, the most recent version of which **
** can be downloaded at https://github.com/SV-Zanshin/MB85_FRAM/archive/master.zip **
** **
** The following memories in the MB85 are detected and supported: **
** **
** MB85RC512T 512Kbit ( 64K x 8bit) ManufacturerID 0x00A, Product ID = 0x658 (Density = 0x6) **
** MB85RC256V 256Kbit ( 32K x 8bit) ManufacturerID 0x00A, Product ID = 0x510 (Density = 0x5) **
** MB85RC128A 128Kbit ( 16K x 8bit) No ManufacturerID/productID or Density values **
** MB85RC64TA 64Kbit ( 8K x 8bit) No ManufacturerID/productID or Density values **
** MB85RC64A 64Kbit ( 8K x 8bit) No ManufacturerID/productID or Density values **
** MB85RC64V 64Kbit ( 8K x 8bit) No ManufacturerID/productID or Density values **
** - unsupported memories -- **
** MB85RC1MT 1Mbit (128K x 8bit) ManufacturerID 0x00A, Product ID = 0x758 (Density = 0x7) (unsupported) **
** MB85RC16 16Kbit ( 2K x 8bit) No ManufacturerID/productID or Density values 1 Address byte (unsupported) **
** MB85RC16V 16Kbit ( 2K x 8bit) No ManufacturerID/productID or Density values 1 Address byte (unsupported) **
** MB85RC04V 4Kbit ( 512 x 8bit) No ManufacturerID/productID or Density values 1 Address byte (unsupported) **
** **
** What sets this library apart is that it will autmatically detect up to 8 memories, in any combination of those **
** listed as supported above, and treats them as one contiguous block of memory. The read() and write() functions **
** also support structures and arrays. **
** **
** This program is free software: you can redistribute it and/or modify it under the terms of the GNU General **
** Public License as published by the Free Software Foundation, either version 3 of the License, or (at your **
Expand Down Expand Up @@ -27,14 +53,54 @@ MB85_FRAM_Class FRAM; //
** and then control goes to the main loop, which loop indefinately. **
*******************************************************************************************************************/
void setup() { // Arduino standard setup method //
uint32_t i; // Declare loop and work variables //
uint8_t memByte; // //
Serial.begin(SERIAL_SPEED); // Start serial port at Baud rate //
#ifdef __AVR_ATmega32U4__ // If this is a 32U4 processor, then//
delay(3000); // wait 3 seconds for the serial //
while(!Serial); // Wait for serial to initialize //
delay(1000); // Then wait one more second //
#endif // interface to initialize //
Serial.println(F("Starting FRAM example program")); // //
FRAM.begin();

//==================================//
Serial.println("Starting FRAM example program"); // //
uint8_t chips = FRAM.begin(); // Return number of memories found //
Serial.print("Detected "); // //
Serial.print(chips); // //
Serial.print(" MB85xxx memories.\nTotal storage "); // //
Serial.print(FRAM.totalBytes()); // //
Serial.println(" bytes."); // //
// //
Serial.println("\nWriting numbers to first 256 bytes of memory."); // //
for(uint32_t i=0;i<256;i++) { // //
FRAM.write(i,(uint8_t)i); // //
} // of for-next loop // //
// //
Serial.println("Reading data from address 100 onwards."); // //
for(uint32_t i=100;i<111;i++) { // //
Serial.print(i); // //
Serial.print(" = "); // //
FRAM.read(i,memByte); // //
Serial.println(memByte); // //
} // of for-next loop // //
// //
Serial.println("Writing array to memory."); // //
char testArray[13] = "Hello World!"; // //
FRAM.write(200,testArray); // //
FRAM.read(200,testArray); // //
Serial.print("Read string array as \""); // //
Serial.print(testArray); // //
Serial.println("\"."); // //
// //
if (chips>1) { // Demonstrate overlapping memories //
Serial.println("\nMultiple memories found, demonstrating overlapping."); // //
Serial.println("Assuming first memory is a 32Kb memory."); // //
uint32_t memAddress = 32768; // Change here if chip is different //
FRAM.write(memAddress-6,testArray); // Split test across 2 chips //
Serial.println("Splitting text write across 2 memory chips."); // //
Serial.print("Reading from memory chip 2 gives text \""); // //
FRAM.read(memAddress,testArray); // Read array from 2nd memory //
Serial.print(testArray); // //
Serial.println("\"."); // //
} // of if-then-else we have more than one memory // //
Serial.println("\n\nFinished."); // //
} // of method setup() // //
/*******************************************************************************************************************
** This is the main program for the Arduino IDE, it is an infinite loop and keeps on repeating. **
Expand Down
Binary file added Fritzing/MB85_FRAM.fzz
Binary file not shown.
Binary file added Images/MB85Breakout.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/MB85_FRAM_bb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit eab7f97

Please sign in to comment.