我在这里测试NAND FLASH,程序是
HAL_StatusTypeDef Simple_NAND_Test(void)
{
HAL_StatusTypeDef status;
NAND_AddressTypeDef addr = {0}; // 块0,页0
for (uint32_t i = 0; i < 20; i++)
{
write_buf[i] = i & 0xFF;
}
status = HAL_NAND_Erase_Block(&hnand1, &addr);
if (status != HAL_OK)
{
return HAL_ERROR; // 擦除失败
}
// 4. 写入页0
status = HAL_NAND_Write_Page_8b(&hnand1, &addr, write_buf, 1);
if (status != HAL_OK)
{
return HAL_ERROR; // 写入失败
}
memset(write_buf, 0, 20);
// 5. 读取页0
status = HAL_NAND_Read_Page_8b(&hnand1, &addr, write_buf, 1);
if (status != HAL_OK)
{
return HAL_ERROR; // 读取失败
}
return HAL_OK; // 测试通过
}
这里在HAL_NAND_Erase_Block卡死 |
和NAND通讯失败
FMC的引脚需要拉高或者拉低吗?使用CubeMX默认配置的,无上拉和下拉