MOD 5282 MEMORY/FLASH TEST

Discussion to talk about software related topics only.
tpannone
Posts: 69
Joined: Fri Feb 15, 2013 1:04 pm

Re: MOD 5282 MEMORY/FLASH TEST

Post by tpannone »

rnixon wrote:One thing you could do is write a new small program that just erases the user parameter area, then load your code again and see if it works.
That's exactly what I was thinking about doing. I saw some other threads about using the SaveUserParam function to erase the User Params block in Flash. I was doing some digging to find out exactly SaveUserParam does.

And thanks for the other notes on using Flash.
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: MOD 5282 MEMORY/FLASH TEST

Post by rnixon »

If you look in userparam.c you will see the SaveUserParam() function, which works like:

USER_ENTER_CRITICAL();
FlashErase( ( void * ) &UserParamBase, len );
FlashProgram( ( void * ) &UserParamBase, pCopyFrom, len );
USER_EXIT_CRITICAL();


You could create a new function called EraseUserParam(), just delete FlashProgram(). If you create a function in userparam.c you need to rebuild the libs. If you include it in your app (there is a SaveUserParam example), you'll need to include the headers to call the flash and os functions
tpannone
Posts: 69
Joined: Fri Feb 15, 2013 1:04 pm

Re: MOD 5282 MEMORY/FLASH TEST

Post by tpannone »

rnixon wrote:If you look in userparam.c you will see the SaveUserParam() function, which works like:

USER_ENTER_CRITICAL();
FlashErase( ( void * ) &UserParamBase, len );
FlashProgram( ( void * ) &UserParamBase, pCopyFrom, len );
USER_EXIT_CRITICAL();


You could create a new function called EraseUserParam(), just delete FlashProgram(). If you create a function in userparam.c you need to rebuild the libs. If you include it in your app (there is a SaveUserParam example), you'll need to include the headers to call the flash and os functions
That did the trick. After erasing the entire user parameter storage area in Flash, my original app works as expected and I can use IPSetup and AutoUpdate apps.

Now I need to look at what caused the problem in the first place. I believe it may be a case of operator error. Our user Flash contains various parameters to tune multiple servo loops. The field tech was telling me that in his frustration to discover and eliminate a servo loop instability, he was punching our 'Save to Flash' button pretty fast because he was making changes to operating parameters so quickly.

On an unrelated note, it's a little surprising to notice the differences in the various NNDK versions. My function is actually called SaveUserParameters() and is located in the system.c file.

Thanks again for the assist!
Post Reply