Once I have my motor up and running using KMS, can I import the project into KDS so that I can add functionality and rebuild?

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

Once I have my motor up and running using KMS, can I import the project into KDS so that I can add functionality and rebuild?

Jump to solution
7,640 Views
kubanb
Contributor III

I have been playing with KMS for a while and have been able to get it to control my custom motor very nicely.  However, my final product requires a lot more functionality and I would like to add to the KMS project.  I have tried importing the files from the saved KMS project folder into KDS, but there are incompatibilities that I do not understand.  For instance, KDS doesn't understand the word "FAST" preceding declarations. Any help or educational resources would be appreciated.

 

Barry

Labels (1)
1 Solution
7,099 Views
kubanb
Contributor III

Philip,

I have figured out how to get KMS working on the board when a download fails (it was not erasing KMS from flash as I had feared).

I have changed commTimeOutEnabled to false successfully.

I have found that I can get the application to run as a stand-alone if I use KMS to build and download it and then also use the KMS GUI to start the motion sequence. Then I can unplug the USB cable and still use SW2 to change speeds as planned. But, the reset button (SW1) is ignored; if I want to stop, I just turn off the power supply.  If I try to start the sequence with SW3 as planned, that does not work, so the problem lies there.

I put 2 variables in the super loop in main, and assign them with GPIO_DRV_ReadPinInput(kGpioSW2) and SW3 and put a breakpoint right after the assignments.  I can see the value of SW2 change when I push and release SW2 button, but when I push SW3, it goes straight to the default ISR and doesn't get to my breakpoint.

Thanks for your help and patience!

Barry

View solution in original post

0 Kudos
11 Replies
5,215 Views
MuhammadNelson
Contributor I

wow

0 Kudos
7,099 Views
eduardo_viramon
NXP Employee
NXP Employee

Barry,

The procedure to create a motion profile, import it into an IDE and turn it into a stand-alone application is detailed in the Kinetis Motor Suite Lab Guide pdf, which you can access on your documentation folder: \My Documents\KMS_1.0.1\Documents

(tip: you can also open reference documents quickly by going the the View menu and clicking on Documents in the KMS gui)

In the Lab Guide, look for labs 3.1.6, .7 and .8 for velocity control or 3.2.5, .6 and .7 for position control. Those will take you through creating a motion profile, exporting a project to KDS and making the project stand-alone.

Hope this helps,

Happy motoring

7,099 Views
kubanb
Contributor III

OK, I went through all of the Velocity Labs and everything worked perfectly until the very last step where the application should run stand-alone.  The project built without errors in KDS and I set up the debugger exactly as stated, but the application did not run.  Not only that, but now KMS will not communicate with the the Freedom board.  I fear that even though I was VERY careful to make sure that the debugger checkbox for erasing the memory was not checked, that the KMS firmware on the MCU was either erased or overwritten anyway.  Now what?

Barry

0 Kudos
7,099 Views
philip_drake
NXP Employee
NXP Employee

Barry,  the Lab guide had a note or two about the KDS install

In Table 5 - Debug

• P&E Micro OpenSDA application version 1.17 or greater

If using KDS: P&E Micro Debugger plugin com.pemicro.debug.gdbjtag.pne_2.2.9.201512221411

or greater

If you find that you did not update the debug plugin, then the download from KDS to the MCU during your debug session mass erased the MCU.  This means the KV31 MCU no longer has the KMS execute only library in it and can no longer be used with KMS. 

If you did update the pemicro plug in to the latest, there still might be some hope. Please check and let us know.

The only way to fix this (after a mass erase) is to get another board and upgrade the pemicro plugin to the latest version.

I'm sorry about that.

Regards,

Philip Drake

Systems Engineer, NXP

7,101 Views
kubanb
Contributor III

OK, I was able to get two of the dev kits to communicate with KMS again by starting from scratch and creating new projects on them, that is very good news!  The third board was definitely erased/overwritten somewhere in the process of me working on the LED blinking project in KDS alone.

So, I am back to the last problem which is that I cannot get the last step of the Velocity Lab to work.  That is, after I make the recommended changes to main.c and drv.c, and successfully rebuild, then start and stop the debugger, I cant get the application running on the board as a stand-alone.  Any suggestions?

Barry

0 Kudos
7,101 Views
philip_drake
NXP Employee
NXP Employee

The lab guide has proven to be an extremely accurate and complete instruction. I can guess at what step you are missing but,...

Is the tri-color LED blinking? Is the RED LED lighting up indicating a fault?

Completely disconnect the KDS from the project. Possibly unplug  the micro USB connector. and hit Reset.

With the cable plugged back in can the application connect to KMS? If not then Try step 6:

Step 6 (page 181) where you change commTimeOutEnabled to false  --is that done. 

If after downloading the project via the debugger and KDS, run the project, then pause it.  Find out where it is.  If it's off in the weeds in the default ISR or a hardfault handler then your code is doing something wrong. This would be standard debugging code practices.  put in a breakpoint at the if statement that detects the pushbuttom depression, does it ever get there?

If instead, it is looping through the while 1 loop in main.c then the application may be ok.

The other item it might be something in the motion sequence plan.  try using one of the canned examples, ceiling fan is a good one.

Make sure you haven't violated any naming conventions for the variable names.  (I think we have found these motion sequence variable names can have no numbers of underscore special characters.

step 11 - where pushing SW3 drives the user.state = USER_RUN_PLAN; to execute.  Or before while (1) entry start the plan with this statement.

after that I'm not sure.

There are some great videos for you to watch.  Take a look here.

Good Luck,

Philip

7,101 Views
kubanb
Contributor III

I found the problem.  In gpio_pins.c, the interrupt for SW3 was enabled.  All works fine now. Thanks again for your help, I am very grateful!

Barry

7,100 Views
kubanb
Contributor III

Philip,

I have figured out how to get KMS working on the board when a download fails (it was not erasing KMS from flash as I had feared).

I have changed commTimeOutEnabled to false successfully.

I have found that I can get the application to run as a stand-alone if I use KMS to build and download it and then also use the KMS GUI to start the motion sequence. Then I can unplug the USB cable and still use SW2 to change speeds as planned. But, the reset button (SW1) is ignored; if I want to stop, I just turn off the power supply.  If I try to start the sequence with SW3 as planned, that does not work, so the problem lies there.

I put 2 variables in the super loop in main, and assign them with GPIO_DRV_ReadPinInput(kGpioSW2) and SW3 and put a breakpoint right after the assignments.  I can see the value of SW2 change when I push and release SW2 button, but when I push SW3, it goes straight to the default ISR and doesn't get to my breakpoint.

Thanks for your help and patience!

Barry

0 Kudos
7,101 Views
kubanb
Contributor III

Philip,

  I did read that and was very careful to check my version of the plugin (which is 2.5.0.201607012154) before I did anything else.  

  I hope that there is still hope because I have 5 development kits, and three of them are now unable to communicate with KMS.  Thanks for your help!

Barry

0 Kudos
7,101 Views
philip_drake
NXP Employee
NXP Employee

The KMS GUI relys on the drag and drop MSD capability to program the KV31. KDS uses the debug interface capability through the GDP server.  I have successfully used the Segger Jlink OPENSDA version 2.1 jlink. I have not tried the latest release but plan to do that soon.  The Jlink debug interface does not do a mass erase. You will be able to download and debug through KDS without issues.  But with that OPENSDA driver installed, the download capability within the KMS GUI is gone.  Not a problem if you are going to be doing all of your download with the IDE. You can go back and forth with the OPENSDA drivers as often as you like.  PEMicro has a download of their board driver at pemicro.com/opensda.

We at NXP have been working to develop protections on the MCU chip to keep the mass erase from happening. In fact any silicon samples you get or silicon you buy that is KMS enabled have these new protection features.  However the IDE updates needed to use these protection options have been very slow in coming.  The protection features are documented in the MCU reference manual look at section 3.5.1.7 .

If you have mass erased the parts I can suggest two options.  One; send the units back for replacement, or two; you replace the silicon on the FRDM board with samples from NXP that are KMS enabled.  The MCU is still good for work with any other projects you might have, but if the KMS library is gone, they cannot be used for KMS.

Any of the memory sizes, 128K, 256K or 512K and with the "P" suffix will work for KMS. However since this board accepts 100 LQFP package you will only be able to get the 512K samples. Clich here to be redirected to the NXP site for samples. or here--> MKV31F512VLL12P 

Within the next week or two  NXP is releasing a new version of KMS (1.0.1) that is compatible with KDS 3.2 IDE.  It is backward compatible with the library on the MCU so you won't be needing anything changed there.  Be looking for the announcment.  There are some reference project changes.

7,101 Views
kubanb
Contributor III

Thanks, I will give it a try!

0 Kudos