Advertise here

Adafruit I2C FRAM MB85RC256VPF and SAMD21 Xplained pro board




FRAM is a data storage method ferroelectric layer instead of a dielectric layer. This gives it stable handling (the bytes you write are non-volatile) with dynamic responsiveness (you can write them very fast!)Each byte can be read/written billions of time not like EEPROM.




In this quick tutorial you will see how to connect I2C FRAM breakout from adafruit with SAMD21 Xplained pro board .


connection : 
SAM >>> FRAM

PA08 >>> SDA
PA09 >>> SCL
VCC"3.3V >>VCC
GND >>>GND





the code based on adafruit FRAM library and it's very easy to use , I re-write it without a library using atmel start and ASF4 , with I2C Master synchronous mode.


code functions : 


void FRAM_Begin(uint8_t address)


will enable the I2C bus and set the FRAM address in default it's 0x50


void getDeviceID(uint16_t *manufacturerID, uint16_t *productID)


to check the Manufacture ID and Product ID



void FRAM_write (uint16_t framAddr, uint8_t value);


write a value to a specific address where:

framAddr : address (0-32767)

value : value to write (0-255)


uint8_t FRAM_read (uint16_t framAddr); 

return a value from a specific address where:

framAddr : address (0-32767)


Basic code : I2C standard Mode


in This code I used I2C scl = 100KHz "standard mode"


open the terminal window and set the baud rate to 115200 and will see the value on the window.






Basic code : I2C fast Mode + 



if you are looking to a faster CLK rate you can use this mode (up to 1MHz)


in this example I used CLK=500KHz




the same code but the configurations are different .


and finally I used a logic analyzer to see the I2C bus signals and check if my code works well.





No comments

Powered by Blogger.