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

cross mob
Translation_Bot
Community Manager
Community Manager
Community Manager

Hello, I recently encountered a strange problem when trying to use TCPWM to achieve pulse width capture. I configured the channel to capture mode, and configured CC0 for rising edge capture and CC1 for falling edge capture, but the actual observed values were refreshed along with CC1. Why is that?

xxwyxj_0-1703841557140.png

This is a register value

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/TRAVEO-T2G/TCPWM%E8%BE%93%E5%85%A5%E8%84%89%E5%AE%BD%E6%8D%95%E8%8E%B7%E6%95%B0%E6%8D%AE%E5%BC%82%E5%B8%B8/td-p/668668

0 Likes
1 Solution
JJack
Level 5
Level 5
Associated Partner - Distributor Rutronik
5 questions asked 25 likes received 100 sign-ins

Hi,

I wonder if the reason for this behaviour lies in the configuration of the trigger multiplexer and not in the TCPWM.

Maybe it is like this: The trigger multiplexer has a feature to generate a pulse from an edge, see register PERI_TR_GR_TR_CTL.

JJack_0-1704286934237.png

So, if TR_EDGE == 1 then instead of the original signal the TCPWM trigger inputs see short pulses where there have been edges. And every one of these short pulses has both a positive and a negative edge. This makes the edge sensitivity of the trigger inputs of the TCPWM useless for your purpose.

Conclusion: Make shure TR_EDGE is 0 so that the original edges propagate through the trigger multiplexer.

Maybe you can elaborate some more on your trigger signals and the configuration of the trigger multiplexer.

BR

JJack

View solution in original post

0 Likes
8 Replies
Translation_Bot
Community Manager
Community Manager
Community Manager

Hello,

What version of SDL are you using? Which sample code was used?

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/TRAVEO-T2G/TCPWM%E8%BE%93%E5%85%A5%E8%84%89%E5%AE%BD%E6%8D%95%E8%8E%B7%E6%95%B0%E6%8D%AE%E5%BC%82%E5%B8%B8/m-p/668697

0 Likes
Translation_Bot
Community Manager
Community Manager
Community Manager

Hello, I should use half of the HAL library. The CYT4BF for the MCU. I don't know why the HAL library limits the use of only the rising edge, but the register description is OK, so I used the clock initialization part of the HAL library, and the others are self-written register values. The end effect is that the capture interruption can be correctly triggered and the count value is correct (clock 1M, test pulse is 1K, 50% duty cycle, changed to 1hz for convenience). The only problem is that the CC1 capture on the configured falling edge was updated simultaneously. However, the EDGE_SEL register is configured to update CC1 on the falling edge

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/TRAVEO-T2G/TCPWM%E8%BE%93%E5%85%A5%E8%84%89%E5%AE%BD%E6%8D%95%E8%8E%B7%E6%95%B0%E6%8D%AE%E5%BC%82%E5%B8%B8/m-p/668701

0 Likes
Translation_Bot
Community Manager
Community Manager
Community Manager

Also, the test pin used is P7_6

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/TRAVEO-T2G/TCPWM%E8%BE%93%E5%85%A5%E8%84%89%E5%AE%BD%E6%8D%95%E8%8E%B7%E6%95%B0%E6%8D%AE%E5%BC%82%E5%B8%B8/m-p/668702

0 Likes
Translation_Bot
Community Manager
Community Manager
Community Manager

Hello,

What IDE are you currently developing and using?

We generally recommend that customers use the SDL library for development, which is specific to the Traveo II series.

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/TRAVEO-T2G/TCPWM%E8%BE%93%E5%85%A5%E8%84%89%E5%AE%BD%E6%8D%95%E8%8E%B7%E6%95%B0%E6%8D%AE%E5%BC%82%E5%B8%B8/m-p/669130

0 Likes
Translation_Bot
Community Manager
Community Manager
Community Manager

Hello, I'm using MDK5.38a, and I haven't used the SDL library because I haven't found an SDL library routine project 😥

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/TRAVEO-T2G/TCPWM%E8%BE%93%E5%85%A5%E8%84%89%E5%AE%BD%E6%8D%95%E8%8E%B7%E6%95%B0%E6%8D%AE%E5%BC%82%E5%B8%B8/m-p/669133

0 Likes
JJack
Level 5
Level 5
Associated Partner - Distributor Rutronik
5 questions asked 25 likes received 100 sign-ins

Hi,

I wonder if the reason for this behaviour lies in the configuration of the trigger multiplexer and not in the TCPWM.

Maybe it is like this: The trigger multiplexer has a feature to generate a pulse from an edge, see register PERI_TR_GR_TR_CTL.

JJack_0-1704286934237.png

So, if TR_EDGE == 1 then instead of the original signal the TCPWM trigger inputs see short pulses where there have been edges. And every one of these short pulses has both a positive and a negative edge. This makes the edge sensitivity of the trigger inputs of the TCPWM useless for your purpose.

Conclusion: Make shure TR_EDGE is 0 so that the original edges propagate through the trigger multiplexer.

Maybe you can elaborate some more on your trigger signals and the configuration of the trigger multiplexer.

BR

JJack

0 Likes
Translation_Bot
Community Manager
Community Manager
Community Manager

Hi Translation_Bot!

I just tried to verify that this is indeed the reason the trigger is set to the edge. The TCPWM configuration is normal. The short pulse of the trigger allows both CC0 and CC1 to refresh the data at the same time. Thanks for your response, this problem was successfully solved. However, it seems that the pulse width capture function cannot be achieved by simply using the HAL library, or the HAL library does not support pulse width capture, because there are two limitations in the HAL library: 1. TCPWM cannot be configured for edge sampling without edge triggering; 2. TCPWM edge sampling only opens the rising edge, which means it is difficult to achieve pulse width capture. The pulse width capture function can only be achieved by configuring additional registers or modifying the HAL library function. Finally, thank you again for the solution!


smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/TRAVEO-T2G/TCPWM%E8%BE%93%E5%85%A5%E8%84%89%E5%AE%BD%E6%8D%95%E8%8E%B7%E6%95%B0%E6%8D%AE%E5%BC%82%E5%B8%B8/m-p/670368

0 Likes
JJack
Level 5
Level 5
Associated Partner - Distributor Rutronik
5 questions asked 25 likes received 100 sign-ins

Hi xxwy-xj,

if you are happy with the answer of my post please mark it as solution to your question 🙂.

BR

JJack

0 Likes