Skip to main content
Associate
April 27, 2024
Solved

STM32H730 / timer capture triggered by USB_SOF not working

Hello,

we are having an issue on the STM32H730 ; we would like to have a Timer Capture triggered by the USB OTG SOF signal. This should be straightforward since the USB1_OTG_HS_SOF signal is connected to TIM2 ITR5.

 

However, we never managed to have the capture triggered by this signal.

 

We use the following code:

// Start the USB stack, etc.

// Configure the TIM2 IC

__TIM2_CLK_ENABLE();
LL_TIM_IC_Config(TIM2, LL_TIM_CHANNEL_CH1, LL_TIM_ACTIVEINPUT_TRC | LL_TIM_IC_FILTER_FDIV1 | LL_TIM_IC_POLARITY_RISING);
LL_TIM_SetTriggerInput(TIM2, LL_TIM_TS_ITR5);
LL_TIM_IC_SetActiveInput(TIM2, LL_TIM_CHANNEL_CH1, LL_TIM_ACTIVEINPUT_TRC); 
LL_TIM_EnableCounter(TIM2);

When there is USB audio traffic (that we also receive on the PC, so it is definitely working), the TIM2->CCR1 stays at zero and never changes (+ we have checked that the timer is counting of course).

Also, when we enable the USB SOF IRQs, they are triggered indeed. But the timer capture still isn't triggered and stays at zero.

 

Has this feature been tested at all? Is there something we are missing in the timer configuration?

 

Thanks,

Florent

This topic has been closed for replies.
FBLBest answer
ST Technical Moderator
May 13, 2024

Hi @florent_b 

I had made a simple test on H745 disco board and I can see the timer counter is triggered as expected.

FBL_0-1715614411974.png

 

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL

5 replies

ST Technical Moderator
May 10, 2024

Hi @florent_b 

Would you share the example project to reproduce the issue ?

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
florent_bAuthor
Associate
May 10, 2024

Hello,
the whole project is large and is working only on our custom board, so it wouldn't be feasible.

Also I don't have ST eval boards so it hard for me to just make a simple example.
Would it be possible to check on your eval board ?

Also, can you confirm that it can be done (in theory)? I am not sure if it can be done at all.

 

Thanks,
Florent

FBLBest answer
ST Technical Moderator
May 13, 2024

Hi @florent_b 

I had made a simple test on H745 disco board and I can see the timer counter is triggered as expected.

FBL_0-1715614411974.png

 

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
florent_bAuthor
Associate
May 13, 2024

Hello,
thanks for your testing! 

But it is not what I want to do : I would like to have the timer count on PCLK clock as usual, and trigger the capture when the USB SOF event happens. So as to automatically timestamp the SOF instant.

 

Thanks,
Florent

florent_bAuthor
Associate
June 12, 2024

Hello,
I see that the topic has been closed with a valid solution, but as I mentioned above it is not what I would like to achieve.

Should I consider that it is not possible to have a capture triggered by the SOF event?


Thanks,
Florent