View previous topic :: View next topic |
Author |
Message |
FFT
Joined: 07 Jul 2010 Posts: 92
|
|
Posted: Fri Dec 31, 2021 9:43 am |
|
|
Thank you!
I'm almost done. I can read and write correct data into ROM.
There is a problem, after multiple writes, I got cpu reset.
I could not find the reason.
Is it possible that a flash write cause reset?
Thanks. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19658
|
|
Posted: Fri Dec 31, 2021 12:44 pm |
|
|
First thing, remember the CPU completely stops during the write.
Every peripheral needs to have some form of error recovery code
to deal with the situation that it receives something or an event happens
during the write. It could simply be that your code crashed because it
could not handle this.
Second thing though is that the write does draw quite a spike of current
on the supply rail, and it is vital that the supply is stable during this. If
the power droops or fails during the write, it can completely destroy
the program memory. Sufficient smoothing that the supply can be
guaranteed for the whole write.
Be aware just how quickly the chip's write life will get used if you write
at all frequently. You can destroy a chip in just 40 seconds doing repeated
writes. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9377 Location: Greensville,Ontario
|
|
Posted: Fri Dec 31, 2021 1:04 pm |
|
|
would need to see your program but...
a guess ...
do you have the WDT enabled ?? |
|
![](templates/subSilver/images/spacer.gif) |
FFT
Joined: 07 Jul 2010 Posts: 92
|
|
Posted: Fri Dec 31, 2021 1:16 pm |
|
|
temtronic wrote: | do you have the WDT enabled ?? |
Bingo!
restart_wdt() resolved the issue.
@Ttelmah,
I will add some recovery code for communications.
Thanks for everything! That was a helpful topic. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9377 Location: Greensville,Ontario
|
|
Posted: Fri Dec 31, 2021 2:12 pm |
|
|
Normally you never enable the WDT until 100% of the code works and project is ready to be shipped to client. THEN you enable the WDT, do some tests, some calculations, configure the WDT registers, final tests and ship out. |
|
![](templates/subSilver/images/spacer.gif) |
jeremiah
Joined: 20 Jul 2010 Posts: 1368
|
|
Posted: Fri Dec 31, 2021 8:08 pm |
|
|
Another thing to consider is that erasing program memory does so in full blocks. Have you made sure no other code is in the same erase block as the structs you are writing to (which requires an erase)? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19658
|
|
Posted: Sat Jan 01, 2022 1:02 am |
|
|
If you look earlier in the thread, that is the whole reason we justified the
data to be 64bytes in 'size'.
Happy New Year everybody. |
|
![](templates/subSilver/images/spacer.gif) |
|