本帖最后由 hpdell 于 2016-11-5 15:36 编辑
QSPI N25Q256 读取 ID 貌似跟资料介绍的不一致??
资料介绍
实际读取到的 ID
对 这个芯片的 数据读写,4k擦除 完全正常,但是还有芯片擦除 还是不行
/* Identification Operations */
#define QSPI_READ_ID_CMD 0x9E
#define QSPI_READ_ID_CMD2 0x9F
#define QSPI_MULTIPLE_IO_READ_ID_CMD 0xAF
#define QSPI_READ_SERIAL_FLASH_DISCO_PARAM_CMD 0x5A
读取函数如下:
QSPI_StaticTypeDef QSPI_Read_ID(uint8_t ReadID, uint8_t * _pIdBuf, uint8_t ReadIdNum)
{
QSPI_CommandTypeDef sCommand;
__IO uint32_t cc;
//Initialize the read command
sCommand.InstructionMode = QSPI_INSTRUCTION_1_LINE; //指令模式
sCommand.AddressSize = QSPI_ADDRESS_24_BITS; //地址长度
sCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE; //无交替字节
sCommand.DdrMode = QSPI_DDR_MODE_DISABLE; //关闭DDR模式
sCommand.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
sCommand.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;
sCommand.Instruction = ReadID; //指令
sCommand.DummyCycles = 1; //设置空指令周期数
// sCommand.Address = address; //地址
sCommand.NbData = ReadIdNum; // 需要读取的字节数
if(ReadID == QSPI_MULTIPLE_IO_READ_ID_CMD)
{
sCommand.AddressMode = QSPI_ADDRESS_4_LINES; //地址模式
sCommand.DataMode = QSPI_DATA_4_LINES; //数据模式
}
else
{
sCommand.AddressMode = QSPI_ADDRESS_1_LINE; //地址模式
sCommand.DataMode = QSPI_DATA_1_LINE; //数据模式
}
if (HAL_QSPI_Command(&hqspi, &sCommand, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
return QSPI_ERROR;
}
RxCplt = 0; // 接收标志清0
if (HAL_QSPI_Receive_IT(&hqspi, _pIdBuf) != HAL_OK)
{
return QSPI_ERROR;
}
cc = 0;
do{
cc ++;
} while( (RxCplt == 0) && (cc < QSPI_WAIT_MAX_TIME));
if(cc >= (QSPI_WAIT_MAX_TIME - 1 ))
return QSPI_ERROR;
return QSPI_OK;
}
main{
.........................
QSPI_Read_ID( QSPI_READ_ID_CMD2, (uint8_t*) &uart_rx_buff[0], 20);
uart_rx_buff[18] = 0xff; // 特意赋值为 0xff
for(cc=0;cc<20;cc++)
printf("ID = %#x, %d
", uart_rx_buff[cc], cc);
}
請教一下。這個讀取和存儲速度快嗎?你做過測試嗎?
还在捣鼓中啊
一周热门 更多>