Author Topic: Paramter system  (Read 7685 times)

Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
Paramter system
« on: June 04, 2009, 05:48:31 PM »
Hi Mark,
  Im away to start looking at the using the parameter block for saving network, and my own variables. This wont be updated in the field, only carried out before leaving our offices so we wont be using SWAP system.

1. PARAMETER_BLOCK_START - I assume this is the start of the parameter block location? In my case I am using the 52259, so will be pointing to the last page of the 512k internal flash memory?

2. TEMPORARY_PARAM_SET - I see this is set at 0x8000, what is this used for?

3. As I want to add to the PARS parameter , I will use the TEMPPARS structure as this holds the network and the PARS structures. I will always be saving boath at the same time so do I do the following:

      TEMPPARS cparameters;
     ..... copy the values across here..
   fnDelPar(INVALIDATE_TEST_PARAMETER_BLOCK);
        fnSetPar((unsigned short)(PAR_NETWORK), (unsigned char *)&cparameters, sizeof(TEMPPARS _PARAMETERS));

4. And to load the parameters, I can use the default on the application.c:

   fnGetOurParameters_1() 
which will use default originally, then after we set them they will load and use the new values

  5. After we update the paramters, we wont be doing it again, as we will be uploading firmware changes. So in this case will the parameter block never be overwritten?

Regards
Neil

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Paramter system
« Reply #1 on: June 04, 2009, 09:25:43 PM »
Hi Neil

1) Generally I have the parameter block just before the file system. With one parameter block (I agree that you don't need 2) you can set this 4k before the start of the file system (if the file system is in external memory 4k before the end of internal FLASH) [M52259 granularity is 4k]

2) PARAMETER_BLOCK_START. This is a flag passed to fnGetPar(). You won't need to use it since there is no temporary parameter block when only one is used.

3) When working with one parameter block I believe that the code suggest is correct. You must first delete the old parameters and then can write all new ones.

4) Loading parameters should be compatible so fnGetParameters_1() should do it.

5) The parameter block will not be overwritten as long as the boot loader known that it shouldn't delete into its address range (the maximum application size is a parameter in the boot loader).

Regards

Mark