Identifying a High-Frequency ISR in SystemView

I started analyzing my application using SystemView to try to resolve a bug. I think I have configured everything correctly. However, when I start the analysis, I notice that an ISR is being called periodically every 61 microseconds, significantly occupying the CPU. Initially, I thought it was the Zephyr RTOS tick, but since it occurs every 120 microseconds, I ruled out that possibility. Could it be related to the BLE stack?

  1. How can I determine which ISR it is? Is it possible to assign names to ISRs when tracing?
  2. Why don't I see the Zephyr RTOS tick ISR?

Am I perhaps acquiring the data incorrectly?

UPDATE: I also noticed that if I enable tracing

CONFIG_TRACING=y
CONFIG_SEGGER_SYSTEMVIEW=y

the function bt_scan_start() in my application returns the error -EAGAIN due to the BT_DEV_READY flag never being set. Even if I put a loop to wait for it to be set

while ( bt_is_ready() == false )
{
    k_sleep( K_MSEC( 100 ) );
}

ret = bt_scan_start( BT_SCAN_TYPE_SCAN_ACTIVE );

if ( ret != 0 )
{
    LOG_WRN( "bt_scan_start (err %d)", ret );
	return SYSTEM_ERROR;
}

I never exit the loop. By running some tests, I discovered that it's as if BLE is never activated. In the BLE initialization, I have:

void Ble_Connection_Ready( int err )
{
    if ( err )
    {
        return;
    }

    k_sem_give( &bluetoothReady );
}

[...]

if ( bt_enable( Ble_Connection_Ready ) != 0 )
{
	return SYSTEM_ERROR;
}

if ( k_sem_take( &bluetoothReady, K_SECONDS( 10 ) ) != 0 )
{
    return SYSTEM_ERROR;
}

And the k_sem_take() always fails because BLE is never enabled cause the Ble_Connection_Ready( int err ) returns error -105 (ENOBUFS). However, if I disable tracing, everything works as expected. Below is my prj.conf.

################################################
### SYSTEM CONFIGURATION #######################
################################################
CONFIG_LOG=y
CONFIG_LOG_MAX_LEVEL=2
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_FPU=y
CONFIG_RING_BUFFER=y
CONFIG_ZCBOR=y
CONFIG_ZCBOR_STOP_ON_ERROR=y
# CONFIG_DISABLE_FLASH_PATCH=y
CONFIG_EVENTS=y
CONFIG_KERNEL_BIN_NAME="cruise_dongle"
CONFIG_TRACING=y
CONFIG_SEGGER_SYSTEMVIEW=y

################################################
### SOC'S PERIPHERALS CONFIGURATION ############
################################################
CONFIG_GPIO=y
CONFIG_PWM=y
CONFIG_LED=y
CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y
CONFIG_UART_0_NRF_HW_ASYNC=y
CONFIG_UART_0_NRF_HW_ASYNC_TIMER=1

################################################
### BLE CONFIGURATION ##########################
################################################
CONFIG_BT_MAX_CONN=8
CONFIG_BT=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_SMP=y
CONFIG_BT_DFU_SMP=y
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_SCAN=y
CONFIG_BT_SCAN_FILTER_ENABLE=y
CONFIG_BT_SCAN_CONN_ATTEMPTS_FILTER=y
CONFIG_BT_SCAN_CONN_ATTEMPTS_FILTER_LEN=6
CONFIG_BT_SCAN_CONN_ATTEMPTS_COUNT=2
CONFIG_BT_SCAN_UUID_CNT=3
CONFIG_BT_GATT_DM=y
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_ATT_PREPARE_COUNT=2
# CONFIG_BT_L2CAP_TX_BUF_COUNT=10
CONFIG_BT_L2CAP_TX_MTU=498
# CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_CONN_TX_MAX=10
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_BUF_ACL_TX_SIZE=502
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_RX_BUFFERS=2
CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=4000000

CONFIG_BT_USER_DATA_LEN_UPDATE=y
CONFIG_BT_USER_PHY_UPDATE=y

################################################
### NVS MEMORY CONFIGURATION ###################
################################################
CONFIG_NVS=y

################################################
### FLASH MEMORY SUPPORT CONFIGURATION #########
################################################
CONFIG_FLASH=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_FLASH_PAGE_LAYOUT=y

  • I ran some tests and discovered that the new error is still caused by the call to the bt_hci_cmd_send_sync function (this time in the hci_vs_init function), which returns ENOBUFS. So, I further increased the value of CONFIG_BT_BUF_CMD_TX_COUNT=20. This time, I didn’t get any errors. However, the problem is that when I try to establish a Bluetooth connection, the application freezes. At this point, I tried the modification in kernel.h that you posted, removing the previous configurations and leaving only that change

    CONFIG_TRACING=y
    CONFIG_SEGGER_SYSTEMVIEW=y
    
    # CONFIG_BT_BUF_EVT_RX_COUNT=20
    # CONFIG_BT_BUF_EVT_RX_SIZE=255
    # CONFIG_BT_BUF_CMD_TX_COUNT=20
    # CONFIG_BT_BUF_CMD_TX_SIZE=255
    # CONFIG_BT_RX_STACK_SIZE=2048
    # CONFIG_BT_HCI_TX_STACK_SIZE=2048

    Now, everything seems to be working. Are there any downsides to keeping this modification in kernel.h? Thanks a lot!

    Regarding the ISR from my initial question, I’ve filtered it for now, but it’s still present. I’ll look into it further, but for now, I can manage.

Related