I have a flash 6 click from MIKROE
Which comes with a W25Q128JV SPI memory: https://download.mikroe.com/documents/datasheets/w25q128jv.pdf
This is my first time using SPI, and after reading a lot of source codes, I think I have a good grasp of it how it works:
Hardware connection:
Arduino 3.3V -> 3.3V on Flash 6 Click.
Arduino GND -> GND on Flash 6 Click.
Arduino Pin 50 -> SDI on Flash 6 Click.
Arduino Pin 51 -> SDO on Flash 6 Click.
Arduino Pin 52 -> CLK on Flash 6 Click.
Arduino Pin 53 -> CS on Flash 6 Click.
Could someone point me in the right direction?
#include <SPI.h>
#define WRITE 0x02
#define READ 0x03
#define WREN 0x06
#define MANID 0x90
unsigned int data;
unsigned int address = 0;
byte invalue;
void setup()
{
Serial.begin(9600);
Serial.println("--------------");
Serial.println(SS); // chip select
Serial.println(MOSI); // master out, slave in
Serial.println(MISO); // master in, slave out
Serial.println(SCK); // clock
Serial.println("--------------");
// set up to match device datasheet
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE0);
SPI.setClockDivider(SPI_CLOCK_DIV2);
SPI.begin(); // sets up pin modes etc.
// Enable writing
digitalWrite(SS, LOW);
SPI.transfer(WREN);
digitalWrite(SS, HIGH);
delay(1000);
// Read One Value from One Address
digitalWrite(SS, LOW);
SPI.transfer(MANID); // read instruction
SPI.transfer((address >> 16) & 255); // send MSByte address first
SPI.transfer((address >> 8) & 255);
SPI.transfer(address & 255);// send LSByte address second
invalue = SPI.transfer(0); // read the manufacturer ID
digitalWrite(SS, HIGH);
Serial.print("Read Data = ");
Serial.println(invalue, DEC); // print the ID
}
void loop()
{
}