We just started a project to replace an old PAN1720 and decided to use the nRF54L15 based module. So I am just getting started with the VS code and zephry enviroment using SDK v3.1.
I got the blinky example working, but now trying to use one of the timers to count edges on a port pin. Having issues with below code. The code compiles and flashes to the nrF54L15-DK board, but I get the below message from my jlink terminal when the init timer is called. Just starting out very basic to see if I can init a timer. I tried Timer 20 and timer 23 and both give the same result. I assume the function I am using is sending the wrong setup to the timer or the timer is not initialized. Any help would be appreciated.
Putty output from Jlink com port
*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
STEP: test timer init
nrfx_timer_init failed: 195887108
below is my main.c
I have tried different frequencies and interrupt priorities, but get the same results.
If I try setting it to 16MHz I get divide by zero errors.
I also show my other file contents as well below. These files have alot of left over stuff from hours of trying to get this to work.
#include <zephyr/kernel.h>
#include <nrfx_timer.h>
static const nrfx_timer_t my_timer = NRFX_TIMER_INSTANCE(20);
void main(void)
{
printk("STEP: test timer init\n");
nrfx_timer_config_t tcfg = {
.frequency = NRF_TIMER_FREQ_2MHz, // 1 MHz base clock
.mode = NRF_TIMER_MODE_TIMER,
.bit_width = NRF_TIMER_BIT_WIDTH_32,
.interrupt_priority = 6,
.p_context = NULL,
};
nrfx_err_t err = nrfx_timer_init(&my_timer, &tcfg, NULL);
if (err != NRFX_SUCCESS) {
printk("nrfx_timer_init failed: %d\n", err);
return;
}
nrfx_timer_enable(&my_timer);
while (1) {
k_msleep(500);
printk("Timer running...\n");
}
}
Overlay file
/ {
aliases {
rip-in = &rip_in0;
};
rip_in0: rip_in0 {
status = "okay";
};
};
/* Put phandle patches at top-level, not inside '/' */
&timer20 {
status = "okay";
};
&gpiote30 {
status = "okay";
};
/* Enable if you actually use DPPI later
&dppic00 {
status = "okay";
};
*/
# Console over UART CONFIG_PRINTK=y CONFIG_CONSOLE=y CONFIG_SERIAL=y CONFIG_UART_CONSOLE=y #Enable Float formating CONFIG_CBPRINTF_FP_SUPPORT=y # Logging over UART (optional but nice) CONFIG_LOG=y CONFIG_LOG_PRINTK=y CONFIG_LOG_BACKEND_UART=y # CONFIG_LOG_BACKEND_RTT is disabled below # Make sure RTT isn’t used for console/logs CONFIG_USE_SEGGER_RTT=n CONFIG_RTT_CONSOLE=n CONFIG_LOG_BACKEND_RTT=n # GPIO driver (this is the only one you need to set explicitly) CONFIG_GPIO=y CONFIG_NRFX_GPIOTE30=y # GPIOTE instance 30 on nRF54L05 (cpuapp) CONFIG_NRFX_TIMER20=y # TIMER instance 20 # "no prompt" warning, just delete this line) #CONFIG_NRFX_DPPI=y
