-
Notifications
You must be signed in to change notification settings - Fork 49
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
USING TIMERA0 WITh AVRXXDD20 get error #477
Comments
Hi #error "wiring.c and timers.h want to set millis timer TCA0 to different divider" So it may heltp to find the root cause? Laurent |
Hi But may in link with https://github.com/SpenceKonde/DxCore/blob/master/megaavr/extras/Ref_Timers.md and timers usages Laurent |
Hi Workaround is to use set MILLIS_USET_IMERD0 for 20 PINS PARTS to make it OK |
Hm, I cannot reproduce this problem, can you post code that demonstrates this problem, and all the settings you're using? I'm wondering if you're using an IDE that isn't Arduino, hence don't have the submenus and relies on the user to enter all the options manually, and ensure that no mutually exclusive options are being passed. the core is designed for the Arduino IDE and as such the UX is designed to be optimal on the IDE. No testing is performed on third party IDEs, but I understand that most problems come from the fact that Arduino IDE has tools submenus, and I make extensive use of them to set core options. Other IDEs do not emulate this feature. The result is that it is possible to pass unsupported combinations of options accidentally using other IDEs - like, for options we don;t have an entry in the menu for and don;'t handle in the core. Setting the millis timer TCA0 on a 3217 and a 32DD20 works without issue for me with an empty sketch, and not knowing what you were trying to do I don;'t know where to go from there. My verbose compile output (in case it helps you spot missing/errant define is
|
Hi Thanks for your elements. That s really strange anyway. Here is mine:
Here is th logs files (part of it):
|
WITH SUCCES On TIMERD0
Hope it could help trouble shoot and fix it.... About ARDUINO IDE you r right, the menu option do not offer according SERIES 0, 1 or 2 the same default timers avalibility As exempple TIMERA0 can not be set with SERIES 1 on ARDUINO IDE but could by option line in third party IDE. (o require to be limited?) Regards |
edited posts to add code tags, as they were nigh unreadable otherwise (largely because markdown turns tildes into strikethrough. Well, that and the insanely verbose output from PIO) In any case, in the failed compile there's a clear issue:
You have two MILLIS_USE directives! Millis uses one and only one timer at a time. Also, good lord, the UARTBAUDxV mechanism was ripped out over a year ago, The UARTBAUD5V is a no-op - the code that it controlled is long gone. Their cal is generally dead on at room temp over the operating voltage range and difference between 3v and 5v adjustments were tiny (and if you weren't at room temp this correction was no good) - but doing that UART baud correction calculation was painful. In involved long division - and it happened to be in a function where even without it the compiler struggles to create decent output because of register pressure. I had to restructure the uncorrected code several times to avoid pathological binaries |
Hi All done! Could it be possible to add an option to bypass this part of compilation step? (hotfix way!) Anyway good luck to fix it (again!) Laurent |
looking again at the top, I think the problem is the "unbuild MILLIS_USE_TIMERB1" That., if it does what I think works only when MILLIS_USE_TIMERB1 would normally be passed as a build parameter. That's true on the tinyAVR 2-series,. which all have a second TCB1 and don't have a hell-to-use TCD (that's what the 1-series defaults to) But here's the real problem in "fixing" this thing which is not a bug, but rather a user error in failing to provide correct defines when choosing to use a third party IDE which we do not officially support, and which does not ensure that only valid combinations of defines are passed. If you use such an IDE, it is your responsibility to specifty the correct defines This would also be a BLOODY NIGHTMARE TO CHANGE. Look how we do it: Note: Most of the lines in the file are irrelevant and removed - these are only the relevant lines of boards.txt - there are about 2-6 deleted lines per relevant-to-millis-timer lines within the sections relating to it....
So, First, we start off with build.millistimer being TCD0. Then if the chip is chosen buit doesn't have a TCD, we change build.millistimer. Finally, we override it entirely with menu.millis. But that just gives us 2 letters, we need a whole define, where does that happen?!
So uh, you can probably see that that may not be particularly easy to unpick and the behavior is not trivial. Oh, and that part shown above was for 1/13th of the supported parts. Yeah I am not going to open that can of worms, not for bad input on a third party IDE, where the analogous situation is prevented on the Arduino IDE. I think my solution will be better error messages that detect invalid options and #error on them with a message like "You have passed two MILLIS_USE define, only one is permitted. If this occurred with the Arduino IDE please report this promptly." And a #warning "Warning: The UARTBAUD5V/UARTBAUD3V baud rate adjustment were removed in 1.3.0 as it degraded performance for negligible improvement in accuracy." if such invalid removed options were specified. |
So what's tjhis about the AVRxxDD20? The millis timekeeping infrastructure (if not the innermost guts) has some significant differences (for examople no TCD millis. default is TCB1 or TCB2 (TCB2 if it has one)) |
Includes improved error messages for PIO/etc third party IDEs that don't emulate the tools submenus and hence can pass infalid combinations of options. #477
146579b adds clear error messages when multiple timers are specified for DxCore, same fix will come to mTC. |
Hi
Suspicious bug when using AVR32DD20 and AVR64dd20 with MILLIS_USE_TIMERA0 option
Issue between wiring.h and timer.h (only for 20PINS ITEMS)
It look like CPU speed is ignored to set the right value. (divide = 64) but move to 8 So why?
Tested under platformio with latest DX_CORE FILES in the env package 1.5.8
unbuild_flags = -D MILLIS_USE_TIMERB1
build_flags = -D MILLIS_USE_TIMERA0
Thats only for 20PINS ITEMS
No issue on larger PIN parts items
Unable to compile for 20PINS items. OK with largest pins parts.
Laurent
The text was updated successfully, but these errors were encountered: