RT1060 - Hyperflash Write example

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

RT1060 - Hyperflash Write example

1,303 次查看
pauricacre
Contributor III

I'm having issues using the flexspi_nor_hyperbus_write() in the hyper_flash_polling_transfer example for the RT1060EVK. I have modified by hardware to use hyperflash and my application is running from RAM.

Inside the flexspi_nor_hyperbus_write function, the address is multiplied by 2. What is the reason for this?

 

status_t flexspi_nor_hyperbus_write(uint32_t addr, uint32_t *buffer, uint32_t bytes)
{
    flexspi_transfer_t flashXfer;
    status_t status;

    flashXfer.deviceAddress = addr * 2;
    flashXfer.port          = kFLEXSPI_PortA1;
    flashXfer.cmdType       = kFLEXSPI_Write;
    flashXfer.SeqNumber     = 1;
    flashXfer.seqIndex      = HYPERFLASH_CMD_LUT_SEQ_IDX_WRITEDATA;
    flashXfer.data          = buffer;
    flashXfer.dataSize      = bytes;
    status                  = FLEXSPI_TransferBlocking(FLEXSPI, &flashXfer);

    if (status != kStatus_Success)
    {
        return status;
    }

    return status;
}

 

When I remove the addr*2, it writes to the intended address but the commands no longer work.

For example, if I want to write to the address 0x20000, how should I be using the flexspi_nor_hyperbus_write function? This is how I would have intended to use it? Is there something else required?

 

uint8_t data[8] = "abcdefgh";
flexspi_nor_hyperbus_write(0x20000, (uint32_t*)(data), sizeof(data));

 

In conclusion, what is the reason for this and why do I need it?

标记 (4)
0 项奖励
回复
3 回复数

1,281 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello, 

The Hyper-flash is Word Addressable, which is accessed in terms of 16-bit. FlexSPI does not transmit Flash address bit 0 to the Flash. Thus, multiplying the deviceAddress by 2 makes sure FlexSPI transmits the right address value.

Regards,
Victor 

1,268 次查看
pauricacre
Contributor III

Is the function flexspi_nor_hyperbus_write() for commands only or can it be used for writing data to the chip?

Should flexspi_nor_flash_page_program() only be used for writing data to the flash chip?

Sorry this is no information on the function headers so its not clear what their purpose is.

0 项奖励
回复

1,245 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello, 

Keep in mind that the RT1060 doesn't have an internal flash. The memory you are writing to when calling this function is external. That being said, the intended use of functions flexspi_nor_hyperbus_write and flexspi_nor_flash_page_program is to write to this external flash. 

Regards,
Victor 

0 项奖励
回复