-
Notifications
You must be signed in to change notification settings - Fork 135
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
Strange axis jumping #62
Comments
Tried it now also with 9600 and 250000 baud rates. Of course with adjusted hex files which directly worked. Sadly still the same problem. It seems to be fixed at 8 bit with a max value of 254. That shouldn't be like that... I would really need the 10 bit. I'm trying to make a better recording of the error tomorrow. I also moved my axes to X,Y and Z. Still a problem there. |
2024-02-21.21-52-21.mp4 |
One thing that could be happening is that, if the signal on the ADC is jumping around a lot, especially since the loop is so simple, it might be updating the internal buffer on the main chip that gets set when sendControllerData(yourData) in the middle of when the communications chip is reading it. I.e., when the communications chip is asking for the X1 axis, it's getting ADC data read at T=0, but by the time the communications chip asks for the X2 axis, it's getting sent back ADC data read at T=1? One thing to try would be to add a super long delay in your loop(), like delay(1000), and then see what's happening. If the axes are still bouncing around faster than once per second, then that would indicate some kind of data corruption in the communication between the main and communication chips. It sounds like you've poked around in the ATmega8u2 code, but just to clarify for anyone, the overall data flow is: Arduino main chip runs your code, where you're setting up and setting virtual controller data, then using On the ATmega8u2 USB communications chip, it's both:
So, if there was instability in the main chip -> communications chip communication, then with delay(1000), we'd still see constant fluctuations, as every 10ms when the 8u2 polls the main chip, it's getting data that hasn't changed on the main chip's internal controller data buffer. If that communication were stable, though, we might occasionally see a bit of a blip if the loop() code happened to run right in time when the 8u2 was mid-read, but that data should then hold for the full second until the loop() runs again. I tried this on my end, and got stable reads in the unstable test condition, so it's definitely wonky ADC reads on my end, but let me know what you get - it's also possible that I'm not recreating your exact issue.... |
So, took me a while now. I'm wondering why you are not getting this issue. Are you moving the potentiometer fast enough? I tested it now on an original Arduino mega made in Italy and three Elegoo Arduino megas with 16u2 com chips. Also tested on three different computers. Everywhere the same issue. And yeah, as I said the issue disappears when using values from 0 to 255. All in all it sounds to me like there is something wrong with any buffer. |
Hello,
first of all, thanks for this great tool Alan, there is nothing equal out there.
Now to my strange problem, I hope I did everything correct.
In my short Video you can simply see the jumping axes: https://youtube.com/shorts/iRZpt27eo_4?feature=shared (bad cutted, in the end is an extreme jump, first completely to the right, then left, then back to center.
Tried now to build it back to the most easy state to reproduce it.
I'm currently sitting in a train, thats why I don't have a potentiometer or something else. Did now the following: plugged 3.3V into A0 and removed it. Repeated that until the error occured. These are the results: https://youtube.com/shorts/82W1IY1axrM?feature=shared (X-Rotation jumping)
As you can see, single axes are jumping back and forward even if
test
should have the exact same value to all axes. I'm pretty sure that these jumps are the exact same ones that occure in the first video. I'm also pretty sure that these jumps are not from the analog input source. Hope this experiment proved that a bit.Used an original Arduino Mega made in Italy. Reproducable on every computer and also on Elegoo Arduinos.
Tested values 10 bit, 0 - 1024 (and 16 bit Arduino int)
The text was updated successfully, but these errors were encountered: