2
\$\begingroup\$

Im looking for a way in which the program can log specific errors/conditions(user-defined) as and when such conditions occur, and while the code is running I can give command to read it and interpret it in a readable format such a .txt or .xls etc.

What I have thought so far is implementing something like this in my code:

  1. Create a circular buffer

  2. When a specific error occurs, write the details into the circular buffer Create a routine that always monitors for a request over UART(or any other comm port)

  3. When request is received, send the data over the Comm port. Interpret and populate the received data into a excel sheet(maybe using python).

Are there any other better ways I can create a Trace Log?

Is there a way such that even when an error occurs, and the code is stuck, I wont be dependent on the code functionality to read the Trace buffer entries(so that I can analyze at what point in code flow the code got stuck)

\$\endgroup\$
  • 1
    \$\begingroup\$ What you are thinking is good enough. If available, you should store these logs in non-volatile memory So that it will remain safe. If your code is stuck somewhere, use watchdog so it will reset and most controllers provide a register for "Reset reason". You can read that on Start up and log it \$\endgroup\$ – Swanand Sep 8 '17 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.