SST26VF064B Flash Memory interface with SPI1/SSP – Write to memory Issue

Thread Starter

RItuv

Joined Jun 18, 2019
1
Hii All,

I have interfaced SST26VF064B Flash Memory with SPI1/SSP of LPC2138 ARM microcontroller.

Issue- I am facing an issue to choose Serial clock Rate selection to operate SPI1.

After APB divider I am using 15 MHz for peripheral.

Configuration- I have interfaced SPI1/SSP MOSI (Pin54), MISO (Pin53), SSEL (Pin55), SCK (pin47) lines with memory pins through 10k Pullup resistor. this is single master and single Slave . I want to make transmission in master mode and SPI mode And initialized SPI1 the below:-

I have defined SSEL as #defined SS 00100000 // p0.20


PINSEL1 |=0x000002A8; // P0.17, P0.18, P0.19, P0.20 are set as SCK, MISO, MOSI and CE (SPI1)

IODIR0 |= SS; // SSEL is output

IOSET0 |= SS; // set SSEL to high

SSPCPSR=0x02; // 2 for master mode


// 8 bit data of tx/rx, SCR (Serial clock rate as 10 =0A(hex) ) PCLK/(CPSDVSR*[SCR+1])

SSPCR0= 0x0A07;

SSPCR1=0x02; //normal mode selection, SSp controller enabled


I do not understand that how to select SCR (serial clock rate) in SSPCR0 register???? So I can make write and read properly.

I have used formula- PCLK/(CPSDVSR*[SCR+1]) // 15/( 2[2+1]) = 2.5MHZ

I have checked these two , SSPCR0 and SSPCPSR with multiple values, even checked for PCLK=60Mhz. But it is neither writing nor reading passed string to memory.

For writing and reading to/from memory I have checked BSY flag in status register.

while (!(SSPSR & 0x10) );


Also I have send the memory instruction/command prior WRITE and READ operation. WRITE_EN (0x06) and 0x02 for 1 to 256 byte write. Then send actual data in format (Address, data length , actual data string) as My_Write(0x000004,4,&MSG[0])

Similarly send 0x03 prior to read data from memory. , then read data byte of the same address, length and string array.


I am receiving 0xFF after reading. I think this receive is dummy byte and writing is not happening.

Hope somebody can give suggestion to SCR selection and writing commands.

Regards,
Rituv
 
Top