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

freertos & logging

Hi All,

I would like to use FreeRTOS in my project. I try to play with the examples/ble_peripheral/ble_app_hrs_freertos project.

I have enabled logging with RTT. The program is working well, I can connect with JLinkRTTClient and I have seen log messages. And when I try to logging in a task ble_stack_thread function for example the first line of function:

NRF_LOG_INFO("Task started\r\n");

it goes to HardFault_c_handler with address 0x20002db8. When I comment this log messages it works well.

It seems to be some problem with FreeRTOS and logging.

I changed port_cmsis_systick.c as suggested here: devzone.nordicsemi.com/.../

I use Debian Linux/Eclipse and SDK version is: nRF5_SDK_12.3.0_d7731ad

thnx Zamek

  • HI Zamek, could you test this with the latest release of the SDK, i.e. SDK v14.0.0 and see if this is still an issue?

  • Hi Bjorn,

    I downloaded the nRF5_SDK_14.0.0_3bcc1f7, but in this example contains only one task, which is the logging task:( The ble funcionality doesn't run in a task. It should be good. And I make a new task like this:

    #if NRF_LOG_ENABLED
        // Start execution.
        if (pdPASS != xTaskCreate(logger_thread, "LOGGER", 256, NULL, 1, &m_logger_thread))
        {
            APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
        }
    #endif
    
        if (pdPASS != xTaskCreate(alive_thread, "alive", 256, NULL, 1, &m_alive_thread))
        {
        	APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
        }
    

    and the task code is like this:

    static void alive_thread(void *arg)
    {
    	UNUSED_PARAMETER(arg);
    	int i=0;
    	for(;;) {
    		bsp_board_led_invert(BSP_BOARD_LED_2);
    		vTaskDelay(500);
    		if (++i<10)
    			continue;
    		i=0;
    		NRF_LOG_INFO("tick\r\n");
    	}
    }
    

    Unfortunately I got the next message in serial console:

    <error> nrf_sdh_freertos: SoftDevice task not created.
    <error> app: Fatal
    

    I used make flash_softdevice and make flash.

    thx, Zamek

Related