Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

AURIX™ Forum Discussions

Kumaresh
Level 1
25 sign-ins 5 replies posted 5 questions asked
Level 1

Hi,

Wanted to know whether is there a way to measure rising and falling edge timestamp from single TIM channel ?

Thanks,

Kumaresh

0 Likes
2 Replies
Yuva
Moderator
Moderator 100 sign-ins 10 likes received 100 replies posted
Moderator

Hello,

Yes, this can be supported by setting TIM[i]_CH[x]_CTRL.ISL to detect both the edges and configure GPRx_SEL/ EGPRx_SEL to store the TBU (timestamp) to GPRx.

Thanks.

0 Likes
Kumaresh
Level 1
25 sign-ins 5 replies posted 5 questions asked
Level 1

Hi,

The solution is not working. Added my implementation and output in detail could you pls have a look

I am trying to measure the duty cycle of the waveform with the time difference between rising and falling edge timstamp. The waveform has a period of 100 us and on time of 56 us. 

Implementation

We read the var diff which subtracts the previous and current timestamp measurement from GPR1 reg. This func is being called by master trigger pulse every 100 us

 

FS_Ph_Timestamp_prev = FS_Ph_Timestamp_current;
FS_Ph_Timestamp_current = (float)((GTM_Module_Ptr_temp->TIM[3].CH2.GPR1.B.GPR1)* 0.00000001);
diff = FS_Ph_Timestamp_prev - FS_Ph_Timestamp_current;

O/P from above suggested configuration

Kumaresh_0-1656593249845.png

Thanks,

Kumaresh

0 Likes