AM5729: program any of the PWMSS from a PRU-ICSS

Part Number: AM5729
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Dear everybody,

I try to use any of the PWMSS ( 1, 2 or 3 ) from one of the PRU-ICSS but I do not succeed to see any signal on my oscilloscope. I am missing something. Could you give me some advice please?

My test program is below. I have checked it is running with a gpio (not shown here).

Best regards,

Hakim

#include <stdint.h>
#include <pru_cfg.h>
#include "resource_table_empty.h"
#include <am572x_2_0/sys_pwmss.h>
#include <am572x_2_0/pru_cfg.h>


#define CTRL_CORE_PAD_VIN2A_D9 (0x4A00358C)
#define CTRL_CORE_PAD_VIN2A_D10 (0x4A003590)

#define CTRL_CORE_CONTROL_IO_2 (0x4A002558)


#define TB_COUNT_UPDOWN 0x2
#define TB_DISABLE 0x0
#define TB_SHADOW 0x0
#define TB_SYNC_DISABLE 0x3
#define AQ_CLEAR 0x1
#define AQ_SET 0x2
#define PWMSS1_TBCLKEN (20)
#define PWMSS2_TBCLKEN (21)
#define PWMSS3_TBCLKEN (22)
#define TB_DIV1 0x0


void pwmtest (void){
*((volatile uint32_t *) CTRL_CORE_PAD_VIN2A_D9) = 10;
*((volatile uint32_t *) CTRL_CORE_PAD_VIN2A_D10) = 10;

PWMSS0.SYSCONFIG_bit.SOFTRESET=1;
__delay_cycles(100000);
PWMSS0.SYSCONFIG_bit.IDLEMODE = 1;
PWMSS0.CLKCONFIG_bit.EPWMCLK_EN = 1;
PWMSS0.EPWM_TBPRD = 600;
PWMSS0.EPWM_TBPHS = 0;
PWMSS0.EPWM_TBCNT = 0;
PWMSS0.EPWM_TBCTL = (TB_COUNT_UPDOWN << 0) | (TB_DISABLE << 2) | (TB_SHADOW << 3) | (TB_SYNC_DISABLE << 4) | (TB_DIV1 << 7) | (TB_DIV1 << 10) ;
PWMSS0.EPWM_CMPA = 350;
PWMSS0.EPWM_CMPB = 400;
PWMSS0.EPWM_CMPCTL = 0;
PWMSS0.EPWM_AQCTLA = (AQ_SET << 4) | (AQ_CLEAR << 6) ;
PWMSS0.EPWM_AQCTLB = (AQ_CLEAR << 4) | (AQ_SET << 6) ;
PWMSS0.EPWM_AQCSFRC = 0x22;

PWMSS1.SYSCONFIG_bit.SOFTRESET=1;
__delay_cycles(100000);
PWMSS1.SYSCONFIG_bit.IDLEMODE = 1;
PWMSS1.CLKCONFIG_bit.EPWMCLK_EN = 1;
PWMSS1.EPWM_TBPRD = 600;
PWMSS1.EPWM_TBPHS = 0;
PWMSS1.EPWM_TBCNT = 0;
PWMSS1.EPWM_TBCTL = (TB_COUNT_UPDOWN << 0) | (TB_DISABLE << 2) | (TB_SHADOW << 3) | (TB_SYNC_DISABLE << 4) | (TB_DIV1 << 7) | (TB_DIV1 << 10) ;
PWMSS1.EPWM_CMPA = 350;
PWMSS1.EPWM_CMPB = 400;
PWMSS1.EPWM_CMPCTL = 0;
PWMSS1.EPWM_AQCTLA = (AQ_SET << 4) | (AQ_CLEAR << 6) ;
PWMSS1.EPWM_AQCTLB = (AQ_CLEAR << 4) | (AQ_SET << 6) ;
PWMSS1.EPWM_AQCSFRC = 0x22;

PWMSS2.SYSCONFIG_bit.SOFTRESET=1;
__delay_cycles(100000);
PWMSS2.SYSCONFIG_bit.IDLEMODE = 1;
PWMSS2.CLKCONFIG_bit.EPWMCLK_EN = 1;
PWMSS2.EPWM_TBPRD = 600;
PWMSS2.EPWM_TBPHS = 0;
PWMSS2.EPWM_TBCNT = 0;
PWMSS2.EPWM_TBCTL = (TB_COUNT_UPDOWN << 0) | (TB_DISABLE << 2) | (TB_SHADOW << 3) | (TB_SYNC_DISABLE << 4) | (TB_DIV1 << 7) | (TB_DIV1 << 10) ;
PWMSS2.EPWM_CMPA = 350;
PWMSS2.EPWM_CMPB = 400;
PWMSS2.EPWM_CMPCTL = 0;
PWMSS2.EPWM_AQCTLA = (AQ_SET << 4) | (AQ_CLEAR << 6) ;
PWMSS2.EPWM_AQCTLB = (AQ_CLEAR << 4) | (AQ_SET << 6) ;
PWMSS2.EPWM_AQCSFRC = 0x22;



*(volatile uint32_t *) CTRL_CORE_CONTROL_IO_2 = (*(uint32_t *) CTRL_CORE_CONTROL_IO_2) | (1 << PWMSS1_TBCLKEN) | (1 << PWMSS2_TBCLKEN) | (1 << PWMSS3_TBCLKEN);


}

void main(void) {

/* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */
CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;

pwmtest ();

__halt();
}