Part Number:AM5708
Tool/software: TI-RTOS
Hello,
We want to configure the ECAP1 as PWM from DSP in AM5708, but it doesnn't work when RT-Linux is running on A15.
Wee see a square wave but with changing frequency and duty cycle, as if something was writting/ changing the system clock.
If we check the value of the registers, the period and compare values are ok. However, although PWMSS1_CLKCTRL is initially 0 and then correctli initialized, afterwards equals 0x20000.
The program is as follows:
/* Enables clock for PWM module */
static void pwmClockConfig(void)
{
/* Enable PRCM for PWMSS1 */
HW_WR_REG32(SOC_L4PER_CM_CORE_BASE + CM_L4PER2_PWMSS1_CLKCTRL, 0x2);
//TODO: Timer for returning when it fails
while ((HW_RD_REG32(SOC_L4PER_CM_CORE_BASE +
CM_L4PER2_PWMSS1_CLKCTRL) & (0x00030000)) != 0x0);
/* Time base clock for PWMSS1 module */
HW_WR_FIELD32(SOC_CTRL_MODULE_CORE_CORE_REGISTERS_BASE +
CTRL_CORE_CONTROL_IO_2,
CTRL_CORE_CONTROL_IO_2_PWMSS1_TBCLKEN, 1);
}
/* Configures pinmux for PWM module */
static void pwmPinmuxConfig(void)
{
uint32_t regVal;
regVal = HW_RD_REG32(CTRL_CORE_PAD_VIN2A_D2_ADDR);
regVal = ((regVal & ~0x0F) | 0x0A);
HW_WR_REG32(CTRL_CORE_PAD_VIN2A_D2_ADDR, regVal);
}
int APWM_Init(void)
{
pwmClockConfig();
pwmPinmuxConfig();
ECAPOperatingModeSelect(APWM_BASE_ADDRESS, ECAP_APWM_MODE);
ECAPCounterConfig(APWM_BASE_ADDRESS, 0);
ECAPAPWMPolarityConfig(APWM_BASE_ADDRESS, ECAP_APWM_ACTIVE_HIGH);
ECAPAPWMCaptureConfig(APWM_BASE_ADDRESS, COMPARE_APWM, PERIOD_APWM);
ECAPCounterControl(APWM_BASE_ADDRESS, ECAP_COUNTER_FREE_RUNNING);
}
In the dts VIN2A is:
vin2a = "/ocp/vip@0x48970000/port@1";
vip@0x48970000 {
compatible = "ti,vip1";
reg = <0x48970000 0x114 0x48975500 0xd8 0x48975700 0x18 0x48975800 0x80 0x48975a00 0xd8 0x48975c00 0x18 0x48975d00 0x80 0x4897d000 0x400>;
reg-names = "vip", "parser0", "csc0", "sc0", "parser1", "csc1", "sc1", "vpdma";
ti,hwmods = "vip1";
interrupts = <0x0 0x15f 0x4 0x0 0x188 0x4>;
syscon-pol = <0x8 0x534>;
#address-cells = <0x1>;
#size-cells = <0x0>;
status = "disabled";
phandle = <0x210>;
port@0 {
#address-cells = <0x1>;
#size-cells = <0x0>;
reg = <0x0>;
status = "disabled";
phandle = <0x211>;
};
port@1 {
#address-cells = <0x1>;
#size-cells = <0x0>;
reg = <0x1>;
status = "disabled";
phandle = <0xcf>;
endpoint@0 {
slave-mode;
remote-endpoint = <0x124>;
};
Does it mean that it is disabled and should not interfere with the APWM in DSP? What can be the problem?
The APWM works correctly when RT Linux is not on A15.
Thanks and best regards,
Laura