You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
- Thats a weird problem. As I know, there is no interrupt priority on AVR chips. If an interrupt happens, while another ISR is currently running, the corresponding flag is set and the ISR execution will happen after the first ISR finishes. Do you have access to an oscilloscope or a logic analyzer? It might be good to check, if the expected signal is getting outputted on the motor2 pin. Maybe there is a hardware problem. Or are you having any code, that might use one of the timers?chrisl– chrisl2021-02-25 10:45:15 +00:00Commented Feb 25, 2021 at 10:45
- Thanks for your response @chrisl . I discard hardware problems since the whole system does work in all other situations. I have now tried to change the prescaler of the timers. They were set to 1 but now I have configured them to 8, so timers how a frequency of 2MHz now. Surprisingly, the system does not fail now, the whole sequence is done with no errors and none of the interruptions freeze. I suppose that by reducing the timers' frequency, they may now be working under less "pressure" so that they may not be hitting each other.Izar Thomson– Izar Thomson2021-02-25 13:02:12 +00:00Commented Feb 25, 2021 at 13:02
- @chrisl There is what is called "natural priority" - each intrerupt has a number, and they are checked in sequence - interrupts with lower numbers happen before those with higher numbers. If a lower numbered interrupt re-occurs before the higher numbered one has a chance to run it will be responded to in preference to that higher numbered one. Which is why ISRs need to be as short as possible.Majenko– Majenko2021-02-25 13:02:26 +00:00Commented Feb 25, 2021 at 13:02
- @Majenko I have implemented these timer interruptions at a frequency way higher than the one the crash I mentioned before happens. When this situation happens and my interruptions stop, none of them have a frequency higher than 500Hz, while, with the same code, they can make simultaneous movements at 4kHz. With this I mean that my code inside interruptions doesn't last enough for not letting other interruptions to happen. In my critical case, the ISR frequencies are low enough to run all the code inside but, with no sense, one of them simply gets stuck.Izar Thomson– Izar Thomson2021-02-25 13:08:12 +00:00Commented Feb 25, 2021 at 13:08
- @Majenko Oh, interessting. Didn't know that, thanks :)chrisl– chrisl2021-02-25 13:30:55 +00:00Commented Feb 25, 2021 at 13:30
| Show 1 more comment
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. arduino-uno), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you