Firmware Dev: Adding config properties

Hi,
We’re having problems adding additional config variables to be stored in NVM.
I’ve trying to add 2 floats to either Axis config_t or Controller config_t to set up some soft limits:

In Controller.hpp:

struct Config_t {
         ControlMode_t control_mode = CTRL_MODE_POSITION_CONTROL;  //see: Motor_control_mode_t
         float pos_gain = 20.0f;  // [(counts/s) / counts]
         float vel_gain = 5.0f / 10000.0f;  // [A/(counts/s)]
         // float vel_gain = 5.0f / 200.0f, // [A/(rad/s)] <sensorless example>
         float vel_integrator_gain = 10.0f / 10000.0f;  // [A/(counts/s * s)]
         float vel_limit = 20000.0f;           // [counts/s]
         //bool test = false;
         float pos_limit_max = 58368.0f;
         float pos_limit_min = 3072.0f;
     };

Also added definitions:

make_protocol_property("pos_limit_max", &config_.pos_limit_max),
make_protocol_property("pos_limit_min", &config_.pos_limit_min)

I’ve also tried incrementing config_version in nvm_config.hpp

Compiles and flashes fine but the odrive falls over, wont start/get detected. I have to DIP into DFU to reflash.

I feel like im missing something simple here…

Do i need to clear NVM (odrv0.erase_configuation() )before flashing?
Weirdly i added a bool property to BoardConfig_t which works fine, without incrementing config_version…

(edit: formatting)

1 Like

Can you try bumping the communication task’s stack size to 7k? Here.

Let me know if that fixes it.

As a side note, we really should do that TODO about fixing all the stack allocations ;D

1 Like

Thanks, that did the trick!

Was set to 4000 in 0.4.6. Upped 7000 and bingo, extra properties!

1 Like