The RTT log crashes frequently

Dear:

  I am useing NCSv2.6.0 version.On the basis of my project, adding RTT printing of Bluetooth scan packet and scan response packet will frequently appear Log crash.

  The following is the crash information

  00> [00:07:11.561,035] <inf> app: Filters matched. Address: F6:17:78:AB:28:49 (random) connectable: 1
00>
00> [00:07:11.637,664] [1;31m<err> os: r0/a1: 0x00000004 r1/a2: 0x0000007d r2/a3: 0x00000000
00> [00:07:11.637,664] [1;31m<err> os: r3/a4: 0x000386d5 r12/ip: 0x0002c291 r14/lr: 0x00029bf9[0m
00> [00:07:11.637,695] [1;31m<err> os: xpsr: 0x61000000[0m
00> [00:07:11.637,695] [1;31m<err> os: Faulting instruction address (r15/pc): 0x00043422
00> [00:07:11.637,756] [1;31m<err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0[0m
00> [00:07:11.637,786] [1;31m<err> os: Current thread: 0x20002548 (logging)[0m
00> [00:07:21.406,677] [1;31m<err> fatal_error: Resetting system
00> [00:00:00.004,821] <inf> app: The resume reason: 0x00000004, 0x0

 Here is prj.conf

# Config logger
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n
CONFIG_LOG_PRINTK=n
CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=2048
CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=2048
CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS=100
CONFIG_LOG_BUFFER_SIZE=4096
CONFIG_LOG_MODE_OVERFLOW=y
CONFIG_LOG_BACKEND_RTT_MODE_DROP=y
CONFIG_LOG_BACKEND_RTT_MODE_BLOCK=n
CONFIG_LOG_MODE_DEFERRED=y
CONFIG_LOG_BACKEND_SHOW_COLOR=y
CONFIG_LOG_TIMESTAMP_64BIT=y
CONFIG_LOG_MEM_UTILIZATION=y
Add LOG_INF("Filters matched. Address: %s connectable: %d ",addr, connectable); This line of code will cause frequent Log crashes,Delete and it won't crash.
static void scan_filter_match(struct bt_scan_device_info *device_info,
                struct bt_scan_filter_match *filter_match,
                bool connectable)
{
    char addr[BT_ADDR_LE_STR_LEN];

    bt_addr_le_to_str(device_info->recv_info->addr, addr, sizeof(addr));

    LOG_INF("Filters matched. Address: %s connectable: %d ",addr, connectable);

    if(device_info->recv_info->adv_type == BT_GAP_ADV_TYPE_ADV_SCAN_IND)
    {
        // LOG_HEXDUMP_INF(device_info->adv_data->data,device_info->adv_data->len,"scan:");
    }
}
While monitoring the log buf space with a period of one second, it crashes when the value of buf_use starts to increase from 0 and exceeds buf_size.The value of buf_use is always 0 in normal operation.
void ptint_log_buff_size()
{
    log_mem_get_usage(&buf_size,&buf_use);
    log_mem_get_max_usage(&max_buf);
    pf_log_raw(1,"log buf size==========>>>>>>>>>>>>(%d|%d|%d|%d)",buf_size,buf_use,max_buf,log_buffered_cnt());
}
Here's how I rewrote the print
#define NCS_LOG_FLUSH()         while(log_process())
#define pf_log_raw(onoff, ...) do {if (onoff) {LOG_INF(__VA_ARGS__);NCS_LOG_FLUSH();}} while (0);
Please help to solve this problem
Thanks
Parents Reply Children
Related