Flash System Parameters Do Not Change

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flash System Parameters Do Not Change

1,000 Views
derekcook
Senior Contributor I

In my software, I have a parameter tuning thought. This is in case the motor I am controlling changes. Therefore, as long as KMS is in the IDLE state, and the motor is not being controlled, I let the master controller send me a list of motor parameters via SPI to store into the flash system params. I do this, and then recall DRV_INIT(). This does not seem to cause any problems, and most parameters change, however, I have identified 2 that do not, and want to be sure I am taking the correct steps to change parameters on the fly like this.

Currently, I am just calling DRV_Init() again after setting the new flashSysParams. Is there anything else I need to do?

The 2 that do not change are encoder pole pairs, as well as TRAJVEL Acceleration Limit, this process does not seem to work for these two parameters. 

Do I need to do anything extra besides calling DRV_Init() after setting the flashSysParams value to change some of these parameters, such as the 2 listed above? 

This is what I am doing:

flashSysParams->motorParams.polePairs = tuning_params[PARAM_MOTOR_POLE_PAIRS].tuningValue;

flashSysParams->trajvelCfg.limitAcc = _LQ(tuning_params[PARAM_ACCEL_LIM].tuningValue/FULL_SCALE_SPEED_RPM);

/* Init Platform Independent Motor Commander Core */
DRV_init(&flashSysParams);

Labels (1)
4 Replies

809 Views
linestream-adam
Senior Contributor I

I don't see an issue with your approach. Seems like it should work. One thing I would recommend is taking a look in the main.c file at the block inside if (SoftReset != 0)

There are a couple commands that disable the ISR and flush a bad sample just to ensure that the system is paused while performing the recalculation.

0 Kudos

809 Views
derekcook
Senior Contributor I

I tried moving everything in that block run when I change the parameters. Any idea why the TRAJVEL AccLim would not be changing?

0 Kudos

809 Views
linestream-adam
Senior Contributor I

The trajvel.config.limitAcc variable is always set to the value in user.output.drvCommand.limitAcc when the slow ISR is called. The value user.output.drvCommand.limitAcc is derived from user.command.limitAcc. That is expected behavior.

809 Views
derekcook
Senior Contributor I

Hey Adam, 

That's what the problem was. This would be the same with the IqRefMin and Max as well  - it is set to the user.command each slow tick. As well as the jerk limit. 

Thanks for the help!

0 Kudos