How to erase external Flash ?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to erase external Flash ?

3,392件の閲覧回数
UsamaShafiq
Contributor II

Hello there.

I am using MKW31Z512VHT4 microcontroller (with custom development board). I have added an external Flash (AT45DB081ESSHN-T) SPI configured at PINS 45(SPI_SCK), 46(SPI_SI), 47(SPI_SO) & 48(SPI_CS) of MKW31Z

Now, I want to erase the external flash. How Can I do that? 

0 件の賞賛
返信
5 返答(返信)

3,329件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @UsamaShafiq,

Since this is a custom external flash, please refer to your part's data sheet in order to control the external flash through SPI. The MK41Z's SDK includes a SPI driver which you can use as a base example.

I apologize for the inconvenience.

Best regards,
Julián. 

0 件の賞賛
返信

3,297件の閲覧回数
UsamaShafiq
Contributor II

Hello @Julián_AragónM 

As I navigate through MKW41z Drivers SDK. 

Driver examples > DSPI you find multiple projects like edma B2B Transfer( with 2 sub-projects master/slave)

Which project am I suppose to use to send command/data over SPI (Refer to Image 1).

One More thing I want to Know. As, I want to send the chip erase Command to my external flash (which is shown in image 2 from the Datasheet). How to send this command over SPI to erase the Flash?

Kindly Guide me in this problem.

Regards.

0 件の賞賛
返信

3,264件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @UsamaShafiq,

You can base your project on the b2b "master" example from the driver, and send the required commands through. In the "readme.txt" under docs you can fin the information the master transmits. Change these btyes in the code to the commands needed to control the flash.

The transfer varibale can be found in the code as "masterTxData".

You can also find more information under Chapter 11 (DSPI: Serial Peripheral Interface Driver) of the MCUXpresso SDK API Reference Manual_MKW41Z4. This document is inside the SDK folder under "SDKPackages\SDK_2_2_3_FRDM-KW41Z\docs".

I hope you find this helpful!

Best regards,
Julián

0 件の賞賛
返信

3,226件の閲覧回数
UsamaShafiq
Contributor II

hi @Julián_AragónM 

Upon Reviewing chapter 11 of MCUXpresso SDK API Reference Manual I came up with the following command:

DSPI_MasterWriteCommandDataBlocking(base, dataWord);

Is this the right command for chip erase ?

How can I send C7h 94h 80h 9Ah (chip erase ) using above command? 

You can also refer to chip erase section of AT45DB081E-SSHN-T or the attached image 2 in my previous reply.

0 件の賞賛
返信

3,193件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @UsamaShafiq,

I apologize for the inconveniences, but since this is an implementation of a custom flash, support is limited.

Instead of using the DSPI_MasterWriteCommandDataBlocking function alone, please base yourself off an example so only the data transferred can be edited.

Personally, I would recommend starting with the dspi_interrupt_transfer or dspi_polling_transfer examples (depending on if you want blocking or nonblocking), since these are the most basic DSPI examples in the SDK.

This example utilizes both instances of the SPI, one as master, and one as slave in the same board. In order to control your external flash, please modify the transfer data initialization to match your custom flash commands. This is how the data is initialized in the example:

    /* Set up the transfer data */
    for (i = 0U; i < TRANSFER_SIZE; i++)
    {
        masterTxData[i] = i % 256U;
        masterRxData[i] = 0U;

        slaveTxData[i] = ~masterTxData[i];
        slaveRxData[i] = 0U;
    }

This initialization fills the Tx data array from 0 to 255, you can modify it, so you only fill it byte by byte, or keep it this way and send the dataWords separately.

 

    DSPI_MasterTransferBlocking(EXAMPLE_DSPI_MASTER_BASEADDR, &masterXfer);

This function utilizes the masterXfer structure, where the masterTxData is assigned by this part of the code:

    masterXfer.txData = masterTxData;

In your case, the commands (C7h 94h 80h 9Ah) are to be filled into masterTxData and transferred with DSPI_MasterTransferNonBlocking if you were to use the interrupt example, or DSPI_MasterTransferBlocking if you were to use the polling example.

I apologize again for the limited support.

Best regards,
Julián

0 件の賞賛
返信