'NRF_RTC2' undeclared

Hello,

I am trying to port a project from the NRF52840 DK to a custom board where I am using the NRF52820. The code compiles fine when the project is using the settings for NRF52840 but when I adjust the settings under 'Code generation' to match that of the NRF82820 it complains that NRF_RTC2 is undeclared which it first comes across in nrfx_rtc.h at:

#define NRFX_RTC_INSTANCE(id)                                   \
{                                                               \
    .p_reg            = NRFX_CONCAT_2(NRF_RTC, id),             \
    .irq              = NRFX_CONCAT_3(RTC, id, _IRQn),          \
    .instance_id      = NRFX_CONCAT_3(NRFX_RTC, id, _INST_IDX), \
    .cc_channel_count = NRF_RTC_CC_CHANNEL_COUNT(id),           \
}

I suspect this has to do with the fact that NRF52840 has three real time counters while 52820 only has two, but I don't understand how I can work around this problem. I am not enabling RTC2 in the config file. Any ideas? Thank you.

  • Thanks a lot for the pointers.

    The reason to why I brought up the UART is because I saw that the CLI library that I am using indeed did have something to do with it - after completely disabling it in the config file and removing the relevant code, the compiler kept giving me the same RTC1_IRQHandler error so I figured maybe it was the UART itself. 

    I'm a bit confused as to why it isn't already working though since the additional RTC in the NRF52840 (again, I have one less RTC in the NRF52820) was used by a file called "counter.c" that can be found in the throughput example - I have however removed this dependency and thus should have enough RTCs for the remaining code. Would you agree? 

  • Yes, sounds like it should be fine as long as you have removed any modules using the last RTC instance. What exactly is not currently working? Did you manage to compile the project successfully? 

  • No, the code does not compile unfortunately.

    The problem is the same as before: "multiple definition of `RTC1_IRQHandler'; Output/Release/Obj/ble_transmit_SPI_52820/drv_rtc.o: nRF5_SDK_17.1.0_ddde560\components\libraries\timer/drv_rtc.c:354: first defined here"

    And this is after removing the CLI as well! Not really sure what to look for anymore. Would it be possible for you to take a look? 

  • Looks like this is from app_timer/app_timer's RTC driver. Do you not see the line above this indicating the first occurrence of the multiple definitions, as shown in my image above?

    Can you upload the full project? Then I can help you determine where the issue lays. If you do not want to post the project in public, I can convert the ticket to private.

  • The line above states "ProjectPath/nrfx_rtc.o: in function `RTC1_IRQHandler':"

    I'd prefer uploading it privately if that is OK! You'd have to tell me how to though

Related