TIMER20 driver instance missing dependency

I need to use a nrfx timer in order for some GPIO timing, but can't get past the simple examples declaring an instance. For testing I'm just using the 54L15DK.

I was using this ticket as a reference https://devzone.nordicsemi.com/f/nordic-q-a/119686/timers/527148 and the github example modified for 54L15

For starters the included <nrfx_example.h> bombs out with "unknown device" because it's checking for nRF52/53/91 series... So OK, let's just comment out that #include and the logging for now.

Now the prj.conf line CONFIG_NRFX_TIMER20=y causes an error with missing driver instance.

The 54L15DK doesn't appear to have it enabled, so I added this overlay to by build

&timer20 {
    status = "okay";
};

..and timer20 is shown in the DT graphical editor

What's missing?

A second part to this question: Can I use DT lookup to get the timer instance - the code currently does this:

   nrfx_timer_t timer_inst = NRFX_TIMER_INSTANCE(TIMER_INST_IDX);

This is so I can use aliases to refer to the timer as I want the same code to run on nRF52 & nRF54L devices.

Thanks.

Parents
  • Hi Nick_RA,

    CONFIG_NRFX_TIMER20 only depends on the existence of the node timer20 in DeviceTree, with the appropriate compatible property. Whether the node is disabled or enabled doesn't matter, because the nrfx drivers configure the registers directly, unlike Zephyr drivers, which are designed to work with DeviceTree.
    That means you don't have to do anything to use CONFIG_NRFX_TIMER20.

    How did you build your project? You mentioned wanting to keep cross compatibility with a nRF52 project. Could you be compiling for a nRF52 target?

    It is possible to maintain one code base for both nRF52 and nRF54L, but you will need to have some separate board overlay files.

    I also would like to note that, by default, TIMER20 is used by the Multiprotocol Service Layer (MPSL) in projects with wireless functionality like BLE or Matter. Therefore, you should choose another TIMER instance, like TIMER21.

    For reference, here is the hello_world sample where I just put CONFIG_NRFX_TIMER20=y in, and it works.

    c350910-250904_01.zip

    Hieu

  • For reference, here is the hello_world sample where I just put CONFIG_NRFX_TIMER20=y in, and it works.

    OK, so I started afresh with a new hello_world project and copied the code over and it works. So something screwy with that particular project I guess. 

    This isn't my actual project; because this ecosystem is new to me when starting something new I just start with hello_world to get it going then write it into my code when I'm happy with it, but rather than create loads of mini test projects I normally just CTRL-A / DELETE and start again so something has obviously gone a bit awry.

    CONFIG_NRFX_TIMER20 only depends on the existence of the node timer20 in DeviceTree, with the appropriate compatible property. Whether the node is disabled or enabled doesn't matter, because the nrfx drivers configure the registers directly, unlike Zephyr drivers, which are designed to work with DeviceTree.
    That means you don't have to do anything to use CONFIG_NRFX_TIMER20.

    Well, it's needed for sure. I haven't delved into the macros but the line

     nrfx_timer_t timer_inst = NRFX_TIMER_INSTANCE(TIMER_INST_IDX);

    doesn't compile without CONFIG_NRFX_TIMER20

    How did you build your project? You mentioned wanting to keep cross compatibility with a nRF52 project. Could you be compiling for a nRF52 target?

    This was using 54L15DK/54L15/CPUAPP. Yes, I do need to maintain compatibility with another board using nRF52832 so I have separate builds and configs where I'll be storing the timer instances.

    I also would like to note that, by default, TIMER20 is used by the Multiprotocol Service Layer (MPSL) in projects with wireless functionality like BLE or Matter. Therefore, you should choose another TIMER instance, like TIMER21.

    Noted, thanks (I hadn't got that far yet!), but please note I was starting from an earlier support article linked in my original post. Maybe someone needs to look at and amend that post & github code...

Reply
  • For reference, here is the hello_world sample where I just put CONFIG_NRFX_TIMER20=y in, and it works.

    OK, so I started afresh with a new hello_world project and copied the code over and it works. So something screwy with that particular project I guess. 

    This isn't my actual project; because this ecosystem is new to me when starting something new I just start with hello_world to get it going then write it into my code when I'm happy with it, but rather than create loads of mini test projects I normally just CTRL-A / DELETE and start again so something has obviously gone a bit awry.

    CONFIG_NRFX_TIMER20 only depends on the existence of the node timer20 in DeviceTree, with the appropriate compatible property. Whether the node is disabled or enabled doesn't matter, because the nrfx drivers configure the registers directly, unlike Zephyr drivers, which are designed to work with DeviceTree.
    That means you don't have to do anything to use CONFIG_NRFX_TIMER20.

    Well, it's needed for sure. I haven't delved into the macros but the line

     nrfx_timer_t timer_inst = NRFX_TIMER_INSTANCE(TIMER_INST_IDX);

    doesn't compile without CONFIG_NRFX_TIMER20

    How did you build your project? You mentioned wanting to keep cross compatibility with a nRF52 project. Could you be compiling for a nRF52 target?

    This was using 54L15DK/54L15/CPUAPP. Yes, I do need to maintain compatibility with another board using nRF52832 so I have separate builds and configs where I'll be storing the timer instances.

    I also would like to note that, by default, TIMER20 is used by the Multiprotocol Service Layer (MPSL) in projects with wireless functionality like BLE or Matter. Therefore, you should choose another TIMER instance, like TIMER21.

    Noted, thanks (I hadn't got that far yet!), but please note I was starting from an earlier support article linked in my original post. Maybe someone needs to look at and amend that post & github code...

Children
  • Nick_RA said:
    OK, so I started afresh with a new hello_world project and copied the code over and it works. So something screwy with that particular project I guess. 

    Right... it unfortunately seems so. Usually this happens when custom board files are being used, and a mistake was made where the timer20 definition isn't correctly included or recreated.

    However, the fact that you could refer to it by using &timer20 suggests that the node is indeed available, in which case, it should satisfy the only dependency for CONFIG_NRFX_TIMER20.

    Nick_RA said:
    CONFIG_NRFX_TIMER20 only depends on the existence of the node timer20 in DeviceTree, with the appropriate compatible property. Whether the node is disabled or enabled doesn't matter, because the nrfx drivers configure the registers directly, unlike Zephyr drivers, which are designed to work with DeviceTree.
    That means you don't have to do anything to use CONFIG_NRFX_TIMER20.

    Well, it's needed for sure. I haven't delved into the macros but the line

    nrfx_timer_t timer_inst = NRFX_TIMER_INSTANCE(TIMER_INST_IDX);

    doesn't compile without CONFIG_NRFX_TIMER20

    Could this be a hint towards what is wrong? Refer to the dependency definition I linked above, NRFX_TIMER20 only needs the node to be presented. It doesn't need it enabled.
    The project I attached in my last reply should also be able to prove that.

Related