hwFault preventing KMS from exiting DSM_FAULT state

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

hwFault preventing KMS from exiting DSM_FAULT state

1,450 Views
derekcook
Senior Contributor I

Hello, 

I have adapted KMS for my own hardware, and am running into the hwFault bit always being set under clearable faults. It looks like this is a HW fault that is triggered by DC Bus Over Voltage or Peak Over Current, however, I do not see faults on these bits? 

pastedImage_1.png

Where in the code can I find where the hwFault is being set? I do not see it with the reset of the fault logic in dsm.c. 

Labels (1)
0 Kudos
10 Replies

1,015 Views
derekcook
Senior Contributor I

Hey Adam, 

Just letting you know that I got this working. For some reason, I had a passive filter enabled on the output pin. I disabled this, and the pin started working. 

0 Kudos

1,015 Views
derekcook
Senior Contributor I

Hey Adam, 

I will do that for those desat and rdy pins. Thanks for the help. I am also having an issue with the PTA19 pin that KMS uses as the Fault Input that I am using as an output. I cannot get this pin to output higher than 1V when I drive it high. I need it to go above 2V when it is driven high. Do I need to change something else in KMS to be able to use this pin? 

My configuration for this pin in my pin_mux.c file is: 

/* PORTA19 (pin 51) is configured as PTA19 */
PORT_SetPinMux(BOARD_INITPINS_PWM_ENA_GLB_PORT, BOARD_INITPINS_PWM_ENA_GLB_PIN, kPORT_MuxAsGpio);

The pin_mux.h file has: 

/*! @name PORTA19 (number 51), PWM_ENA_GLB
@{ */
#define BOARD_INITPINS_PWM_ENA_GLB_PERIPHERAL GPIOA /*!<@brief Device name: GPIOA */
#define BOARD_INITPINS_PWM_ENA_GLB_SIGNAL GPIO /*!<@brief GPIOA signal: GPIO */
#define BOARD_INITPINS_PWM_ENA_GLB_GPIO GPIOA /*!<@brief GPIO device name: GPIOA */
#define BOARD_INITPINS_PWM_ENA_GLB_GPIO_PIN 19U /*!<@brief PORTA pin index: 19 */
#define BOARD_INITPINS_PWM_ENA_GLB_PORT PORTA /*!<@brief PORT device name: PORTA */
#define BOARD_INITPINS_PWM_ENA_GLB_PIN 19U /*!<@brief PORTA pin index: 19 */
#define BOARD_INITPINS_PWM_ENA_GLB_CHANNEL 19 /*!<@brief GPIOA GPIO channel: 19 */
#define BOARD_INITPINS_PWM_ENA_GLB_PIN_NAME PTA19 /*!<@brief Pin name */
#define BOARD_INITPINS_PWM_ENA_GLB_LABEL "PWM_ENA_GLB" /*!<@brief Label */
#define BOARD_INITPINS_PWM_ENA_GLB_NAME "PWM_ENA_GLB" /*!<@brief Identifier name */
#define BOARD_INITPINS_PWM_ENA_GLB_DIRECTION kPIN_MUX_DirectionOutput /*!<@brief Direction */
/* @} */

When I initialize it, I do the following in my pin init file: 

const port_pin_config_t defaultOutputPort_config =
{
kPORT_PullDisable,
kPORT_SlowSlewRate,
kPORT_OpenDrainDisable,
kPORT_PassiveFilterEnable,
kPORT_LowDriveStrength,
kPORT_MuxAsGpio,
kPORT_UnlockRegister,
};

const gpio_pin_config_t output_low_config =
{
kGPIO_DigitalOutput,
(uint8_t)0U /* Set default logic low */
};

PORT_SetPinConfig(BOARD_INITPINS_PWM_ENA_GLB_PORT, BOARD_INITPINS_PWM_ENA_GLB_PIN, &defaultOutputPort_config);

GPIO_PinInit(BOARD_INITPINS_PWM_ENA_GLB_GPIO, BOARD_INITPINS_PWM_ENA_GLB_PIN, &output_low_config);

0 Kudos

1,015 Views
linestream-adam
Senior Contributor I

KMS shouldn't be doing anything with that pin. You've got the pin setup as a GPIO.

Do you have an external pull-up on that pin? Could be that whatever it is driving is pulling more current than the MCU can source and so it is dragging the voltage down.  You could try enabling the internal pull-up and setting it for high drive strength.

0 Kudos

1,015 Views
derekcook
Senior Contributor I

Adam, 

Actually changing the hwFault to the value of the desat and rdy pins in dsm_sys is not enough the flex timer module will still be disabled based on the value of Fault 0 in the FTM. Temporarily I disabled the fault so I can move on with testing. 

// Enable Fault 0 - connected to FNB41560 over current comparator output
//KMS_PWM->FLTCTRL = FTM_FLTCTRL_FAULT0EN_MASK;

However, I would like to set this fault to the value of the desat and ready pins. 

0 Kudos

1,015 Views
linestream-adam
Senior Contributor I

Yep, the hwFault was simply the software identifying the fault. You are going to need to dig into the Pins & Clocks tool and the MCU Reference Manual to get your pin muxes setup correctly.

0 Kudos

1,015 Views
derekcook
Senior Contributor I

Hey Adam, 

Where would I make these changes in the pwm_sys.c file so that I can use these signals to automatically shutoff the flex timer?

0 Kudos

1,015 Views
linestream-adam
Senior Contributor I

You would need to make those changes in the pin_mux.c file. This was generated using the MCUXpresso Pins & Clocks tool.  You need to associate the pin with a FTM0_FAULTX input. The reference manual for the MCU should have all of the specific details.

0 Kudos

1,014 Views
derekcook
Senior Contributor I

Thanks Adam, 

I figured out the problem. This fault comes in on Pin PTA_19 on the KV3x, and I have repurposed this pin in my hardware. I would want to change the hwFault to the value of my gate driver desat and ready lines. 

Do I need to do anything in pwm_sys? Would doing this cause in dsm_sys a problem? 

retval.bits.hwFault = (!GPIO_ReadPinInput(BOARD_INITPINS_DESAT_LEGA_GPIO, BOARD_INITPINS_DESAT_LEGA_PIN) || !GPIO_ReadPinInput(BOARD_INITPINS_DESAT_LEGB_GPIO, BOARD_INITPINS_DESAT_LEGB_PIN) || !GPIO_ReadPinInput(BOARD_INITPINS_DESAT_LEGC_GPIO, BOARD_INITPINS_DESAT_LEGC_PIN) || GPIO_ReadPinInput(BOARD_INITPINS_GATEDRIVER_RDY_GPIO, BOARD_INITPINS_GATEDRIVER_RDY_PIN));

0 Kudos

1,015 Views
linestream-adam
Senior Contributor I

If you want the FlexTimer to automatically shutoff based on the status of your desat and ready pins, you should use the fault inputs provided. To use these you would need to make changes to the pwm_sys.c file (to setup the fault) and the pin_mux.c/pin_mux.h (to setup the pin).

I have seen issues with some customers where their fault lines were noisy and they needed to setup the filters on those pins. YMMV

Seems like your logic to check the status of those pins for hwFault should work. If you set them up as FlexTimer faults, you can read the status of those faults similar to what we did initially.

1,014 Views
linestream-adam
Senior Contributor I

Derek,

The hwFault is the fault pin that comes from the IPM. The pwm_sys.c file configures the the FlexTimer fault input to disable the FlexTimer when that IPM fault is triggered. In the dsm_sys.c file we read the status of this configured fault in the FlexTimer and set that to hwFault.