Softdevice example extension

Hallo,

I'm using Segger Embedded Studio to program nRF52840. In the Nordic nRF5_SDK there is the ble_app_uart example using S140 softdevice, which is running well. Now I have a dev kit from SEEED for WM1110. The software is included in the SDK according the descriptions at SEEED's wiki, the LoRaWAN example is also running well.

Now I want to integrate both examples. As recommended several times in the forum, I started with the softdevice example. I managed to include the files from the LoRaWAN example including paths, preprocessor directives etc., all files are compiling without errors. But the linker listed a number of errors.

The first error (just as an example) names multiple definitions of the RTC1_IRQHandler, which is defined in drv_rtc.c. When searching for "RTC1_IRQHandler" in the whole solutions, I have exactly identical outputs for the LoRaWAN example and my newly created combined application. The only conclusion regarding the error source seems the softdevice, which might include another definition of the handler.

How can I solve such issues? Is there any description, what files or configurations exactly are included in the softdevices (I found functional descriptions only)?

Kind regards

Axel

Parents
  • Hi Axel, 
    Please show the error log. 

    Are you saying that in the combined application if you do a full search you only see it's defined in drv_rtc.c but you still see the multiple definitions error ? 

    The softdevice doesn't use RTC1. You can see the list here: https://www.nordicsemi.com/Products/Development-software/S140

  • Hallo,

    at first: I can't find a log file as well as a place to switch it on.

    Meanwhile I'm a little confused, mainly about the config file. There are two section, which might be relevant. One is the NRFX_RTC_ENABLED (incl. RTC0/RTC1/RTC2), the other one is the RTC_ENABLED (incl. RTC0/RTC1/RTC2). What is the difference, which one should be used for which setting?

    In my LoRa example, RTC_ENABLED, RTC1_ENABLED and RTC2_ENABLED are set to 1, additionally NRFX_ENABLED is set to 1, but the single NRFX_RTCx_ENABLED are 0. Compiling and running is ok.

    In my ble_uart example, all the NRFX_RTC_ENABLED or RTC_ENABLED values are 0. Therefore, there should be no conflict when switching them on. But this leads to a "multiple definitions" error, as described.

    Furthermore, I wonder about nrfx_rtc.c. At the end of that file (lines 227, 334, and 341) there are checks for NRFX_RTCx_ENABLED. I see the lines following the NRFX_RTC0_ENABLED check grayed, but the lines following NRFX_RTC1_ENABLED and NRFX_RTC2_ENABLED check in black, i.e. the first one is 0, but the others are 1. As mentioned, in my config file all these settings are 0. When searching within the whole SDK directory, a definition of NRFX_RTCx_ENABLED signals to 1 is only done within the templates, which I don't use. But where else do these check results come from?

    The preprocessor definitions include APP_TIMER_V2_RTC1_ENABLED, which comes from the ble_uart example. But even this definition doesn't explain the positive check of NRFX_RTC2_ENABLED.

    Kind regards

    Axel

  • Hi Axel, 
    What I meant is to post the full error log where you see "multiple definitions of the RTC1_IRQHandler". You can just copy and paste the whole error you see on the screen. 


  • no problem:

    Output/Debug/Obj/ble_app_uart_pca10056_s140/nrfx_rtc.o: in function `RTC1_IRQHandler':

    multiple definition of `RTC1_IRQHandler'; Output/Debug/Obj/ble_app_uart_pca10056_s140/drv_rtc.o:/home/adminhtw/nRF5_SDK_17.1.0_ddde560/components/libraries/timer/drv_rtc.c:355: first defined here

    nrfx_rtc.c as well as drv_rtc.c are compiled without errors or warnings.

    Kind regards

    Axel

  • Hi Axel, 
    The issue is that for some reason you are enabling RTC1 for both nrf_rtc.c and drv_rtc.c 
    Please double check that you don't have NRFX_RTC1_ENABLED and APP_TIMER_V2_RTC1_ENABLED
    They can be defined in the preprocessor symbol in addition to sdk_config.h


    You can take a look here: Symbol RTC1_IRQHandler multiply defined (by port_cmsis_systick.o and drv_rtc.o). 

  • Hi Hung Bui,

    I have APP_TIMER_V2_RTC1_ENABLED in the preprocessor definitions, which comes from the ble_uart example. NRFX_RTC1_ENABLED I don't use.

    In the posting you mentioned I read that the softdevice is using RTC0. When my LoRa example is using RTC1 and RTC2 that means I have no chance to unite my LoRa example and the ble_uart example due to the fact that the ble_uart example also needs RTC1.

    I my opinion a lot of confusion (not only in my case, also for many others who want to integrate two examples) comes from issues, which seems to be a kind of doubling. I my case, I can config some parts by means of sdk_config.h and also by means of preprocessor definitions. Why? There are two files nrfx_rtc.c and drv_rtc.c, which do obviously at least partly the same thing. Where is the difference between them, when I have to use which file, or which example is using this or that file for what reason?

    I'm quite sure that there are a few more such issues, and I don't understand why.

    Kind regards

    Axel

  • Hi Hung Bui,

    it seems that drv_rtc.c is an somehow outdated driver version and nrfx_rtc.c is the actual one. A description of the migration procedure from old versions to new ones we found at https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.0.2/page/nrfx_migration_user_guide.html. There is also mentioned that the old drivers for clock, power, and rng can't be migrated due to their complex dependencies.

    Knowing these issues, it is extremely pity that in Nordic's examples a number of old drivers are used. It would be nice to have examples with the actual versions, especially in case of merging these examples with other ones using the new driver versions.

    Is there a chance to have the examples updated in next versions of the SDK? For people starting with nRF programming, it seems not wise to use outdated drivers at first. Confusion and frustration might follow...

    Kind regards

    Axel

Reply
  • Hi Hung Bui,

    it seems that drv_rtc.c is an somehow outdated driver version and nrfx_rtc.c is the actual one. A description of the migration procedure from old versions to new ones we found at https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.0.2/page/nrfx_migration_user_guide.html. There is also mentioned that the old drivers for clock, power, and rng can't be migrated due to their complex dependencies.

    Knowing these issues, it is extremely pity that in Nordic's examples a number of old drivers are used. It would be nice to have examples with the actual versions, especially in case of merging these examples with other ones using the new driver versions.

    Is there a chance to have the examples updated in next versions of the SDK? For people starting with nRF programming, it seems not wise to use outdated drivers at first. Confusion and frustration might follow...

    Kind regards

    Axel

Children
  • Hi Axel, 
    It was a little bit messy I agree. The nRF5 SDK has unfortunately discontinue 4 years ago. We don't have further development on this SDK since then. 

    Since the timer is not a very complex peripheral, my suggestion is to try adapting the driver/application to use nrfx_rtc.c instead of drv_rtc.c.

    I'm not so sure if the ble_uart uses rtc, could you show that in the code ? 

    axel_s said:
    I can config some parts by means of sdk_config.h and also by means of preprocessor definitions. Why?

    Its just how it is. You can configure the definition in both preprocessor and sdk_config.h. The preprocessor definition is more chip dependent where the sdk_config.h is more application dependent. 

Related