problem writing to etpu hsrr register

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

problem writing to etpu hsrr register

593 Views
vrushalitaklika
Contributor III

Hi,

I am configuring etpu_a channel 0 for pwm generation.

I have downloaded the etpu pwm apis, however in function fs_etpu_pwm_init

int32_t fs_etpu_pwm_init( uint8_t channel, uint8_t priority, uint32_t freq,
uint16_t duty, uint8_t polarity, uint8_t timebase, uint32_t timebase_freq)
{
uint32_t *pba; /* parameter base address for channel */
uint32_t chan_period;

......

/* write hsr to start channel running */
eTPU->CHAN[channel].HSRR.R = FS_ETPU_PWM_INIT;

return(0);
}

not able to write anything in HSRR register.

I am using basic etpu generation code and example only.

Any suggestion???

Regards

Vrushali

0 Kudos
2 Replies

449 Views
vrushalitaklika
Contributor III

I further debug the code and found that

Before writing CR and SCR register, We can update HSRR register, 

After cofniguring CR and SCR register, value of HSRR is changed by 0 and non-writable mode.

eTPU->CHAN[channel].HSRR.R = FS_ETPU_PWM_INIT;
/* write channel configuration register */
eTPU->CHAN[channel].CR.R = (priority << 28) +
(FS_ETPU_PWM_TABLE_SELECT << 24) +
(FS_ETPU_PWM_FUNCTION_NUMBER << 16) +
(((uint32_t)pba - fs_etpu_data_ram_start)>>3);

/* write FM (function mode) bits */
eTPU->CHAN[channel].SCR.R = (timebase << 1) + polarity;

0 Kudos

449 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Hi, description says ETPUCxHSRR[HSR] reflects pending HSR and can be written only if this field is zero since running thread cannot be aborted and must be finished.

0 Kudos