求官方出W806的PSRAM的hal库demo

发布于 2022-04-22 09:58:49

本想着自己把tls的psram驱动移植到hal,不过dma那块有点复杂,不知咋搞,请问有大神移植了吗?

查看更多

关注者
0
被浏览
520
2 个回答
Mrzhao
Mrzhao 认证专家 2022-04-22
一个嵌入式爱好者。CSDN主页:https://blog.csdn.net/qq_37280428?spm=1011.2415.3001.5343

不太可能

okeybomb
okeybomb 2022-05-04
This guy hasn't written anything yet

这是我自己写的,时钟分频寄存器你可以根据规格书重新计算,我用的不是标准40M晶振

void LL_QPI_Enable4bit(void)
{

LL_QPI_RegWrite(LL_QPI_REG_CTRL,(LL_QPI_RegRead(LL_QPI_REG_CTRL)|LL_QPI_QUAD_ENABLE)); //reset qpi

while((LL_QPI_RegRead(LL_QPI_REG_CTRL)&0x02u)==0); //wait 

}

void LL_QspiInit(void)
{

unsigned long regVal;
LL_GpioInitStructDef   GpioInit;
LL_QpiState = LL_Qpi_Busy;

LL_PeripheralClockEnable(CLK_QPI);
LL_GpioAfInit(Psram_Ck_Remap,LL_GPIOB,LL_GPIO_P00);
LL_GpioAfInit(Psram_Cs_Remap,LL_GPIOB,LL_GPIO_P27);
LL_GpioAfInit(Psram_D0_Remap,LL_GPIOB,LL_GPIO_P02);
LL_GpioAfInit(Psram_D1_Remap,LL_GPIOB,LL_GPIO_P03);
LL_GpioAfInit(Psram_D2_Remap,LL_GPIOB,LL_GPIO_P04);    
LL_GpioAfInit(Psram_D3_Remap,LL_GPIOB,LL_GPIO_P05);
regVal = LL_QPI_RegRead(LL_QPI_REG_CTRL);
LL_QPI_RegWrite(LL_QPI_REG_CTRL,(regVal|LL_QPI_RESET_ENABLE)); //reset qpi
while(1)
{
    regVal = LL_QPI_RegRead(LL_QPI_REG_CTRL);
    if(~(regVal&0x00000001u))
    {
        break;
    }
}
regVal = LL_QPI_RegRead(LL_QPI_REG_CTRL)&0xFFFFF000u;
LL_QPI_RegWrite(LL_QPI_REG_CTRL,regVal); // reset reg value
regVal = LL_QPI_RegRead(LL_QPI_REG_CTRL)&0xFFFFFF0Fu;
LL_QPI_RegWrite(LL_QPI_REG_CTRL,(regVal|LL_QPI_CLK_DIV)); //set clk div
regVal = LL_QPI_RegRead(LL_QPI_REG_CTRL)&0xFFFFF8FFu;
LL_QPI_RegWrite(LL_QPI_REG_CTRL,(regVal|LL_QPI_tCPH));   //set cCPH time

regVal = LL_QPI_RegRead(LL_QPI_REG_CTRL);
LL_QPI_RegWrite(LL_QPI_REG_CTRL,(regVal|LL_QPI_BURST_ENABLE));   //set burst enable    

regVal = LL_QPI_RegRead(LL_QPI_REG_OVTR)&0xFFFFF000u;
LL_QPI_RegWrite(LL_QPI_REG_OVTR,(regVal|LL_QPI_tCEM));   //set cCEM time ,<= 4uS

LL_QPI_Enable4bit();
LL_QpiState = LL_Qpi_Ready;

// 以下用于测试初始化代码是否正确,无其他意义,初始化OK
// (unsigned long )(LL_QPI_BUS) = 0xaaaaaaaa;
// TestData[0]=(unsigned long )(LL_QPI_BUS);
// for(i=0;i<4;i++)
// {
// (unsigned long )(LL_QPI_BUS+(i*4)) = 0xaaaaaaaa;
// }
// for(i=0;i<4;i++)
// {
// TestData[i] = (unsigned long )(LL_QPI_BUS+(i*4));
// }
}

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览