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

FreeRTOS with RTT

I am building the ble_app_hrs_freertos example code for a pca10040 dev board located in the SDK 12.2 at: nRF5_SDK_12.1.0_0d23e2a/examples/ble_peripheral/ble_app_hrs_freertos

I have the following 2 RTT macros define:

Makefile - NRF_LOG_USES_RTT=1 sdk_config.h - NRF_LOG_BACKEND_SERIAL_USES_RTT 1

I get the RTT logs through the debugger for a bit and then hit a hard_fault. I have no problems with RTT for non-FreeRTOS builds. Anyone have success with RTT logging within a FreeRTOS build?

  • I did, But I faced few problems if the logs are too long and too frequent. The hardfault could be due to the RTOS timer inaccuracy. Try the patches mentioned in this thread and see if this problem gets solved. It worked for me.

  • Thanks for the suggestion Aryan.

    I built the example project with the port_cmsis_systick.c you provided and applied the vTaskStepTick.patch as well. I am using SDK 12.1 targeting a PCA10040 board. I still receive the hard fault after several seconds even without NRF_LOG enabled. I'll look at the FreeRTOS configuration a bit more. ~ Thanks

  • Are you using GCC? could you upload some files to help me replicate this problem. If i can see this on my desk, i can try to debug and will be able to help you faster.

  • I am using the quarterly released gcc compiler gcc-arm-none-eabi-5_4-2016q2.

    I just updated from 12.1 to 12.2 sdk and tried building and running ble_app_hrs_freertos example. The only change I made was to enable RTT in sdk_config.h

    #ifndef NRF_LOG_ENABLED #define NRF_LOG_ENABLED 1 #endif

    This routes NRF_LOG message to a UART console. This build looks to run fine if I use the make file as provided. If I disable optimizations (change -O3 to -O0 in the makefile) I see hardfaults again.

    APP:INFO:Fast Adverstising
    HARDFAULT:ERROR:Hardfault PC:597

    I also applied changes to port_cmsis_systick,c and applied the vTaskStepTick.patch and get the same Hardfault.

    Thanks

  • Hi please try again with below attachment. remove the directory SDKx\external\freertos and unzip freertos.rar to SDKx\external

    There were some timing issues fixed that are not yet released, and i think it will fix your issue. If this does not work, then let me know.

1 2