Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[ARM] SPI Flash Memory Page Read

Status
Not open for further replies.

keyboardcowboy

Member level 2
Joined
Mar 4, 2010
Messages
42
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,612
I am trying to interface AT45DB161E chip with LPC1758. I want to read the first 528 bytes from page 0. According to the datasheet if I want to directly read a page from the chip then I have to issue the opcode 0xD2 followed by 24bits which includes page address and byte address
SPIFLASH.jpg

In my code this is what I am doing

Code:
        ssp_exchange(0xD2);  //issue page read command
        ssp_exchange(0x00);  //24bit page address for page 0 and byte0
        ssp_exchange(0x00);
        ssp_exchange(0x00);

        ssp_exchange(0xFF);  // four dummy bytes (according to datasheet)
        ssp_exchange(0xFF);
        ssp_exchange(0xFF);
        ssp_exchange(0xFF);

        char extra[528];

        for (int a = 0; a <= 527; a++) {   //a for loop to read 528 bytes

            extra[a] = ssp_exchange(0xFF);
            vTaskDelay(50);
        }

The problem is I get some valid output only if I sent 1 address byte after the page read command instead of 3 which is the number mentioned in the datasheet

output.png

which is the right output, and why do I get all zeroes if I send the commands according to the datasheet
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top