본문으로 바로가기

[nRF52 ] error: 'NRFX_TIMER0_INST_IDX' undeclared here

category Nordic_nRF52 2023. 2. 8. 10:34

radio_test 프로젝트의 radio_test.c / .h 파일을 다른 프로젝트 추가시 

다음과 같은 에러가 발생을 하네요.

3> In file included from ../../../../../../modules/nrfx/nrfx.h:45,
3>                  from ../../../../../../modules/nrfx/hal/nrf_radio.h:44,
3>                  from D:\....\ble_app_xxxx\radio_test.h:45,
3>                  from D:\....\ble_app_xxxx\radio_test.c:45:
3> ../../../../../../modules/nrfx/drivers/include/nrfx_timer.h:72:39: 
         error: 'NRFX_TIMER0_INST_IDX' undeclared here (not in a function); 
         did you mean 'NRFX_TIMER_INSTANCE'?
3> ../../../../../../modules/nrfx/drivers/nrfx_common.h:113:37: 
         note: in definition of macro 'NRFX_CONCAT_3_'
3> ../../../../../../modules/nrfx/drivers/include/nrfx_timer.h:72:25: 
         note: in expansion of macro 'NRFX_CONCAT_3'
3> D:\....\ble_app_xxxx\radio_test.c:72:37: 
         note: in expansion of macro 'NRFX_TIMER_INSTANCE'

 

< 해결책>

 1> nRF_Drivers 에 nrfx_timer.c 추가 (.emProject)

 

 

2> sdk_config.h 수정

 

  >> NRFX_TIMER0_ENABLED ==> sdk_config.h 파일 검색 수정하기

// <e> NRFX_TIMER_ENABLED - nrfx_timer - TIMER periperal driver
//==========================================================
#ifndef NRFX_TIMER_ENABLED
#define NRFX_TIMER_ENABLED 1
#endif
// <q> NRFX_TIMER0_ENABLED  - Enable TIMER0 instance
 

#ifndef NRFX_TIMER0_ENABLED
#define NRFX_TIMER0_ENABLED 1
#endif

 

 

3> 위의 수정으로 해결되는 경우도 있지만 계속 에러가 발생하면 정의를 찾아 갑니다.

 

 ==> TIMER_ENABLED , TIMER0_ENABLED 를 sdk_config.h에서 검색 및 수정합니다.

~~~ 중략 ~~~~

// <e> TIMER_ENABLED - nrf_drv_timer - TIMER periperal driver - legacy layer
//==========================================================
#ifndef TIMER_ENABLED
#define TIMER_ENABLED 1   <----- 요기
#endif
~~~ 중략 ~~~~
// <q> TIMER0_ENABLED  - Enable TIMER0 instance
#ifndef TIMER0_ENABLED
#define TIMER0_ENABLED 1  <----- 요기
#endif

 

4> 저는 여기까지 수정하니 에러가 해결됐습니다.

 

 

 

참고하세요.

반응형