Undefined reference to `CTIMER_SetupCapture'

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Undefined reference to `CTIMER_SetupCapture'

Jump to solution
1,690 Views
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.

Labels (1)
0 Kudos
1 Solution
1,529 Views
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

View solution in original post

7 Replies
1,530 Views
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

1,529 Views
mjx1995mjx
Contributor II

Hi Sabina,

It works! Maybe SDC need update,

Thank you very much~

0 Kudos
1,529 Views
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 Kudos
1,529 Views
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 Kudos
1,529 Views
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 Kudos
1,529 Views
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 Kudos
1,529 Views
mjx1995mjx
Contributor II

Hi Sabina,

I have uploaded the code. Appreciate for your help.

Best Regards,

Peter

0 Kudos