Flash read not working


I have been trying to program the flash on my LPC1768. I can’t tell if it is working, because when i use flash.read(), it always returns the value 0xff for every byte!

Can you share some code?

I was using the example bootloader code:

and added:
for (int i =0 ; i <10; i++ )
printf("\n page_buffer %02x addr %x", page_buffer[i],addr+i);
int r = flash.read(buff, addr, 10);
printf("\nread return code %d\r\n",r);
uint8_t *mem_addr = (uint8_t ) addr;
for (int i =0 ; i <10; i++ )
printf("\n buff %02x addr %x mem %02x", buff[i],addr+i,
buff[i] = 0;

Always prints 10 0xff

Shouldn’t be possible to read any memory? I’m used to X86 where apart from protected regions, one can print any arbitrary memory location.