Undefined reference to `CTIMER_SetupCapture'

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Undefined reference to `CTIMER_SetupCapture'

跳至解决方案
3,531 次查看
mjx1995mjx
Contributor II

   What I used is Lpc845BRK, the code is from LPC845 SDK.

    I want to change PWM duty cycle every 4/8/16 PWM period, so I use CTIMER with capture mode to counter PWM rise edge, I have already included fsl_ctimer.h but an error occured, undefined reference to `CTIMER_SetupCapture'. I checked my project and I'm sure that fsl_ctimer.h and fsl_ctimer.c are in the drivers folder.

    What makes me confused is that I write CTIMER_Init() before CTIMER_SetupCapture(), the error is not on the line of Init, but on SetupCapture line.

标签 (1)
0 项奖励
回复
1 解答
3,370 次查看
Sabina_Bruce
NXP Employee
NXP Employee

Hi Peter,

So I found what is going on. The reason why it is showing an undefined reference is because the function itself for the SetupCapture is commented out as it has a macro definition preventing its use. 

I noticed that there is a typo in the definition as it does not make sense to be not defined and the value be one as it is right now. Try this:

#if !defined(FSL_FEATURE_CTIMER_HAS_NO_INPUT_CAPTURE) && !(FSL_FEATURE_CTIMER_HAS_NO_INPUT_CAPTURE)

or as it is right now remove the exclamation mark at the beginning but define the macro at the beginning of the document.

#if defined(FSL_FEATURE_CTIMER_HAS_NO_INPUT_CAPTURE) && FSL_FEATURE_CTIMER_HAS_NO_INPUT_CAPTURE

pastedImage_1.png

Try this and let me know if it works out for you.

Best Regards,

Sabina

在原帖中查看解决方案

7 回复数
3,371 次查看
Sabina_Bruce
NXP Employee
NXP Employee

Hi Peter,

So I found what is going on. The reason why it is showing an undefined reference is because the function itself for the SetupCapture is commented out as it has a macro definition preventing its use. 

I noticed that there is a typo in the definition as it does not make sense to be not defined and the value be one as it is right now. Try this:

#if !defined(FSL_FEATURE_CTIMER_HAS_NO_INPUT_CAPTURE) && !(FSL_FEATURE_CTIMER_HAS_NO_INPUT_CAPTURE)

or as it is right now remove the exclamation mark at the beginning but define the macro at the beginning of the document.

#if defined(FSL_FEATURE_CTIMER_HAS_NO_INPUT_CAPTURE) && FSL_FEATURE_CTIMER_HAS_NO_INPUT_CAPTURE

pastedImage_1.png

Try this and let me know if it works out for you.

Best Regards,

Sabina

3,370 次查看
mjx1995mjx
Contributor II

Hi Sabina,

It works! Maybe SDC need update,

Thank you very much~

0 项奖励
回复
3,370 次查看
Sabina_Bruce
NXP Employee
NXP Employee

Hi Peter,

I'm glad it worked out and definitely will be reporting this so it can be fixed.

Thank you and have a great day!

Sabina

0 项奖励
回复
3,370 次查看
Sabina_Bruce
NXP Employee
NXP Employee

Hello Peter,

   Can you try to delete the files from the driver folder and add them again using the SDK management tool. You can do this by right clicking the project, then scroll down to SDK Management then click SDK Manage Components. Here you can select the ctimer driver again. Build your project and let me know the results.

pastedImage_1.png

Best Regards,

Sabina

0 项奖励
回复
3,370 次查看
mjx1995mjx
Contributor II

Hi Sabina,

     Thanks for your help.I followed your advise but not work.I delete the fsl_ctimer.h and fsl_ctimer.c from the driver folder, then I found  SDK management tool and selected ctimer, an error shown this.

2019-06-13.png

   So I selected debug_console_lite, added files and built project.

   Unfortunately the error still exist.

2019-06-13 (2).png

Thanks for your patience.

Best Regards,

Peter

0 项奖励
回复
3,370 次查看
Sabina_Bruce
NXP Employee
NXP Employee

Hi Peter,

I've been trying to replicate the behavior you are experiencing with the examples available but have not had the same error. Is it possible for you to attach the example?

This way I can better assist you in finding the root cause of this issue.

Thank you,

Sabina

0 项奖励
回复
3,370 次查看
mjx1995mjx
Contributor II

Hi Sabina,

I have uploaded the code. Appreciate for your help.

Best Regards,

Peter

0 项奖励
回复