Using Notecard Trace Mode
All Notecards can be placed into trace mode. When enabled, a Notecard's trace mode generates a stream of messages that can help with debugging or understanding Notecard behavior.
You can utilize trace mode using:
Trace output is emitted only over the USB serial port or Notecard's AUX
RX/TX serial port. It is not sent over the I2C bus, and it is not
sent over the primary N_RX/N_TX serial pins that a host normally uses.
{"req":"card.trace","mode":"on"} enables trace on the port the request
arrived on, and only when that port is USB or AUX.
Notecard's trace mode is available for debugging purposes only. The format of the output is not standardized and is subject to change at any time. If you need help interpreting a Notecard's trace output to debug an issue, reach out in our community forum or contact Blues support.
In-Browser Terminal
Complete the following steps to use trace mode via the In-Browser Terminal.
-
Visit the In-Browser Terminal.
-
Enable trace mode with the following request:
{"req":"card.trace","mode":"on"} -
Perform actions that you want to debug. For example, to debug network connectivity issues you may wish to run a
hub.syncrequest.{"req":"hub.sync"} -
Disable trace mode with the following request:
{"req":"card.trace","mode":"off"} -
(Optional) Download the trace log using the Save History button (the download icon) in the top-right corner of the Terminal. This will download the contents of the Terminal history to a
.logfile.
Serial Terminal Apps
Complete the following steps to use trace mode via a serial terminal app.
-
Connect a Notecard to your serial terminal app using one of the following serial port configurations.
Connection Serial Configuration Abbreviated USB Any baud rate, 8 bit, no parity, 1 stop bit 8N1 AUX RX/TX Baud Rate: 115200, 8 bit, no parity, 1 stop bit 115200 8N1 note
Refer to our guides on using Tera Term and CoolTerm for more specific instructions on connecting to Notecard via those applications:
-
Enable trace mode with the following request:
{"req":"card.trace","mode":"on"} -
Perform actions that you want to debug. For example, to debug network connectivity issues you may wish to run a
hub.syncrequest.{"req":"hub.sync"} -
Disable trace mode with the following request:
{"req":"card.trace","mode":"off"}
_log Environment Variable
You can remotely enable diagnostic logging at the device, fleet, or project
level using the _log
reserved environment variable.
When enabled, this will save trace logs to the _log.qo Notefile on Notehub.
Please note that the trace logs saved to Notehub using this method are far less
verbose than the logs you can generate using the other methods outlined above.
Saving and syncing logging data with Notehub will impact your cellular data allocation. To avoid unnecessary usage, enable this feature only when required and disable it immediately afterward.
-
Set the
_logenvironment variable. To enable logging remotely, set it at the device, fleet, or project level in the Notehub UI or with the Notehub API. If you have local access to your Notecard, you can also set it withenv.default. -
When setting the variable, use one of the following values to specify the scope of the logging data to save:
gps(to save high-level GPS status information)gpsmax(to save more verbose GPS logging)power(to save power-usage snapshots from a connected Mojo)modem(to save modem lifecycle and network state transitions)accel(to save accelerometer/motion-detection activity)onor1(shorthand forgps,modem,power)all(to save broader diagnostic data)0or an empty value (to disable logging)
To capture more than one scope at a time, separate the values with a comma or semicolon (for example,
gps,modem). -
Note that
_log.qoNotes never trigger a sync of their own, so that logging doesn't drain a battery-powered device. Notes are written when the event occurs but stay queued on-device until the next sync happens. -
When finished gathering trace log data, be sure to delete these environment variables to silence logging and avoid unnecessary data usage.