I use Micron Micron N25Q64 with LPC1853.
It's page size is 256 bytes.
But testapp of LPC18_43_SPIFIdriver_Generic reports wrong size 16384 bytes.
How can I fix it?
I use LPCXpresso v8.2.0 [Build 647] [2016-07-18] .
You may also want to take a look at the examples available from: LPC SPIFI Peripheral|NXP
Regards,
LPCXpresso Support
Then you should probably extract the underlying LPCSPIFLIB code from the LPCXpresso flash driver. Keeping the flash driver code and data structures in your application code makes little sense. The data structures in particular are there to allow the host debugger and the flash driver running on the target MCU to interact - they make no sense when using LPCSPIFILIB as part of your own application, when you can access the data structures within the library code itself.
Regards,
LPCXpresso Support
In the Init() function of FlashPrg.c within the flash driver sources (in the examples directory of the LPCXpresso installation) you will see the comment:
// Update FlashDevice page size
// Note that this is not the true page size from the detected SPIFI device, but
// is actually the size of a single buffer of data that the debugger will send
// down to the flash driver. This will normally be 16KB (limited by the available
// RAM on the device) but cannot be larger than a single sector.
The flash driver is basically using a pseudo page size of 16KB in its high level code to allow it to transfer larger chunks of data from the host, down over USB to the target MCU. The lower levels of the LPCSPIFILIB code will then use the actual true page size of 256 bytes for programming each page.
This helps to dramatically increase the speed of programming the flash.
Regards,
LPCXpresso Support
Hi,
I use this library for external memory boot loader for Flash Magic.
ProgramPage(...) fubction is called every 256 bytes while receiving
write data via UART3.
With FlashDevice.szPage 16384, ProgramPage does not return.
So I overwrite FlashDevice.szPage 256 after Init().
Then ProgramPage(...) works normally.
Should I use another function?
souarse code:
// programs a page in memory
// returns 0 for OK, 1 for failed
int Memory_ProgramPage
(
unsigned long adr, //
address of page
unsigned long sz, // size
of page
unsigned char *buf // data
to program into page
)
{
uint32_t ret;
ret = ProgramPage(adr, FlashDevice.szPage, buf);
return ret;
}