2022-05-10 01:21 AM
2022-05-10 06:06 AM
This is an English language forum. Please don't exclude others from your conversation.
JW
2022-05-10 06:13 AM
what ?
2022-05-10 09:50 AM
TBH I'd much prefer people to use whatever language they are most comfortable in expressing themselves, explaining the problem as completely as possible, and letting Google Translate get me something to interpret. I'd certainly prefer this over a brief word-salad as someone tries to express things awkwardly in English. I'll respond in English, and people can translate that back.
Graphics / screen-shots don't translate well, but will suffice in a push.
2022-05-10 09:53 AM
I would avoid the TIM1->SR RMW forms, the register is designed to automatically mask the writes such that there aren't race conditions, where you clear flags indiscriminately.
TIM1->SR &= 0xFE; // BAD FORM
TIM1->SR = 0xFE; // HOW HARDWARE WAS DESIGNED
2022-05-10 10:52 AM
This is probably a cultural thing. I grew up in a multilingual environment where trying to use the partner's language was a matter of courtesy as well as prudence. Sometimes this ended up in negotiating a common language and using third language (German, legacy of the Austrian empire) was one of the options.
In an a-priori given language forum, the person who asks should go the extra mile to make himself understood, otherwise he excludes himself from possible answers from those who are not willing to volunteer to answer, if it involves extra steps.
After all, how much of the STM32-related material is available in French?
JW
PS. I wonder who voted my rant as Best post here.
2022-05-10 12:08 PM
In TIM2 interrupt, you don't need to anything else, just read out TIM1->CNT and subtract it from previously read out value to find out the difference, and store the new value. Don't stop TIM1, don't clear TIM1->CNT. TIM1 is 16-bit counter, so you have to take this into account when TIM1->CNT overflows.
But first make sure TIM1 works - simply set it up as you intended, enable, and then without doing anything with it just observe in register view of debugger, if TIM1->CNT counts accordingly to the input signal.
JW
2022-05-10 12:22 PM
thanks.
2022-05-11 06:32 AM
I think it's a student's school homework, and he's trying to realize what's in the statement. Obviously it seems more efficient to achieve something other than what is requested...