This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can I see some hidden log on Thingy:52 debug?

Hi all,

I'm working with 2.1.0 version of Thingy:52 firmware (the last version currently). Further I am working on Linux with SEGGER J-Link Commander V6.34c in order to debugging and programming Thingy:52. For this, I'm using nRF52840 DK connected to Thingy:52 by Debug Out port.

Currently I'm working on Thingy:52 accelerometer, so I want to see logs from accelerometer driver or lis3dh chip. Of course, I have set NRF_LOG_ENABLE to 1 on sdk_config.h, and I see others log messages, but none about accelerometer.

This is the log I can see:

main          :INFO:===== Thingy started! =====
m_env         :INFO:Init: 
m_motion      :INFO:Init 
m_sound       :INFO:Sound_init 
m_ble         :WARNING:Too few random bytes available. Trying again 
m_ble         :WARNING:Too few random bytes available. Trying again 
m_ble         :WARNING:Too few random bytes available. Trying again 
m_ble         :INFO:Available random bytes: 14 
m_ble         :INFO:Random value (hex): 422a20cf
m_ble_flash   :INFO:Initialization
m_ble_flash   :INFO:garbage collect success
m_ble_flash   :INFO:Loading configuration
m_ble         :INFO:m_ble: Current FW: v255.255.255 
m_env_flash   :INFO:Initialization
m_env_flash   :INFO:Loading configuration
m_env         :INFO:Init: ble_tes_init 
m_motion      :INFO:motion_service_init: ble_tms_init 
m_ui_flash    :INFO:Initialization
m_ui_flash    :INFO:Loading configuration
m_sound       :INFO:sound_service_init: ble_tss_init 
m_ble         :INFO:on_adv_evt: BLE_ADV_EVT_FAST
MAC addr-> cb:7f:32:b7:94:86 
m_ble         :INFO:nfc string: cb:7f:32:b7:94:86 422a20cf 
drv_nfc       :INFO:NFC total message size 256 bytes 
drv_nfc       :INFO:NFC used message size 117 bytes 
adv_beacon_...:INFO:app_beacon_init:
adv_beacon_...:INFO:app_beacon_start:
m_ui          :INFO:Mode: BLE_UIS_LED_MODE_BREATHE 
main          :INFO:Voltage: 3900 V, Charge: 71 %, Event type: 0 
main          :INFO:Voltage: 3890 V, Charge: 69 %, Event type: 0 
main          :INFO:Voltage: 3890 V, Charge: 69 %, Event type: 0 
main          :INFO:Voltage: 3900 V, Charge: 71 %, Event type: 0 
main          :INFO:Voltage: 3890 V, Charge: 69 %, Event type: 0 
main          :INFO:Voltage: 3900 V, Charge: 71 %, Event type: 0 
main          :INFO:Voltage: 3900 V, Charge: 71 %, Event type: 0 
main          :INFO:Voltage: 3900 V, Charge: 71 %, Event type: 0 
m_ui          :INFO:BLE connected
m_ui          :INFO:Mode: BLE_UIS_LED_MODE_BREATHE 
m_ble         :INFO:on_ble_evt: BLE_GAP_EVT_CONNECTED
main          :INFO:Thingy_ble_evt_connected 
m_ble         :INFO:on_conn_params_evt: BLE_CONN_PARAMS_EVT_SUCCEEDED
m_ble         :INFO:on_ble_evt: BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST
m_ble         :INFO:on_ble_evt: BLE_GAP_EVT_DATA_LENGTH_UPDATE
m_ble         :INFO:on_conn_params_evt: BLE_CONN_PARAMS_EVT_SUCCEEDED
main          :INFO:Voltage: 3900 V, Charge: 71 %, Event type: 0 
main          :INFO:Voltage: 3900 V, Charge: 71 %, Event type: 0 
main          :INFO:Voltage: 3900 V, Charge: 71 %, Event type: 0 
main          :INFO:Voltage: 3890 V, Charge: 69 %, Event type: 0 
main          :INFO:Voltage: 3900 V, Charge: 71 %, Event type: 0 
main          :INFO:Voltage: 3890 V, Charge: 69 %, Event type: 0 
main          :INFO:Voltage: 3890 V, Charge: 69 %, Event type: 0 
m_motion      :INFO:ble_tms_evt_handler: BLE_TMS_EVT_NOTIF_GRAVITY - 1
main          :INFO:Voltage: 3890 V, Charge: 69 %, Event type: 0 
main          :INFO:Voltage: 3890 V, Charge: 69 %, Event type: 0 

Any ideas?

Thank you in advance,

Manuel Montenegro.

  • Hi Manuel,

    Add this in sdk_config.h.

    #define NRF_LOG_ENABLED 1
    
    #define NRF_LOG_DEFAULT_LEVEL 4

    Increase the NRF_LOG_DEFAULT_LEVEL to 4 to get out debug messages as you can see in "drv_motion.c":

    #if NRF_LOG_ENABLED
        void print_sensor_status(void)
        {
            long acc_bias[NUM_AXES];
            long gyr_bias[NUM_AXES];
            long mag_bias[NUM_AXES];
            int acc_accuracy;
            int gyr_accuracy;
            int mag_accuracy;
            
            inv_get_accel_bias(acc_bias, NULL);
            inv_get_gyro_bias(gyr_bias, NULL);
            inv_get_compass_bias(mag_bias);
            
            acc_accuracy = inv_get_accel_accuracy();
            gyr_accuracy = inv_get_gyro_accuracy();
            mag_accuracy = inv_get_mag_accuracy();
            
            NRF_LOG_DEBUG("Acc bias: ");
            NRF_LOG_DEBUG("X: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(acc_bias[0]));
            NRF_LOG_DEBUG("Y: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(acc_bias[1]));
            NRF_LOG_DEBUG("Z: "NRF_LOG_FLOAT_MARKER" \r\n", NRF_LOG_FLOAT(acc_bias[2]));
            
            NRF_LOG_DEBUG("Gyr bias: "); 
            NRF_LOG_DEBUG("X: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(gyr_bias[0]));
            NRF_LOG_DEBUG("Y: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(gyr_bias[1]));
            NRF_LOG_DEBUG("Z: "NRF_LOG_FLOAT_MARKER" \r\n", NRF_LOG_FLOAT(gyr_bias[2]));
    
            NRF_LOG_DEBUG("Mag bias: ");
            NRF_LOG_DEBUG("X: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(mag_bias[0]/(2^16)));
            NRF_LOG_DEBUG("Y: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(mag_bias[1]/(2^16)));
            NRF_LOG_DEBUG("Z: "NRF_LOG_FLOAT_MARKER" \r\n", NRF_LOG_FLOAT(mag_bias[2]/(2^16)));
    
            NRF_LOG_DEBUG("Accur: Acc: %d, gyr: %d, mag: %d \r\n", acc_accuracy, gyr_accuracy, mag_accuracy);
        }
    #endif

  • Thank you for your answer, Martin.

    That works, but not completely.

    Now, I can see all the DEBUG logs, but I think there are some kind of error (maybe a bug?) with Accelerometer, Gyroscope and Magnetometer logs.

    This is the log I can get. How you can see, the value field is empty:

    m_motion      :DEBUG:DRV_MOTION_EVT_RAW:
    m_motion      :DEBUG: accel.x [G's] = :
    m_motion      :DEBUG: accel.y [G's] = :
    m_motion      :DEBUG: accel.z [G's] = :
    m_motion      :DEBUG: gyro.x [deg/s] = :
    m_motion      :DEBUG: gyro.y [deg/s] = :
    m_motion      :DEBUG: gyro.z [deg/s] = :
    m_motion      :DEBUG: mag.x [uT] = :
    m_motion      :DEBUG: mag.y [uT] = :
    m_motion      :DEBUG: mag.z [uT] = :
    

    How ever, with other sensors I can get the values:

    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 353
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 1
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 8
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 11
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 14
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 10
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 15
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 20
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 28
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 36
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 43
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 48
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 52
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 58
    m_motion      :DEBUG:DRV_MOTION_EVT_HEADING [deg]:  h: 63
    

    Any idea about what is happening?

    Manuel Montenegro.

  • Hi Manuel,

    I just downloaded a fresh copy of the thingy SDK.

    1. Enabled nrf_log and sat the Log level to 4.

    2. Compiled and flashed this application, and connected (BLE) to the Thingy with nrf connect mobile.

    3. Turned on the "Thingy Raw Data Characteristic" in the motion service and got out this from the RTT log:

    (added .hex file:)app_thingy_s132.hex

  • Hi Martin. Sorry for waiting.

    I have followed exactly the steps you posted and that didn't work. Maybe the problem is with my terminal or my linux (linux mint 19).

    Thank you anyway,

    Manuel Montenegro

Related