NVMREG errata. Extra Info
I am using a PIC18F65K40 and so am falling foul of the NVMREG errata. problem. I even read the errata before I started and didn't notice anything relevant! AAAH! Anyway after finally spotting the post mentioning it I found my code still did not work, my test code did, but not the production code.
Then I found that PMD0 bit 2 NVMMD was set to switch off the NVM module because I was not using it!!!
So to use TBLRD* NVMCON1 bits 7:6 be 10 (Write to Flash) and ALSO PMD0 bit 2 NVMMD must be Off