Content originally posted in LPCWare by lintovincent88 on Mon Feb 08 05:11:48 MST 2016
Hi nxp,
i am currently working with a project using spifi for saving images in to my external flash. i saved the images to flash from sdcard. at the beginning it works fine. when we declare more variables the RGB data is shifted ,while reading from flash.Flash memory is spansion S25FL127S.
i use the following code to read from flash memory.(WC_A=0x28136000)
pSpifiHandle = spifiInitDevice(&lmem, sizeof(lmem), LPC_SPIFI_BASE,SPIFLASH_BASE_ADDRESS);
spifiDevSetMemMode(pSpifiHandle, true);
send_image_data(BUFFER1,0,0,480,272,WC_A); //this function reads the data from flash and sent to ssd1963 controller.
/*send image data function*/
void send_image_data(uint16_t mem_location,uint16_t x_cord,uint16_t y_cord,uint16_t img_width,uint16_t img_hieght,unsigned char *img_data )
{
uint64_t i=0,x,y,z=0;
uint16_t x_start_cord,x_end_cord,y_start_cord,y_end_cord,hieght,width;
uint8_t flag=0;
x_start_cord = x_cord;//x_cord-1;
x_end_cord = x_cord+img_width-1;//x_cord+img_width-2;
y_start_cord = y_cord + mem_location;//y_cord-1 + mem_location;
y_end_cord = y_cord+mem_location+img_hieght-1;//y_cord+img_hieght-2;
hieght =img_hieght;
width= img_width;
WindowSet(x_start_cord,x_end_cord,y_start_cord,y_end_cord);
write_command(0x2C);
for (y=0;y<hieght;y++)//272
{
for (x=0;x<width;x++)//480
{
i= z*3;
send_pixel((img_data[i+2]<<16)|(img_data[i+1]<<8)|(img_data));
z++;
}
}
}
every time reading from flash i use these functions.
pSpifiHandle = spifiInitDevice(&lmem, sizeof(lmem), LPC_SPIFI_BASE,SPIFLASH_BASE_ADDRESS);
spifiDevSetMemMode(pSpifiHandle, true);
is it because of using this functions repeatedly??
please advice. am attaching the original and shifted RGB data image.
thanks and regards
Linto