Hello,
I`m trying to port a code sample from NCS 1.x.x to NCS 2.2.0 but I`m having issues with DPPI.
Please see conf and code bellow:
CONFIG_GPIO=y CONFIG_NRFX_TIMER1=y CONFIG_NRFX_GPIOTE=y
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/timing/timing.h>
#include <nrfx_timer.h>
#include <nrfx_dppi.h>
#include <nrfx_gpiote.h>
#include <helpers/nrfx_gppi.h>
/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)
#define LED0 DT_GPIO_LABEL(LED0_NODE, gpios)
#define PIN_LED0 DT_GPIO_PIN(LED0_NODE, gpios)
#define FLAGS_LED0 DT_GPIO_FLAGS(LED0_NODE, gpios)
static const nrfx_timer_t m_sample_timer = NRFX_TIMER_INSTANCE(1);
void timer_handler(nrf_timer_event_t event_type, void* p_context)
{
//Nothing here due to DPPI
}
static void timer_init(void)
{
nrfx_timer_config_t timer_config = NRFX_TIMER_DEFAULT_CONFIG;
timer_config.bit_width = NRF_TIMER_BIT_WIDTH_32;
nrfx_err_t err_code = nrfx_timer_init(&m_sample_timer, &timer_config, timer_handler);
if (err_code != NRFX_SUCCESS) {
printk("nrfx_timer_init error: %08x\n", err_code);
return;
}
nrfx_timer_extended_compare(&m_sample_timer,
NRF_TIMER_CC_CHANNEL0,
nrfx_timer_ms_to_ticks(&m_sample_timer, 500),
NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK,
true);
printk("Timer 1 initialized.\n");
nrfx_timer_enable(&m_sample_timer);
IRQ_CONNECT(TIMER1_IRQn, 0,
nrfx_timer_1_irq_handler, NULL, 0);
}
static void gpiote_init(void)
{
nrfx_gpiote_out_config_t led_pin_cfg = {0};
led_pin_cfg.action = NRF_GPIOTE_POLARITY_TOGGLE;
led_pin_cfg.init_state = NRF_GPIOTE_INITIAL_VALUE_HIGH;
led_pin_cfg.task_pin = true;
nrfx_err_t err = nrfx_gpiote_init(NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY);
if (err != NRFX_SUCCESS) {
printk("gpiote1 err: %x", err);
return;
}
err = nrfx_gpiote_out_init(PIN_LED0, &led_pin_cfg);
if (err != NRFX_SUCCESS) {
printk("gpiote1 err: %x", err);
return;
}
nrfx_gpiote_out_task_enable(PIN_LED0);
}
static void dppi_init(void)
{
uint8_t dppi_ch_1;
nrfx_err_t err = nrfx_dppi_channel_alloc(&dppi_ch_1);
if (err != NRFX_SUCCESS) {
printk("Err %d\n", err);
return;
}
err = nrfx_dppi_channel_enable(dppi_ch_1);
if (err != NRFX_SUCCESS) {
printk("Err %d\n", err);
return;
}
nrfx_gppi_channel_endpoints_setup(dppi_ch_1,
nrf_timer_event_address_get(m_sample_timer.p_reg,
NRF_TIMER_EVENT_COMPARE0),
nrf_gpiote_task_address_get(NRF_GPIOTE,
nrfx_gpiote_in_event_get(PIN_LED0)));
}
void main(void)
{
printk("Starting Fancy Blinker Application...\n");
timer_init();
gpiote_init();
dppi_init();
printk("Timer + DPPI + GPIOTE Mode\n");
}
I'm getting an error by just including nrfx_dppi.h, as follows:
In file included from C:\ncs\v2.2.0\zephyr\include\zephyr\kernel_includes.h:16,
from C:\ncs\v2.2.0\zephyr\include\zephyr\kernel.h:17,
from c:\work\nrf-examples\fancy_blink\src\main.c:7:
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:65:39: error: unknown type name 'NRF_DPPIC_Type'
65 | NRF_DPPI_TASK_CHG0_EN = offsetof(NRF_DPPIC_Type, TASKS_CHG[0].EN), /**< Enable channel group 0. */
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:66:39: error: unknown type name 'NRF_DPPIC_Type'
66 | NRF_DPPI_TASK_CHG0_DIS = offsetof(NRF_DPPIC_Type, TASKS_CHG[0].DIS), /**< Disable channel group 0. */
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:67:39: error: unknown type name 'NRF_DPPIC_Type'
67 | NRF_DPPI_TASK_CHG1_EN = offsetof(NRF_DPPIC_Type, TASKS_CHG[1].EN), /**< Enable channel group 1. */
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:68:39: error: unknown type name 'NRF_DPPIC_Type'
68 | NRF_DPPI_TASK_CHG1_DIS = offsetof(NRF_DPPIC_Type, TASKS_CHG[1].DIS), /**< Disable channel group 1. */
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:69:39: error: unknown type name 'NRF_DPPIC_Type'
69 | NRF_DPPI_TASK_CHG2_EN = offsetof(NRF_DPPIC_Type, TASKS_CHG[2].EN), /**< Enable channel group 2. */
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:70:39: error: unknown type name 'NRF_DPPIC_Type'
70 | NRF_DPPI_TASK_CHG2_DIS = offsetof(NRF_DPPIC_Type, TASKS_CHG[2].DIS), /**< Disable channel group 2. */
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:71:39: error: unknown type name 'NRF_DPPIC_Type'
71 | NRF_DPPI_TASK_CHG3_EN = offsetof(NRF_DPPIC_Type, TASKS_CHG[3].EN), /**< Enable channel group 3. */
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:72:39: error: unknown type name 'NRF_DPPIC_Type'
72 | NRF_DPPI_TASK_CHG3_DIS = offsetof(NRF_DPPIC_Type, TASKS_CHG[3].DIS), /**< Disable channel group 3. */
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:73:39: error: unknown type name 'NRF_DPPIC_Type'
73 | NRF_DPPI_TASK_CHG4_EN = offsetof(NRF_DPPIC_Type, TASKS_CHG[4].EN), /**< Enable channel group 4. */
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:74:39: error: unknown type name 'NRF_DPPIC_Type'
74 | NRF_DPPI_TASK_CHG4_DIS = offsetof(NRF_DPPIC_Type, TASKS_CHG[4].DIS), /**< Disable channel group 4. */
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:75:39: error: unknown type name 'NRF_DPPIC_Type'
75 | NRF_DPPI_TASK_CHG5_EN = offsetof(NRF_DPPIC_Type, TASKS_CHG[5].EN), /**< Enable channel group 5. */
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:76:39: error: unknown type name 'NRF_DPPIC_Type'
76 | NRF_DPPI_TASK_CHG5_DIS = offsetof(NRF_DPPIC_Type, TASKS_CHG[5].DIS) /**< Disable channel group 5. */
| ^~~~~~~~~~~~~~
In file included from C:\ncs\v2.2.0\modules\hal\nordic\nrfx\drivers\include\nrfx_dppi.h:38,
from c:\work\nrf-examples\fancy_blink\src\main.c:14:
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:85:46: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
85 | NRF_STATIC_INLINE void nrf_dppi_task_trigger(NRF_DPPIC_Type * p_reg, nrf_dppi_task_t dppi_task);
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:95:54: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
95 | NRF_STATIC_INLINE uint32_t nrf_dppi_task_address_get(NRF_DPPIC_Type const * p_reg,
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:107:47: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
107 | NRF_STATIC_INLINE bool nrf_dppi_channel_check(NRF_DPPIC_Type const * p_reg, uint8_t channel);
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:118:49: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
118 | NRF_STATIC_INLINE void nrf_dppi_channels_enable(NRF_DPPIC_Type * p_reg, uint32_t mask);
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:129:50: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
129 | NRF_STATIC_INLINE void nrf_dppi_channels_disable(NRF_DPPIC_Type * p_reg, uint32_t mask);
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:136:54: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
136 | NRF_STATIC_INLINE void nrf_dppi_channels_disable_all(NRF_DPPIC_Type * p_reg);
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:149:47: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
149 | NRF_STATIC_INLINE void nrf_dppi_subscribe_set(NRF_DPPIC_Type * p_reg,
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:160:49: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
160 | NRF_STATIC_INLINE void nrf_dppi_subscribe_clear(NRF_DPPIC_Type * p_reg, nrf_dppi_task_t task);
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:176:59: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
176 | NRF_STATIC_INLINE void nrf_dppi_channels_include_in_group(NRF_DPPIC_Type * p_reg,
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:194:60: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
194 | NRF_STATIC_INLINE void nrf_dppi_channels_remove_from_group(NRF_DPPIC_Type * p_reg,
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:207:45: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
207 | NRF_STATIC_INLINE void nrf_dppi_group_clear(NRF_DPPIC_Type * p_reg,
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:216:46: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
216 | NRF_STATIC_INLINE void nrf_dppi_group_enable(NRF_DPPIC_Type * p_reg,
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:225:47: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
225 | NRF_STATIC_INLINE void nrf_dppi_group_disable(NRF_DPPIC_Type * p_reg,
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:248:46: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
248 | NRF_STATIC_INLINE void nrf_dppi_task_trigger(NRF_DPPIC_Type * p_reg, nrf_dppi_task_t dppi_task)
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:253:54: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
253 | NRF_STATIC_INLINE uint32_t nrf_dppi_task_address_get(NRF_DPPIC_Type const * p_reg,
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:259:47: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
259 | NRF_STATIC_INLINE bool nrf_dppi_channel_check(NRF_DPPIC_Type const * p_reg, uint8_t channel)
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:265:54: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
265 | NRF_STATIC_INLINE void nrf_dppi_channels_disable_all(NRF_DPPIC_Type * p_reg)
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:270:49: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
270 | NRF_STATIC_INLINE void nrf_dppi_channels_enable(NRF_DPPIC_Type * p_reg, uint32_t mask)
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:275:50: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
275 | NRF_STATIC_INLINE void nrf_dppi_channels_disable(NRF_DPPIC_Type * p_reg, uint32_t mask)
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:280:47: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
280 | NRF_STATIC_INLINE void nrf_dppi_subscribe_set(NRF_DPPIC_Type * p_reg,
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:289:49: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
289 | NRF_STATIC_INLINE void nrf_dppi_subscribe_clear(NRF_DPPIC_Type * p_reg, nrf_dppi_task_t task)
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:294:59: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
294 | NRF_STATIC_INLINE void nrf_dppi_channels_include_in_group(NRF_DPPIC_Type * p_reg,
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:302:60: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
302 | NRF_STATIC_INLINE void nrf_dppi_channels_remove_from_group(NRF_DPPIC_Type * p_reg,
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:310:45: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
310 | NRF_STATIC_INLINE void nrf_dppi_group_clear(NRF_DPPIC_Type * p_reg,
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:316:46: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
316 | NRF_STATIC_INLINE void nrf_dppi_group_enable(NRF_DPPIC_Type * p_reg, nrf_dppi_channel_group_t group)
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:321:47: error: unknown type name 'NRF_DPPIC_Type'; did you mean 'NRF_PPI_Type'?
321 | NRF_STATIC_INLINE void nrf_dppi_group_disable(NRF_DPPIC_Type * p_reg,
| ^~~~~~~~~~~~~~
| NRF_PPI_Type
In file included from C:\ncs\v2.2.0\modules\hal\nordic\nrfx\nrfx.h:38,
from c:\ncs\v2.2.0\zephyr\soc\arm\nordic_nrf\common\soc_nrf_common.h:14,
from C:\ncs\v2.2.0\zephyr\soc\arm\nordic_nrf\nrf52\soc.h:14,
from C:\ncs\v2.2.0\zephyr\include\zephyr\arch\arm\aarch32\cortex_m\cmsis.h:19,
from C:\ncs\v2.2.0\zephyr\include\zephyr\arch\arm\aarch32\mpu\arm_mpu_v7m.h:11,
from C:\ncs\v2.2.0\zephyr\include\zephyr\arch\arm\aarch32\mpu\arm_mpu.h:14,
from C:\ncs\v2.2.0\zephyr\include\zephyr\arch\arm\aarch32\arch.h:210,
from C:\ncs\v2.2.0\zephyr\include\zephyr\arch\cpu.h:19,
from C:\ncs\v2.2.0\zephyr\include\zephyr\kernel_includes.h:33:
C:/ncs/v2.2.0/modules/hal/nordic/nrfx/hal/nrf_dppi.h: In function 'nrf_dppi_group_enable_task_get':
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:330:43: error: 'NRF_DPPIC_Type' undeclared (first use in this function); did you mean 'NRF_PPI_Type'?
330 | return (nrf_dppi_task_t)NRFX_OFFSETOF(NRF_DPPIC_Type, TASKS_CHG[index].EN);
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\drivers\nrfx_common.h:214:51: note: in definition of macro 'NRFX_OFFSETOF'
214 | #define NRFX_OFFSETOF(type, member) ((size_t)&(((type *)0)->member))
| ^~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:330:43: note: each undeclared identifier is reported only once for each function it appears in
330 | return (nrf_dppi_task_t)NRFX_OFFSETOF(NRF_DPPIC_Type, TASKS_CHG[index].EN);
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\drivers\nrfx_common.h:214:51: note: in definition of macro 'NRFX_OFFSETOF'
214 | #define NRFX_OFFSETOF(type, member) ((size_t)&(((type *)0)->member))
| ^~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\drivers\nrfx_common.h:214:57: error: expected expression before ')' token
214 | #define NRFX_OFFSETOF(type, member) ((size_t)&(((type *)0)->member))
| ^
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:330:29: note: in expansion of macro 'NRFX_OFFSETOF'
330 | return (nrf_dppi_task_t)NRFX_OFFSETOF(NRF_DPPIC_Type, TASKS_CHG[index].EN);
| ^~~~~~~~~~~~~
C:/ncs/v2.2.0/modules/hal/nordic/nrfx/hal/nrf_dppi.h: In function 'nrf_dppi_group_disable_task_get':
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:336:43: error: 'NRF_DPPIC_Type' undeclared (first use in this function); did you mean 'NRF_PPI_Type'?
336 | return (nrf_dppi_task_t)NRFX_OFFSETOF(NRF_DPPIC_Type, TASKS_CHG[index].DIS);
| ^~~~~~~~~~~~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\drivers\nrfx_common.h:214:51: note: in definition of macro 'NRFX_OFFSETOF'
214 | #define NRFX_OFFSETOF(type, member) ((size_t)&(((type *)0)->member))
| ^~~~
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\drivers\nrfx_common.h:214:57: error: expected expression before ')' token
214 | #define NRFX_OFFSETOF(type, member) ((size_t)&(((type *)0)->member))
| ^
C:\ncs\v2.2.0\modules\hal\nordic\nrfx\hal\nrf_dppi.h:336:29: note: in expansion of macro 'NRFX_OFFSETOF'
336 | return (nrf_dppi_task_t)NRFX_OFFSETOF(NRF_DPPIC_Type, TASKS_CHG[index].DIS);
| ^~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
There may be something missing in my prj.conf.
Could you help me with that?