New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Atmega2560: xtimer doesn't work correctly #3186
Comments
Any ideas @N8Fear, @haukepetersen? |
|
Yes, I think there should be three (looking at the |
It seems to me that the atmega2560 timer.c implementation is the problem. I'm having a hard time understanding what it is actually trying to do. It secretly redefines the timer_init us_per_tick as ticks_per_us and then does something I don't yet understand. It could simply use a prescaler to get the 1MHz rate(I think that is what is needed?). Is the timer supposed to run periodically or just once? |
Hi @raidoz, welcome and thanks for your message! I currently don't find time to go into details here. @kaspar030 does |
Is xtimer working correctly on that board? @ReneHerthel? |
@PeterKietzmann Testing results:
|
@kaspar030 any ideas about the outcome of tests/xtimer_hang? |
@PeterKietzmann Thanks for the hint. Just want to say that I testet it and it works, no problem :) |
Everything went as expected, except |
@PeterKietzmann I'm sorry. So now it runs always til 62%. It runs many times and couldn't see anything other. Same behavior as bevor. Only the value changed. |
Any new insights here? |
Actually I am looking into, will let you know my findings... |
@haukepetersen Last time I played with 2560 it seemed to me that there's a general problem with it's interrupt handling. xtimer on itself seemed to work fine (unless having too much isr pressure). Even threaded printf output would sometimes come garbled. |
I updated the PR title to match the current problem. |
@kaspar030: very likely. I re-implemented the UART and gpio driver so far, looking at the timer now. Also started to re-structure some of the code, so hopefully I will be able to find these issues when testing all my stuff in depth... My (playful) goal is to run RIOT (in some restricted way) on my old ATmega8 with 512 byte RAM... |
@ReneHerthel would you give it another try please?! Maybe it was fixed in the meantime. Otherwise could you borrow me your board please? |
Maybe if you will test this you can take a look at #5083 ? |
I'm looking into it but I have problems with some tests. I'll report them asap. |
I ran all xtimer tests on Arduino MEGA 2560, initialising the timer at 250000 ticks (prescaler at 16MHz/256) xtimer_drift: hangs and reboots I would say that in general it works but it still need some work... I'm trying to do some improvements but takes time. |
Just a side issue: the bad results in some tests (e.g. |
Yeah that was something I thought too, maybe when the reworked UART is ready we can redo the tests. So, we can say that xtimer works as expected? Please note too that for better results the initialisation ticks for xtimer were reduced significantly. It means that we will need to abstract such initialisation to make it dependent on the CPU clock configured for such board. |
I don't quite understand what you mean herre. After all, at least the |
I mean that the function |
hä, I still don't get it. The |
Shifting it by 4 should be enough, I'll do a PR after the release |
This is just a report of running the xtimer tests with current master xtimer_drift: hangs and reboots
xtimer_longterm: (with #5576) reboots after ~3min
xtimer_msg: ok
|
Let's wait for the several xtimer PRs that could improve and even solve this issue... For now changing the |
Since there are several timer PRs to be reviewed and hopefully merged, I think it's reasonable to move this issue to the next release. |
Just tested again all xtimer* on arduino-mega2560 with success. Perhaps #5763 fixed it. |
@kYc0o "Fixed issue from last release" is for issues mentioned in 2016.07 release notes only ;-) |
Oh, I thought I had put this on the known issues. |
The hwtimer tests don't work properly on the arduino-mega2560. The
hwtimer_spin
test seems to be fine. Running thehwtimer_wait
test I never reach the end of the program. Running thehwtimer
test I get the following output. The board seems to restart periodically.And so on and so on ...
The text was updated successfully, but these errors were encountered: