KMS Suite and OpenSDA on Custom PCB

cancel
Showing results for 
Search instead for 
Did you mean: 

KMS Suite and OpenSDA on Custom PCB

Jump to solution
589 Views
appioninc
Contributor II

Hello,

  I have successfully modified the HVMC3PH kit to drive the high power motor we are using.  I have developed our own custom schematic modeled after the HVMC3PH but with higher current capabilities. 

My question lies in what makes sense to do for the MKV31F.  The KMS tuning software/GUI makes use of OpenSDA to communicate to the KV31F on the HVP-KV32F120M PCI Express card to tune the motor parameters.  I am quite familiar with how to go about doing SWD programming for Cortex M class MCU's but not as much with OpenSDA.  So with that being said I have a couple of questions...

1) Can the KMS Studio be configured to work with a SWD connection versus having to use OpenSDA? If that is the case I can just use my Segger J-LINK and be done.  I don't believe this is possible though? 

2)  If I have to use OpenSDA to use the KMS Studio/GUI I would like to figure out a means to use an external board/debugger to connect to the KV31F that would be resident on my Motor Control PCB.  I am assuming I could simply use a K22-FRDM board with OpenSDA to connect to thhe KV31F on my custom PCB, correct?  I have a couple of K22-FRDM boards that I have used in the past as external Debuggers for custom PCB but using the Segger debugger that can be programmed onto the K22-FRDM.

I want to avoid having to populate additional components on my custom PCB such as USB connectors and a second MCU such as the MK20DX to act as the OpenSDA interface to the KV31F.

Regards,

Frank

Labels (1)
0 Kudos
1 Solution
219 Views
renato_kiss
NXP Employee
NXP Employee

Hello Frank,

I think you have here two different questions. One regarding general debugging and other related to GUI and tuning.

In tuning KMS GUI communicates to board via Serial. So for this you don't need a debugger. You will need a UART connected in the right port (depends on MCU - for KV31F, default port is UART0).

For debugging you can use KMS GUI to download your application with JLink or OpenSDA. Open-SDA doesn't need to be populated into your board. You can use an external board with appropriated signals routed. In KMS you can use it both during automated building or with Download application command in menu.

After tuning and test, it is expect to you to have all KMS code ported to your IDE. So during your product development and production phase you can use the tools of your preference.

Please let me know if I understood your questions correctly and if you need more information.

Thanks a lot.

Renato Kiss

View solution in original post

0 Kudos
12 Replies
219 Views
appioninc
Contributor II

Hi Philip,

  Yeah our situation is that we are making use of IAR to truly keep IDE/Compiler compatible across platforms.  Unless there is anything specific that has been improved or fixed that is specific to the KMS algorithm and/or additional features added such as handling the Relay or PFC functionality that is in the HVP Kit I would think we would just stick with KMS V1.1.0 as none of the updates seem to affect us.

Regards,

Frank

0 Kudos
220 Views
renato_kiss
NXP Employee
NXP Employee

Hello Frank,

I think you have here two different questions. One regarding general debugging and other related to GUI and tuning.

In tuning KMS GUI communicates to board via Serial. So for this you don't need a debugger. You will need a UART connected in the right port (depends on MCU - for KV31F, default port is UART0).

For debugging you can use KMS GUI to download your application with JLink or OpenSDA. Open-SDA doesn't need to be populated into your board. You can use an external board with appropriated signals routed. In KMS you can use it both during automated building or with Download application command in menu.

After tuning and test, it is expect to you to have all KMS code ported to your IDE. So during your product development and production phase you can use the tools of your preference.

Please let me know if I understood your questions correctly and if you need more information.

Thanks a lot.

Renato Kiss

View solution in original post

0 Kudos
219 Views
appioninc
Contributor II

Hi Renato,

  Thanks for the reply and Thanks for pointing out that KMS really only needs a UART connection I was intermixing OpenSDA with thinking that the KMS GUI needed that also for the tuning aspect which is not the case.  Yes I have worked directly out of our IDE/Compiler for programming/debugging of which we would ultimately use an External J-LINK for this but with a standard SWD Connector we could also of course make use of OpenSDA if we wanted to with using a K22 FRDM board for this.  That clears that up Thanks!!

Regards,

Frank

0 Kudos
219 Views
appioninc
Contributor II

Hello,

  In inspecting the HVP-KV31F120M schematic page 3 specifically(MKV31F512VLL12) further a couple of questions arise for developing my own custom schematic...

1) I_phC NetLabel is shown in the HVP-KV31F120M schematic on 2 pins,  54: PTB1 and 18:ADC0_DP0/ADC1_DP3?  It is not clear which specific pin I_phC is being measured on?

2) V_in is also shown being driven into 2 pins with 0ohm resistors both pin 27 and 28?  Any particular reason this is done?  Is the V_in measurement actually performed on both pins or just one?

3)  Can you provide some insight as to what is desired to be filtered out with the RC filters on the AN inputs?  All but the BEMF inputs all have a 100ohm / 2200pF RC whereas the BEMF inputs have a 100ohm / 390pF...reasoning for the difference? 

4)  What is the purpose of pin38 with the net label nmi(non-maskable interrupt) being tied to 3.3V?  Does the NMI go to the DefaultISR() which disables the PWM's?  If so seems redundant as if the 3.3V supply goes aways the KV31F stops working anyways?  Just need to know what the NMI triggers in the C firmware to know how to handle this.

Last Question:  What all does the KV31F check before it drives the Relay Line HIGH?  I am not 100% clear where this check occurs in the firmware project.  Could you help direct me to where the Relay line is handled?

Regards,

Frank

0 Kudos
219 Views
linestream-adam
Senior Contributor I

Frank,

I can answer some of these, NXP will need to address the rest.

1. The pins used for the ADC measurements are called out in kms_hw.h file as the channel to sample.  If you read through the Customer Hardware App Note, you will find examples for moving the ADC channels which should prove helpful for understand the pin mapping.  The channel to pin mapping is located in the KV31 Subfamily Reference Manual.

2. V_in is not used in KMS.  I assume this is here to support PFC applications.

Last. KMS does not use the relay line for the in-rush current limiter.

0 Kudos
219 Views
appioninc
Contributor II

Hello Adam,

  Thank you for the response.

A.  I am assuming the Appnote you are referring to is AN5254, "Adapting KMS for Custom Hardware"?  If that is it I am quite familiar with that appnote from and have already used it extensively to modify the HVP unit to handle 30A+ by modifying the OpAmp gains, shunts and replacing the 3Ph Inverter with the 30A version.  However this document does not help with my prior posed questions.

 B. There is no file in any of the projects that KMS Studio Generates for the HVP-KV31F that are called kms_hw.h? 

Maybe you have a different KMS Studio than I have?  The only file that is produced that outlines pins is called hw_pins_init.h and this file does not provide any insight as to which specific ADCx Channel is being used for the various NetLabels/Parameters that are shown feeding into the ADC inputs on page 3 of the HVP-KV31F120M(spf-28269) schematic. 

  It becomes quite challenging when as mentioned earlier I_phC is shown as a Netlabel on 2 different pins?  On top of that as mentioned earlier there is no where that I have been able to find in either the KMS PDF Documentation OR source code that identifies where the BEMF_A, B, C inputs are even used in the KMS/Sensorless algorithm.

I am familiar with Table 3-28 in the KV31F256 and 3-39 in the KV31F512 Ref Manuals and how to go about re-mapping pins and/or ADC inputs but when I can't find the BEMF_x variables/input anywhere in the documentation and/or source code and each one of the Pins that the BEMF_x feed into can either be ADC0 or ADC1 how would one know how to remap these inputs and/or where in the source this configuration is occurring. 

C.  What would be really helpful is to provide the following...

1) Point to where I can find the configuration and use of the BEMF_x signals that are shown in the schematic in the source code and/or the variable/structure elements that the BEMF_x corresponds to.  I am aware of adc_sys.c but I do not see any comments indicating details as to BEMF_x inputs.

2) Update the chart that shows the KV31F resources & Pins to include the BEMF_x inputs and for bonus points put a note in the chart that V_in is not used in KMS or possibly indicate this in the schematics for the HVP kits.

Clarifications to any of the other questions would be very welcomed...

Regards,

Frank

0 Kudos
219 Views
linestream-adam
Senior Contributor I

Frank,

Philip and I were referring to the channel definition location in KMS v1.2.0.  If you are on a previous version of KMS, the ADC channels used are indicated in #defines in the adc_sys.c file.  Look for the #defines ADCx_SAMPLEy_CHANNEL where x is the specific ADC instance, and y is the specific sample instance.

0 Kudos
219 Views
appioninc
Contributor II

Hello Adam/Philip,

  Thank You kindly for the responses and sorry it took a while to get back to you was buried working on finishing our own custom PCB for this.  Yes I am on KMS1.1.0 so I was never finding the kms_hw.h file as mentioned earlier.  I have inspected the adc_sys.c as mentioned earlier and is where I had found the ADC configs prior so glad we have that sorted and and Thanks for clarifying the ADC0/ADC1 aspect that they can both sample the same pin I never quite realized that.

So my last question is whether it is worth updating to KMS1.2.  This must have been a rather recent update as it was only about 2-3months ago I downloaded KMS1.1.0 and at that time that was that latest version.  From what I can see in the KMS 1.2 Ver3 Usr Guide that changes are as shown below which I am not seeing anything that really would improve what I already have but please let me know if there have been any other improvements that are not shown here...I had an understanding that KMS would add support for PFC is that correct?

pastedImage_1.png

Regards,

Frank

0 Kudos
219 Views
philip_drake
NXP Employee
NXP Employee

We recommend that if you can, tp update to KMS 1.2.0. As you will read in the release notes there were a few bug fixes and support for MCUXpresso IDE and the pins and clocks tools. Also this updated the SDK to version 2.x.  These configuration tools are very handy in assigning new pin functionality on a custom PCB. 

KMS 1.2.0 was just released in December of 2017.

Best Regards,

Philip

0 Kudos
219 Views
philip_drake
NXP Employee
NXP Employee

Hello Frank,

I am the MCU expert and I will try to answer your other questions.

There will be no mention of the BEMF_A, B, C inputs  since they are not used in KMS. Since they are not used the table in the KMSUG will be the ony inputs you need to worry about in your design. 

The HVP platform was designed to be used for a number of different motor types and reference designs.  KMS using only what it needs to control the motor.   NXP provides reference designs for customer who have extensive motor control experience and we use the HVP platform as an evaluation platform for quite a few of these reference designs. 

The ADC pins are defined in kms_hw.h; The file is in the {.project\board\} folder.  

Below are the default defines which show the board mapping. I have place a note in [ ...] with  the pin mapping on the 64 pin KV31F256. Note that the DP0 and DP3 inputs can be used in single ended mode. 

The way the Kinetis V pin mapping works with the ADC inputs is that a input pin can be sampled by either or both ADCs.

Take Pin 9: It is a dedicated ADC input pin that can be used as a differential input or a single ended input. It can be ADC0_DP0 and or ADC1_DP3

On pin 35: The ADC0_SE8 and or the ADC1_SE8 can sample the input pin. 

/**

* @def ADC0_SAMPLEA_CHANNEL

* @brief Channel to sample for motor control on ADC 0 Sample A

* Phase A Current

*/

#define ADC0_SAMPLEA_CHANNEL (8u)

[this corresponds to pin 35 ADC0_SE8 on the KV31F256VLH part ]

/**

* @def ADC0_SAMPLEB_CHANNEL

* @brief Channel to sample for motor control on ADC 0 Sample B

* DC Bus Voltage

*/

#define ADC0_SAMPLEB_CHANNEL (12u)

[this corresponds to pin 37 ADC0_SE12 on the KV31F256VLH part ]

/**

* @def ADC1_SAMPLEA_CHANNEL

* @brief Channel to sample for motor control on ADC 1 Sample A

* Phase B Current

*/

#define ADC1_SAMPLEA_CHANNEL (0u)

[this corresponds to pin 11 ADC1_DP0 on the KV31F256VLH part ]

/**

* @def ADC1_SAMPLEB_CHANNEL

* @brief Channel to sample for motor control on ADC 1 Sample B

* Phase C Current

*/

#define ADC1_SAMPLEB_CHANNEL (3u)

[this corresponds to pin 9 ADC1_DP3 on the KV31F256VLH part ]


Filters:

The RC input filters are designed to minimize the noise injection from the motor.  The components are sized based on the experience of the hardware designers and correspond to the expected maximum PWM rate of under 20-30 KHz. Without the filters the feedback signal might be useless to the control algorithm.

Regarding The V_in going to 2 pins.  The software for KMS does not use these inputs - it uses the DC_Bus_input pin 37-  ADC0_SE12.

NXP's other reference designs program the ADC to sample V_in and to use the Comparator input to engage the over-voltage shunt resistor terminals.  The HVP also has a built in comparator to engage the over-voltage resistor without the use of the MCU.

ANSWER to BRegardsing R

NMI: The MCU has a pin labeled NMI.  If not specifically disabled by the software a low on this input will result in the NMI interrupt vector fetch and trying to execute what ever code is there.  The pin can be set to be a PORTA4 input or output.  If it is re-purposed for another pin function then the NMI functionality is disabled.

The Relay Line: KMS does not use the Relay.  This is controlling the PFC input  and KMS does not include the PFC software drivers. If you require PFC then I can direct you to a reference project you can use to include into the KMS project. (Note that I have not done this before myself, but I am told it is possible).

I hope this helps.

Regards,

Philip Drake

0 Kudos
219 Views
appioninc
Contributor II

Another question has arose in the schematic/functionality of the HVP-KV31F and the KMS Configuration.  The PCI-Express and HVP schematics all show ADC inputs for BEMF_A, B, and C.  When I look for faults, thresholds, etc in both the source code and documentation I am not finding anywhere that calls out a fault or structure element referring to BEMF for the phases? 

For my custom PCB I am moving from the 100pin KV31F512 to the 64pin KV31F256.  The Net/ADC input for AN10-BEMF_C that is on the 100pin package(pin 17) there is not the same pin on the 64pin KV31F256 so I need to know how to remap this to a different pin/ADC input and where this is handled in the source and I am not finding this?

From the HVP-31F120M Schematic...Pin17 with ADC1_DM1/ADC0_DM2 does not exist on the 64pin KV31F256

pastedImage_2.png

Further if I look at the KMS100UG it shows the resources consumed by KMS with the HVP-31F board and it does not show any of the BEMF inputs?

pastedImage_1.png

Regards,

Frank

0 Kudos
219 Views
linestream-adam
Senior Contributor I

Frank,

You are correct, KMS does not use the BEMF voltage sense lines.

0 Kudos