cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G4 Can I use 'TRGO2' event signals from Advanced Timers (1,8,20) as event sources for Slave Timers?

AleksBak
Associate III

Hello!
Can I use 'TRGO2' event signals from Advanced Timers (1,8,20) as event sources for Slave Timers? The Reference Manual (RM0440 Rev 9, p. 381), the Internet, CubeMX and Google - all say "Yes", but in practice I could not use them for Slave Timers. I only found in one document that it is not allowed and now I do not understand whether it is true or not. Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

> I thought that this was the main document for this family of controllers.

Yes it is; nonetheless the STM32 form a continuum (e.g. the 'G4 timers are in no way unique) and some of the "rules" are historically given (see my rant above, the TIM interconnections used to be part of the TIMx_SMCR description) and some unwritten.

 

> nowhere is it said that one needs 'TIMx_TRGO', and the other 'TIMx_TRGO2'.

waclawekjan_0-1757606538860.png

 

JW

View solution in original post

8 REPLIES 8
waclawek.jan
Super User

Look at the slave timer's TIMx_SMCR description, there's a table which lists which timer can be used as master to that given slave timer.

[EDIT] OK so this is one of those new-fangled RMs, where this information is not there, where it used to be in older families' RM, but hidden at the beginning of TIM chapters and in the interconnect chapter (the page you've given is in that chapter, but you want to look at the table aptly named Interconnect 1).  So the answer is no, regardless of what the internets say. TRGO2 appears to be usable only to trigger ADC in 'G4.

Show how does CubeMX say this (I don't have/use it).

JW

TDK
Super User

The ITRx signals are hooked up to TRGO, not TRGO2, so it can't be used to trigger slave timers.

TDK_0-1757595225897.png

Search "TRGO2" in the reference manual and you'll see it's mostly used for triggering the ADCs.

 

If you feel a post has answered your question, please click "Accept as Solution".

@TDK wrote:

...

Search "TRGO2" in the reference manual and you'll see it's mostly used for triggering the ADCs.

 


I searched (and not just once and not only there). Here is a quote from the reference manual for STM32G4xx (RM0440 Rev 9, p. 381):

Triggering signals
The output (from Master) is on signal TIMx_TRGO (and TIMx_TRGO2 for TIM1/TIM8/TIM20) following a configurable timer event. ...

And nowhere is there a single word that 'TIMx_TRGO2' is intended only for ADC. In the tables (which you show me) in small print it is indicated that these are such sources (for ADC they are exactly the same), but neither for Timers, nor for ADC, nowhere is it said that one needs 'TIMx_TRGO', and the other 'TIMx_TRGO2'. If you do not believe me - see for yourself. It cost me a lot of time - until I understood this! I have only been working with the STM32G4 series and its unique Timers for a month and I actively read the RM0440. I thought that this was the main document for this family of controllers.

 

> I thought that this was the main document for this family of controllers.

Yes it is; nonetheless the STM32 form a continuum (e.g. the 'G4 timers are in no way unique) and some of the "rules" are historically given (see my rant above, the TIM interconnections used to be part of the TIMx_SMCR description) and some unwritten.

 

> nowhere is it said that one needs 'TIMx_TRGO', and the other 'TIMx_TRGO2'.

waclawekjan_0-1757606538860.png

 

JW


@waclawek.jan wrote:

....

Show how does CubeMX say this (I don't have/use it).

JW


I meant was that CubeMX allows you to configure it this way and generate non-working code.

Here is a quote from Google and its "artificial intelligence":

In the STM32G4, the TIM1 TRGO2 (Trigger Output 2) event serves as a synchronization signal from a master timer (TIM1) to control a slave timer's operation by selecting a triggering event in the slave's Master/Slave Configuration (SMCR) register.

Everyone claimed that such a thing was possible.

Thanks everyone for your answers.

waclawek.jan
Super User

> "artificial intelligence":

Okay, so take this as a lesson, that artificial intelligence is useless, when it comes to real truths, as it is a combination of the half-wrong information out there on the nets plus its own hallucinations.

Btw. it's not excluded that TRGO2 is used in some other STM32 family to trigger TIMs, too. The STM32 designers are free to make interconnects as they wish, and the gazillion transistors they have at hand in the newer technologies frankly sometimes unleash them in a wrong way.

JW

 

The RM says what is possible. It can't say everything that is not possible.

It says TRGO is used to trigger slave timers and that TRGO2 is used to trigger the ADC. Those are both true.

> Everyone claimed that such a thing was possible.

Who exactly is everyone here? The AI? The only two responses in this thread say the opposite.

If you feel a post has answered your question, please click "Accept as Solution".

@waclawek.jan wrote:

....

waclawekjan_0-1757606538860.png

 

JW


Thank you very much for taking the time to make color notes in this table. The most valuable thing for any person is his time and if he spends part of his time on someone else, it means he shares a small part of his most valuable. I will continue to study. All the best.