lpcware

Spifi flash Reading.

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by lintovincent88 on Tue May 19 21:08:12 MST 2015
Hi nxp,

       I am using SPIFI for saving images and its working fine, but sometimes  if there is any sudden fluctuations in power supply or sudden power reset the image colors(RGB sequence) are getting changed. am attaching those images with this thread. also the code used to interface the spifi.Please tell me what is the reason for this error.


code:

LPC_SC->PCONP |= 0x00010000;
LPC_IOCON->P2_7 &= ~0x000000217;
LPC_IOCON->P2_7 |= 0x000000215;/* SPIFI_CSN @ P2.7 */
LPC_IOCON->P0_22 &= ~0x000000217;
LPC_IOCON->P0_22 |= 0x000000215;/* SPIFI_CLK @ P0.22 */
LPC_IOCON->P0_15 &= ~0x000000217;
LPC_IOCON->P0_15 |= 0x000000215;/* SPIFI_IO2 @ P0.15 */
LPC_IOCON->P0_16 &= ~0x000000217;
LPC_IOCON->P0_16 |= 0x000000215;/* SPIFI_IO3 @ P0.16 */
LPC_IOCON->P0_17 &= ~0x000000217;
LPC_IOCON->P0_17 |= 0x000000215;/* SPIFI_IO1 @ P0.17 */
LPC_IOCON->P0_18 &= ~0x000000217;
LPC_IOCON->P0_18 |= 0x000000215;/* SPIFI_IO0 @ P0.18 */

LPC_SC->SPIFICLKSEL |= 0x00000108;  //15MHZ //

errCode = spifiInit(LPC_SPIFI_BASE, true);
spifiRegisterFamily(spifi_REG_FAMILY_CommonCommandSet);
memSize = spifiGetHandleMemSize(LPC_SPIFI_BASE);
if (memSize == 0)
{
/* No device detected, error */
return (SPIFI_ERR_GEN);
}

pSpifiHandle = spifiInitDevice(&lmem, sizeof(lmem), LPC_SPIFI_BASE,SPIFLASH_BASE_ADDRESS);

LPC_SC->SPIFICLKSEL |= 0x00000102;  //60MHZ

spifiDevSetMemMode(pSpifiHandle, true);
spifiDevSetOpts(pSpifiHandle,SPIFI_OPT_USE_QUAD,1);








/* Image Loading to buffer1 */         //WELCOME_A    0x28000000


pSpifiHandle = spifiInitDevice(&lmem, sizeof(lmem), LPC_SPIFI_BASE,SPIFLASH_BASE_ADDRESS);
spifiDevSetMemMode(pSpifiHandle, true);
send_image_data(BUFFER1,0,0,480,272,WELCOME_A);
write_command(SET_DISPLAY_ON); //SET display on
switch_screen(BUFFER1);

Attachments

Outcomes