I am experiencing what seems to be a glitch when reading the flash memory using the FEECON register. If I use the read option in the FEECON register, the value read from the memory is 0xFF. If the memory is read with dereferenced pointers, the correct value obtained. At first, this issue only occured when the board was reset and it wasn't being debugged, but when I turned off the "use flash loader" option in the debugger secion of the options menu, it started occuring even during debugging.
The compiler being used is IAR Embedded Workbench 5.4 Kickstart and the debugger is mIDAS-Link.
I am attaching the code I used to track this issue down. However, I suspect it could be an issue with the complier settings, or maybe I'm just missing something simple. Some of the code is from samples posted on this forum. Thank you for your time.