STACK_MAIN size and vtol_att_control running low on stack

Our custom vtol type gives a ‘[load_mon] vtol_att_control low on stack’ warning intermittently.

I found I can eliminate this warning by increasing the stack size called in px4_spawn_task in vtol_att_control_main.cpp from 1230 to 1300.

Can anyone give some guidance on how these different stack values need to match up to fly safely?

  • A module’s STACK_MAIN value defined in CMakeLists
  • The value called by the module’s main px4_spawn_task function
  • A board’s nsh/defconfig CONFIG_USERMAIN_STACKSIZE

For example, am I good as long as the value in px4_spawn_task is less than the STACK_MAIN? Does it need to be less by an amount or can it be equal?

1 Like

Did you find anything about this?

No idea. But I was able to eliminate the “low on stack” message by increasing the value in the px4_spawn_task function to 1300.