I believe this:
/* Input parameter test - this test can be disabled by setting the "Ignore range checking"
property to the "yes" value in the "Configuration inspector" */
if ((PageNumber + PageCount) >= NAND_FLASH_PAGE_COUNT) {
return ERR_PARAM_LENGTH;
should be this:
/* Input parameter test - this test can be disabled by setting the "Ignore range checking"
property to the "yes" value in the "Configuration inspector" */
if ((PageNumber + PageCount) > NAND_FLASH_PAGE_COUNT) {
return ERR_PARAM_LENGTH;
Otherwise you can't access the last page of the flash.