ESP32 restart on mechanical shock

Hi

I have a project to measure velocity of door. So a have a Wemos ESP32 D1 Minikit connected to a GY-571 giroscope.
The circuit runs very nicely until a have velocities above certain value. From this values above the ESP32 just restart itself, with this reset message below:

21:03:52.969 ->
21:03:52.969 -> Stack smashing protect failure!
21:03:52.969 ->
21:03:52.969 -> abort() was called at PC 0x40149c6f on core 1
21:03:52.969 ->
21:03:52.969 -> Backtrace: 0x400927dc:0x3ffcc480 0x40092a0d:0x3ffcc4a0 0x40149c6f:0x3ffcc4c0 0x400d1acd:0x3ffcc4e0 0x400d2a16:0x3ffcc530 0x400d5061:0x3ffcc550 0x4008e6fd:0x3ffcc570
21:03:52.969 ->
21:03:52.969 -> Rebooting...
21:03:53.016 -> ets Jun 8 2016 00:22:57
21:03:53.016 ->
21:03:53.016 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
21:03:53.016 -> configsip: 0, SPIWP:0xee
21:03:53.016 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
21:03:53.016 -> mode:DIO, clock div:2
21:03:53.016 -> load:0x3fff0018,len:4
21:03:53.016 -> load:0x3fff001c,len:1100
21:03:53.016 -> load:0x40078000,len:9232
21:03:53.016 -> load:0x40080400,len:6412
21:03:53.016 -> entry 0x400806a8

After some tracing it was clear that ESP32 resets during the

SerialBT.print(txMsg);

instruction. AND it occurs (the restart) only when bluetooth module is PARIED with my phone (running the master app). I already change the battery used by USB powering.

Uhh... I forgot to say that the restart occurs when the door (where ESP32 is attached to) knocks...

Did anybody see something like this?
Any help will be great.

Gustavo

From this the "Stack smashing protect failure!" sounds related to an overflow. Which might happen is you somewhere in your code try to put that large value into a to small spot. Just cropping will happen when you try to put an int into a byte for example. But things get different when you convert your value to text for example. You need more room for "10003449934" compared to "123".

Running freeRTOS, I'd move the suspected task to the other core to see if the issue follows.

I have an ESP32 on the X axis of a X/Y stabilized platform with the Z axis following a scanning route. The application starts off with a hard slam of the X/Y/Z axis during the magnetometer calibration. I do not experience resets during such movements.

Would you happen to be using a Adafruit library?