Page 1 of 1

Accessing more of the MOD54415 UserParameters flash

Posted: Tue Mar 11, 2014 11:24 am
by mmccarthy
The MOD54415 specifies 128kB of user parameter storage vs. the 8kB of the MOD5234 and others. However, the SaveUserParameters() system call only allows 8k maximum to be written. I have cloned a custom routine that increases the write limit to 128kB. It seems to work just fine.

Code: Select all

int SaveMyUserParameters( void *pCopyFrom, int len )
{
	void *bp;

	bp = GetUserParameters();

   if ( ( len > 131072 ) || ( len < 0 ) )
   {
      return 0;
   }
   else
   {
      USER_ENTER_CRITICAL();
      FlashErase( bp, len );
      FlashProgram( bp, pCopyFrom, len );
      USER_EXIT_CRITICAL();

      return len;
   }
}
Is there anything I am missing that may conflict with my expanded usage of this part of the Flash? Are there any hidden uses of other regions of the "user" memory block? :?:

Mike McCarthy

Re: Accessing more of the MOD54415 UserParameters flash

Posted: Tue Mar 11, 2014 3:26 pm
by dciliske
Uh... So far as I can think, you're in the clear with your change to UserParam. I'm pretty sure you need to write it all at once or you'll lose data. Err... Just saw the call to FlashErase. :D You'll definitely lose the data if you don't. I'll need to check with Paul/have weigh in on this to be certain.

As for why is there 128k available on the MOD5441X but SaveUserParam only allows for 8k usage? Well, it sits in the system library and the UserParam sector size is usually only 8k in size. The MOD5441X's flash happens to have a 128k sector instead.

In reality, based on this issue, it would make sense to move the UserParam stuff out of the system lib and into the platform libs (or add a platform variable which declares the sector size). Actually, I think you can do this by differencing between UserParamBase and AppFlashBase... brb...

-Dan

Re: Accessing more of the MOD54415 UserParameters flash

Posted: Tue Mar 11, 2014 3:55 pm
by dciliske
Turns out Paul beat me to it.... So the modification for *UserParam is as follows:

SaveUserParam and GetUserParam have been extracted into their own source file in the system library, 'userparam.c'. This allows the function pair SaveUserParam and GetUserParam to be overwritten in a earlier compilation unit at link time. The MOD5441X has had these functions added in its 'bsp.c' file.