STM32G070 Enters Hard Halt Mode During Protobuf Decoding - Seeking Assistance

37 views
Skip to first unread message

Pedro Kuusberg

unread,
Oct 9, 2023, 1:45:53 PM10/9/23
to nanopb

Hello NanoPB Community,

I'm dealing with an issue concerning protobuf decoding using NanoPB and am hoping to gain insights from this knowledgeable community.

Background Information:

  • Microcontroller: STM32G070
  • NanoPB Version: 3.14
  • RTOS: CMSIS-RTOS2
  • Processor: ARM Cortex M0+

Setup:

  • Task 1: Engages in the creation and encoding of protobuf messages.
  • Task 2: Designed to receive and decode messages.

Issue: The microcontroller exhibits a hard halt during decoding in Task 2, noticeably with the specified message:

  • Message Example:
    • Status: 1
    • Length: 16
    • Content: 0x08 0x01 0x10 0x02 0x18 0x00 0x22 0x08 0x0A 0x06 0x0A 0x04 0x08 0x01 0x20 0x03
  • Stack Size: 380

Observations:

  • Task 1 proceeds without issues in message creation and encoding.
  • The hard halt arises during decoding in Task 2.

Seeking Insights:

  • Have similar hard halts been experienced by others using STM32G0 series microcontrollers during NanoPB decoding?
  • Are there identifiable pitfalls in decoding messages within an RTOS environment?
  • Can specific debugging tools or strategies be recommended for this scenario?

I truly appreciate any guidance or shared experiences that you might provide to assist in resolving this matter.

Warm regards, Pedro Kuusberg

Petteri Aimonen

unread,
Oct 10, 2023, 1:12:16 AM10/10/23
to nan...@googlegroups.com
Hi,

My first guess would be a stack overflow.
You could try increasing task 2 stack size to test whether that makes a difference.

Other than that, basic hardfault debugging should lead you to the cause.
First check backtrace and values after the crash to see if that gives any clues.
After that, set a breakpoint somewhere before the crash point and step instruction-by-instruction
until the crash, to see what is the faulting instruction (stepi and display /i $pc in gdb).

--
Petteri
Reply all
Reply to author
Forward
0 new messages