Well, first of all, if you are utilizing BLE stack, search for halAssertHandler function in the code and set
a breakpoint on either HAL_SYSTEM_RESET(), halAssertHazardLights(), or while(1)... depends on
your compilation options.
When you say your device gets "locked up" are you sure it's not keep on operating?
What are the symptoms of this "lock up"?