Static RAM 256 kilo bytes using SPI single IO Serial SRAM ISSIS2568FBLL Nucleo F767ZI

Dependencies:   S2568FBLL

main.cpp

Committer:
shivanandgowdakr
Date:
2018-05-22
Revision:
0:93e3f35567a5

File content as of revision 0:93e3f35567a5:


// SPI Single IO NOR sram Library for Nucleo F767ZI Interfacing



#include "mbed.h"
#include "S2568FBLL.h"
#include <string>

Serial pc(USBTX, USBRX); // tx, rx

int main()
{
    S2568FBLL sram(PA_7, PA_6, PA_5, PA_4,PA_3);
    pc.printf("SPI init done\r\n\r\n");

    // Read Identification information Related to chip.

    
    // Reading sram Memory Status Register1 contents.

    uint8_t MODE_REGISTER= sram.readRegister();
    pc.printf(" MODE REGISTER CONTENTS:%X\r\n\r\n",MODE_REGISTER);

    wait(1);

    

    
   

// write a stream of characters to arbitrary address 0x168
    char stri[] = "Shivanand Gowda Ramaiah";

    pc.printf("Writing String Here: %s\r\n",stri);


    sram.writeStream(0x00, stri, 22); //Writing Strings in three Differnt addresses.
    sram.writeStream(22, stri, 22);
    sram.writeStream(44, stri, 22);
    

    char str2[22] = {0};
    char str3[22] = {0};
    char str4[22] = {0};
    
    pc.printf("Before String Here: %s\r\n",str2);
    sram.readStream(0x00, str2, 22);
    pc.printf("After Read 1 String Here: %s\r\n",str2);
    sram.readStream(22, str4, 22);
    pc.printf("After Read 2 String Here: %s\r\n",str2);
    sram.readStream(44, str3, 22);
    pc.printf("After Read 3 String Here: %s\r\n",str2);  

    pc.printf("Exited from program  \r\n");
    return 0;

}