This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-MSPM0G3507: The function definition cannot be opened.

Part Number: LP-MSPM0G3507
Other Parts Discussed in Thread: MSPM0G3507, DRV8329AEVM, DRV8329

Tool/software:

Hello my dear supporters and engineers,

I'm currently using LP-MSPM0G3507 and DRV8329AEVM to spin the motor using the "C:\ti\mspm0_sdk_2_02_00_05\examples\nortos\LP_MSPM0G3507\motor_control_pmsm_sensorless_foc\sensorless-foc_DRV8329" example. However, I'm having several problems measuring the values.

Things to fix in the code:

- Receive Target RPM via LIN communication and control motor speed
- Improve motor current waveform (The distorted current waveform needs to be improved to a sine wave-like waveform.)
- Stop motor operation and set fault flags in case of faults such as overvoltage, overcurrent, overheat, open/short circuit, etc.
- Send high voltage, motor current, current speed, and fault status via LIN communication

Issues I am facing

1. I cannot jump to a specific function by definition. The following functions cannot be opened:

updateConfigsInit()
updateConfigs()
applicationConfig(void *gpMC_App)
appReset(void *gpMC_App)
applicationLowPriorityRun(void *gpMC_App)
getMCAppSize()

※ I need to know the measurement method and update cycle of the values ​​in g_pMotorInputs.

2. I would like to know what I can do to improve the current waveform.

I took the following actions:

Changed pUserInputRegs->systemParams.currLoopKp =3.42 in ISR.C to pUserInputRegs->systemParams.currLoopKp =1, and changed pUserInputRegs->systemParams.currLoopKi = 3678 to pUserInputRegs->systemParams.currLoopKi = 0.

As a result, I could feel a slight difference at 2000 RPM.

  currLoopKp =3.42 and currLoopKi = 3678

  currLoopKp =1 and currLoopKi = 0 (But the waveform keeps changing.)

However, the waveform shakes badly and does not come out as a consistent waveform. Also, the waveform at low RPM and the waveform at high RPM are very different. I would like to know what parameters or algorithms I should change to always get a consistent sine wave waveform regardless of RPM.

If you need any additional information, please reply.

Thank you.

  • Hi Donguk,

    For the function definitions, where have you defined these, and have you built the project yet? Also what version of CCS are you using?

    Typically you need to build the project and then jump to definition should work. Additionally, some early versions of CCS Theia had problems doing the jump to definition function. You may want to update to the latest version.

    For the waveform, can you clarify by which signal you are probing to see this waveform? I assume this is the current coming from the motor driver gates? Are your screenshots collected just by placing the current meter in series with the motor phase?

  • HI Dylan,

    I don't know where it is defined because I used the example file in C:\ti\mspm0_sdk_2_02_00_05\examples\nortos\LP_MSPM0G3507\motor_control_pmsm_sensorless_foc\sensorless-foc_DRV8329.

    The project has been built and the motor is controlled using flash.

    The CCS version is Code Composer Studio 12.8.1. This does not have a function to go to the definition, only to the declaration, but in most cases, I was able to go to the definition with ctrl + right-click.

    I want the waveform to resemble a sine wave. I measured one of the three phases of the motor using a current probe.

    Therefore, as I asked earlier, I need to jump to the definition of the specific functions in the example and take further action to improve the motor parameters or current in the motor algorithm within the example.

    Please let me know the recommended modification parameters or algorithm.

  • Hi Donguk,

    I can see that all 6 of the functions you mention are defined in the ISR.c file, and declared in the ISR.h file. You can find them using CTRL + F. Both CCS Theia and CCS Eclipse have a search function which you can also use to find the declaration and definition. Finally if you highlight these and right click them, you have the option to jump to the definition or the declaration of the function. I've just opened the project in CCS Theia 1.5 and I can jump to these. I would recommend you utilize CCS20 for this project, as we recommend pairing the latest SDK with the latest version of code composer studio.

    As for the motor current, I'd encourage you to check the voltage on each phase when the load is not connected to see if the output from the controller is perfectly sinusoidal. The load is likely affecting the current over time, but until we see the phase output without the load connected, it is hard to say which component is causing the rough / less sinusoidal output.

  • Hi Dylan,

    What does ISR.C refer to?
    Please check if "C:\ti\mspm0_sdk_2_02_00_05\examples\nortos\LP_MSPM0G3507\motor_control_pmsm_sensorless_foc\sensorless-foc_DRV8329\ISR.c" is correct.
    If you look at the picture, it looks like it's not defined.


    We will try more various things to improve the current waveform and will ask you again later. The first thing to do in this forum is to find the definition of the function.

  • Hi Donguk,

    I have pinged our software team member who built this example to help understand what is going on here. I will be on holiday starting in the next few days so if I take more than a few days to respond please ping this thread to make sure I get the answer back to you. I am out of office starting next week until Jan 6.

    For now I will add, my build log does show the same "call to undeclared function..." errors that you've pasted.

    In the meantime, I would highly recommend that you update to the latest version of CCS (CCSv20) as the newest releases of the SDK are optimized to work on this. I can't say that will resolve your issue but it will at least mean that you're working on the best and most current version of the tool.

  • Hi Dylan,

    In the case of SDK, I used both mspm0_sdk_2_03_00_07 and mspm0_sdk_2_02_00_05, but the motor did not work in mspm0_sdk_2_03_00_07, and another TI engineer recommended that I hold off on using it.


    Please refer to that link.

    e2e.ti.com/.../5550618


    And CCS20 is already in use, but it still doesn't make much of a difference.
    Could you please tell me a picture, location, or definition of the defined function? Although most problems in motor control have been solved, we are faced with new problems.


    In the FOC_TIMG0_INST_IRQHandler interrupt function defined in ISR.C, applicationLowPriorityRun(g_pMC_App); The function seems to be causing problems with LIN communication. To solve this problem,  applicationLowPriorityRun(g_pMC_App); we need to look at the content inside the function.

  • Hi Donguk,

    I think that Helic was just saying that you can continue to use the previous SDK and included library, then you wont have to worry about the changes in the latest SDK revision. If you prefer to continue using the same version, that is ok.

    I can say that I have been able to find the source of "undeclared function..." issue - These are defined in a precompiled library, FOC_Lib.a, so the definition is not visible to the IDE. However at some point the software team did decide to include the definition of the FOC_Lib functions in the SDK source code. You can view the definitions of all of the functions you mention above by referring to [SDK Install Path]\source\ti\motor_control_pmsm_foc\sensored_modules\appLib\application\source\application.c

    This should help you to understand what happens inside of the function. 

    It may be helpful to create a new thread for your LIN issue with more details about what behavior you are seeing so the team can assist to resolve this.

  • Hi Dylan,

    So is there a way to change the contents inside that function? I want to modify the contents inside the function.

  • Hi Dylan,

    Plz answer below yes or not

  • Hi Donguk,

    You could edit the source code yourself and then rebuild it. You should also make sure that your project is not using the precompiled library, FOC_Lib.a, by adjusting the project properties. You can ensure that you are not using it by removing the precompiled library from the includes.

  • Hi Dylan,

    Thank you for your reply.

    I don't understand correctly, but are you saying to add all the C and H files inside FOC.lib and exclude the precompiled FOC.lib?

    If that's what you mean, I don't know what's inside FOC.lib.

    The reason I want to edit the content is because the information such as the motor's voltage, current, speed, etc. is different from the actual information. Would it be better to open a separate forum rather than trying to edit it myself?

  • Yes that is what I mean.

    You can see the files that are used by FOC.lib in the filepath I mention above - [SDK Install Path]\source\ti\motor_control_pmsm_foc\sensored_modules\appLib\application\source\application.c

    This was added to the SDK more recently so please ensure that you are using the correct SDK version. 

  • Hi Dylan,

    Looking inside C:\ti\mspm0_sdk_2_03_00_07\source\ti\motor_control_pmsm_foc\sensored_modules\appLib\application\source\application.c, it contains various header file functions, and the header files also include external functions and external variables declared in other C functions.

    MSPM0's Senseless software is configured as shown in the photo above.

    So, in the case of sensored software, the contents of the foc library were placed in a place called algolib, so foclib.a was not added separately.

    However, in the case of sensorless, algolib is not added separately, so foclib.lib was added as a predefined library.

    Therefore, I do not think that the content of the library called foc.lib simply corresponds to application.c.

    In addition, foc.lib includes various C and H files, and the contents of the C file differ depending on whether it is sensorless or sensored.

    Because of this, we wonder whether simply excluding foc.lib from the predefinition and adding algolib, appconfig, and application that exist in sensored will show the same results as before.

    B.R.

    DU

  • If the precompiled library is included in the project, I think that the linker would utilize the definitions from the precompiled library, rather than the files you've included. 

    So since you are using sensorless (sorry for referring you to the sensored version previously), I think you can just remove the precompiled library from the project, add the source to it, edit the source, and rebuild to redefine these functions.

    Alternatively you can rebuild the library file and provide the new version in your project properties. 

    Re-reading my messages with the software team - I believe that the FOC_Lib.lib file is built using the source shown in C:\ti\mspm0_sdk_2_03_00_07\source\ti\motor_control_universal_foc\modules\appLib\application\source\application.c

    Please check this, I realize that originally I kept pointing you to the source for the sensored version.

  • Hi Donguk,

    I pinged our software team to be sure about the above, they indicated to me that there are some differences between the source code for the universal version, and the source code used to build the library for the sensorless version of the project. So the last notes above are not entirely correct.

    I am inquiring with our software team to see if we can get some function definitions to you manually. 

    Apologies for the incorrect info above.

  • Hi Dylan,

    We still face two problems in driving the motor.

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1459067/mspm0g3507-when-the-motor-operates-the-voltage-current-speed-information-is-incorrect

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1456880/mspm0g3507-full_scale_current_base-does-not-work-as-calculated/5599623#5599623

    So we are still only running in open loop and not working normally in closeloop.


    In this state, if I do it the way you suggested above, I can see the function definition and the motor runs in the openloop.


    Please let me know if there are any differences with sensorless in the motor drive algorithm.


    Until then, I'll be using this code.

    B.R.

    Donguk

**Attention** This is a public forum