Timer A not generating PWM signal on DRH4/DRL1 DRH3/DRL0 pins

Hello,

I’ve developed a motor control board using the PAC5524 microcontroller and to get started with understanding the SDK and how the microcontroller works, I’ve decided to control a DC brushed motor using an H bridge with the DRH4/DRL1 and DRH3/DRL0 pins.

To do this I used Timer A4 and TimerA5 using the motor control examples provided by qorvo for bldc control; however I only need to drive an H bridge for a simple DC motor just to start out.

The program isn’t generating PWM signals on the MOSFETs gates and I don’t know why.
I also programmed Timer C to blink an LED and its working fine, just the Timer A isn’t. Here’s the code for timer A init and the main function:

// Initialize the PWM signal for TAPWM4 (DRH4/DRL1) and TAPWM5 (DRH3/DRL0)
void pwm_init() {
// Set the PWM frequency for TAPWM4 and TAPWM5
const uint16_t period = 300000000/PWM_FREQUENCY; //300000000 - > clock 2 → divider 20000 → signal freq

 // Configure Timer A Controls
pac5xxx_timer_clock_config(TimerA, TXCTL_CS_ACLK, TXCTL_PS_DIV1); // Configure timer clock input for ACLK, /1 divider
pac5xxx_timer_base_config(TimerA, period, AUTO_RELOAD, TxCTL_MODE_UP, TIMER_SLAVE_SYNC_DISABLE); // Configure timer frequency and count mode

// Configure Dead time generators
PAC55XX_TIMERA->CTL.DTGCLK = BEFORE_ACLK_DIVIDER; // 0--> The DTGCLK is the clock before the TACTL.CLKDIV clock divider.
                                                  // 1--> The DTGCLK is the clock after the TACTL.CLKDIV clock divider.

pac5xxx_dtg_config2(&(PAC55XX_TIMERA->DTGCTL0), RED_DEATH_TIMET, FED_DEATH_TIMET);      // Configure DTGA0 for phase U
pac5xxx_dtg_config2(&(PAC55XX_TIMERA->DTGCTL1), RED_DEATH_TIMET, FED_DEATH_TIMET);      // Configure DTGA1 for phase V

PAC55XX_TIMERA->CTL.MODE = TxCTL_MODE_UP;
PAC55XX_TIMERA->CCTR4.CTR = period >>2;                                    // Set right PWM duty 25%
PAC55XX_TIMERA->CCTR5.CTR = period >>2;                                    // Set right PWM duty 25%

PAC55XX_SCC->PBMUXSEL.P4 = 0x1;                                             // 001b -> TAPWM4 - > family users guide pag- 127
PAC55XX_GPIOB->OUT.w = 0x04;			//PORTB OUT GPIO = 0;
PAC55XX_SCC->PBMUXSEL.w = 0x01110111;		//PORTB PSEL is ALL PWMs
//Configure PORTB Outputs to Push Pull
PAC55XX_GPIOB->MODE.w = 0x1515;

}

int main(void) {

// Disable global interrupts until initialization is complete
__disable_irq();
system_init();

// Initialize the PWM channels
pwm_init();

volatile int i;

configure_timer_c_compare_mode();
__enable_irq();

while(1){

    // Add some delay between toggles
    for(i=0; i < 500000; i++){
    }
}

return 0;

}

Thank you

Hi vitor.tinoco!

Welcome to the Qorvo Forum! Glad to see you getting started with PAC motor control devices!

I’d like to point to you to an example which I believe aligns exactly with you’re test setup

In our PAC55xx Peripheral Examples project, you’ll find a relevant test function in the timer/timer_app.c file called “TEST_TIMER_PWM_SYMMETRIC”

This example utilizes Timer A to generate PWM signals at the DRH/DRL pins of each phases, but you can easily modify to just use two for your H-Bridge setup. This code will serve you as a great reference!

Feel free to post follow-up questions regarding this example code or anything else related to PAC devices.

Hello,

Thank you very much. I’m now having a new issue, and I don’t know if the problem is on the chip or not. The Pins that are connected to the high side MOSFET gates always have logic level 1 even if I do not setup the PWM and force them to 0. The pins connected to the low side MOSFET gates work properly. Since the high side gates are always logic level 1, then the board gets a short to ground and turns off. The pins are PB4 PB5 and PB6 and they are connected directly to the gates with no other components.

Hi victor.tinoco,

Lets verify whether there’s a hardware issue by running our PAC FOC code with your PAC5524EVK. This will serve as a simple sanity check.

Follow these steps:

  1. Flash our “PAC55xx FOC Application FW” to your EVK. The only configuration needed is selecting your board in the “config_board.h” file. You can download here: PAC5524 - Qorvo
  2. Open GUI, located in the pac_foc/resources folder
  3. Select COM port.
  4. Click on “Write all Parameters” There’s no need to configure motor parameters.
  5. Now, without a motor connected, click on motor enable.
  6. You should see the message: “PWM Saturated” in the GUI status window. At this point you should be able to see the high/low side gate drive signals with the complementary dead time in between them.

However, If you receive an “OC Fault”, this indicates the board is damaged.