• AVR Freaks

AnsweredHot!Re: PIC32MZ flash write problem

Author
jrmymllr
Super Member
  • Total Posts : 182
  • Reward points : 0
  • Joined: 2011/06/11 06:05:25
  • Location: MPLS
  • Status: offline
2020/03/28 07:40:54 (permalink)
0

Re: PIC32MZ flash write problem

Can't reply to the original post because it gives me an Access Denied!
 
andersm
Have you read application note AN1600?


 
The debugger doesn't read flash contents through the cache does it? I saw the flash contents change to all Fs in the debugger immediately after erasing flash, and immediately change to random garbage after programming it.
 
I also tried copying flash to RAM so I could check the flash contents through KSEG1, which should also bypass the cache.
post edited by jrmymllr - 2020/03/28 07:45:05
#1
NKurzman
A Guy on the Net
  • Total Posts : 18655
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: PIC32MZ flash write problem 2020/03/28 07:59:12 (permalink)
0
To see the results of you writing tithe flash via code, you must read it back in the debugger. It is not automatic.
#2
jrmymllr
Super Member
  • Total Posts : 182
  • Reward points : 0
  • Joined: 2011/06/11 06:05:25
  • Location: MPLS
  • Status: offline
Re: PIC32MZ flash write problem 2020/03/28 09:00:06 (permalink)
0
NKurzman
To see the results of you writing tithe flash via code, you must read it back in the debugger. It is not automatic.

Yeah, I did that. It read the entire contents (and took awhile). I can see that erase definitely works, and program works but is writing random garbage.
 
EDIT: I can successfully program a single word (NVMCONbits.NVMOP = 1) but programming a row (NVMCONbits.NVMOP = 3) writes nonsense. I don't get it.
post edited by jrmymllr - 2020/03/28 10:35:47
#3
andersm
Super Member
  • Total Posts : 2796
  • Reward points : 0
  • Joined: 2012/10/07 14:57:44
  • Location: 0
  • Status: online
Re: PIC32MZ flash write problem 2020/03/28 10:38:06 (permalink) ☼ Best Answerby jrmymllr 2020/03/28 12:20:21
4.5 (2)
jrmymllrI saw the flash contents change to all Fs in the debugger immediately after erasing flash, and immediately change to random garbage after programming it.

If the data you're trying to program is only in the cache, then whatever happens to be in the underlying RAM will be programmed instead.
#4
jrmymllr
Super Member
  • Total Posts : 182
  • Reward points : 0
  • Joined: 2011/06/11 06:05:25
  • Location: MPLS
  • Status: offline
Re: PIC32MZ flash write problem 2020/03/28 12:19:59 (permalink)
0
andersm
jrmymllrI saw the flash contents change to all Fs in the debugger immediately after erasing flash, and immediately change to random garbage after programming it.

If the data you're trying to program is only in the cache, then whatever happens to be in the underlying RAM will be programmed instead.



Bingo! I added the coherent attribute to the array and that worked. I had this same issue when I was trying to get ENET working a couple years ago. I couldn't figure out why it was transmitting garbage.....weeks of frustration. You're the best.
#5
Jump to:
© 2020 APG vNext Commercial Version 4.5