LPC4337, S25FL256S SPIFI DMA

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC4337, S25FL256S SPIFI DMA

537件の閲覧回数
Serial_Keiler
Contributor I

Hi everyone,

I'm working on a project with an LPC microcontroller and trying to write data from a buffer to external flash memory via SPIFI using DMA. The DMA transfer seems to complete without any errors during debugging, but when I check the flash memory afterwards, the data is not written. For setting up SPIFI i use LPCSPIFILIB.

Has anyone encountered a similar issue or could point me to what might be going wrong?

Thanks in advance for any suggestions or guidance!

Best regards,
Serial_Keiler

 

Code :

uint32_t bufor_data[64] __attribute__((at(0x10081000)));
 
 
for (i = 0; i < 0x100; i++) 
{
bufor_data[i] = i*2;
}
LPC_GPDMA -> CH[0].CONTROL = 0x0;
LPC_GPDMA -> CH[0].CONFIG = 0x0;
LPC_CREG -> DMAMUX = 0x0;
LPC_GPDMA -> CH[0].CONFIG |= (5 << 11);
LPC_GPDMA -> CH[0].CONTROL |= ((1<<19)|(1<<25)|(1<<26));
LPC_GPDMA -> CH[0].SRCADDR = 0x10081000;
LPC_GPDMA -> CH[0].DESTADDR = 0x40003014;  
LPC_SPIFI -> STAT |= SPIFI_STAT_RESET;
LPC_SPIFI -> STAT |= SPIFI_STAT_INTRQ;
LPC_SPIFI -> CMD |= SPIFI_WRITE_ENABLE;
while(LPC_SPIFI->STAT & (1<<1))
{
 
}
while (pSpifi->pFamFx->devGetStatus(pSpifi) & 1)
{
 
}
LPC_SPIFI -> ADDR = 0x14000000;
LPC_SPIFI -> CTRL |= (1<<31);
LPC_GPDMA -> CH[0].CONFIG |= 0x1;
NVIC_ClearPendingIRQ((IRQn_Type)30);
NVIC_EnableIRQ((IRQn_Type)30);
LPC_SPIFI -> CTRL |= (1<<22);
LPC_SPIFI -> STAT |= SPIFI_STAT_RESET;
LPC_SPIFI -> CMD = 0;
LPC_SPIFI -> CMD |= (0x02<<24) | (1 << 15) | (256);
while (LPC_SPIFI->STAT & (1<<1))
{
 
}
 
while (pSpifi->pFamFx->devGetStatus(pSpifi) & 1)
{
 
}
ラベル(1)
0 件の賞賛
返信
1 返信

504件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Serial_Keiler 

Please refer to the thread discussing the same issue:

https://community.nxp.com/t5/LPC-Microcontrollers/DMA-to-from-SPIFI/m-p/566799 

"it is not possible to write to flash using a DMA memory-to-memory transfer while in memory-mapped mode, because memory-mapped mode does not support flash programming.

However, it is possible to use DMA to send a write command! "

Alice_Yang_0-1746612680353.png

 

BR

Alice

 

0 件の賞賛
返信