【简介】
在之前的帖子中我们已经介绍了通过QSPI 的IP 模块来对QSPI 接口的flash 的擦除读写功能的验证。QSPI 除了可以通过IP来读取flash阵列的数据外还可以直接通过AHB接口进行读取访问,从以下的框图中也可以看出AHB读取的特性。

下图的紫色和黄色路径分别代表AHB 和 IP 访问QSPI 的两条路径。

对于两条path 的功能描述如下,对于AHB 访问flash 只能进行读操作擦除和写入还是需要以来外设访问来完成。

在QSPI 上使用AHB 来访问flash 软件上只要调用如下 的接口来开配置AHB访问的配置即可。

本地添加如下的初始化代码后,触发ahb读取flash 的内容来验证AHB 读取flash 功能。
/* Initialization code for S25FL512S flash */
/* This function can be used to set up any specific configurations required for the flash memory */
Qspi_Ip_StatusType st;
st = Qspi_Ip_ControllerInit(0, Qspi_Ip_paQspiUnitCfg);
if(st != STATUS_QSPI_IP_SUCCESS)
{
/* Handle error */
printf("QSPI Controller initialization failed with status: %d.\r\n", st);
}
else
{
printf("QSPI Controller initialization ok.\r\n");
}
st = Qspi_Ip_Init(0, Qspi_Ip_paFlashCfg,
Qspi_Ip_paFlashConnectionCfg);
if(st != STATUS_QSPI_IP_SUCCESS)
{
/* Handle error */
printf("QSPI Flash initialization failed with status: %d\n", st);
}
else
{
printf("QSPI Flash initialization ok.\r\n");
}
st = Qspi_Ip_AhbReadEnable(0);
if(st != STATUS_QSPI_IP_SUCCESS)
{
/* Handle error */
printf("QSPI Flash AHB read enable failed with status: %d\n", st);
}
else
{
printf("QSPI Flash AHB read enable ok.\r\n");
}QSPI 初始化后,擦除flash 通过AHB 的地址读取flash 的述如下跟预期的0xff保持一致。

本地通过QSPI 写入数据后在通过AHB读取回来的述跟写入的也是一致。

我要赚赏金
