Conversation
|
@aabadie could you have a look? |
cpu/atmega_common/periph/timer.c
Outdated
| { | ||
| #if defined(DEBUG_TIMER_PORT) | ||
| DEBUG_TIMER_PORT |= (1 << DEBUG_TIMER_PIN); | ||
| DEBUG_TIMER_PORT &= ~(1 << DEBUG_TIMER_PIN); |
There was a problem hiding this comment.
You you stated in the initial comment to measure the duration of the ISR. I'm imagining a pulse that is high until the CPU has left the ISR. Shouldn't this line be placed after __exit_isr() to achieve that?
There was a problem hiding this comment.
@A-Paul thank you for that. Your asumption is correct and it was implemented like this at the beginning.
As the context swap of the atmegas was changed to also execute in interrupts setting the pin to low would now happen after the context comes back the context which was active when the interrupt was triggered so it would not executed in the right time. I changed the debug pin to only signilizes the start of the timer interrupt. And forgott to update the documentation.
I change the pin toggle to be executed before the context swap, thus the documentation fits the function, only that the context swap is not included in the high period anymore.
|
Squash and rebase? |
cpu/atmega_common/periph/timer.c
Outdated
| * CFLAGS += -DDEBUG_TIMER_DDR=DDRF | ||
| * CFLAGS += -DDEBUG_TIMER_PIN=PORTF4 | ||
| */ | ||
| #if defined(DEBUG_TIMER_PORT) |
There was a problem hiding this comment.
"board.h" is already included in line 25.
|
@PeterKietzmann done |
|
I wiil do a HW test tomorrow. |
|
Hi @Josar , I have built and run some of the tests/xtimer_* on a arduino-mega2560 and connected to an oscilloscope. Works like it is supposed. |
|
@A-Paul i had a quick view over the approach from #7352. And yes it seems more generalized, but it is also on halt for quite a while. One other thing is that if it is used like this it is not flexible anymore. Means if i use e.g. This Approach defines a well defined PIN for a single action e.g. Timer, This can be freely set to a pin. I am not in favor of the generalized approach shown in #7352 for a low level driver debug pin solution. The generelized approach could be something which could be used in application level as shown here https://github.com/RIOT-OS/RIOT/pull/8865/files. |
|
@Josar thank you for you investigation. I will follow you reasoning and merge, but I have a last change request. I'll place it in a review comment. |
A-Paul
left a comment
There was a problem hiding this comment.
The last code change left the config explanation (lines 35-47) standing alone. Putting it above the initialization as a replacement of line 99 would be more sensible.
It also requires a lot space and has some redundant infos.
I propose a more dense text as follows:
/*
* A debug pin can be used to probe timer interrupts with an oscilloscope or
* other time measurement equipment. Thus, determine when an interrupt occurs
* and how long the ISR takes.
* The pin should be defined in the makefile as follows:
* CFLAGS += -DDEBUG_TIMER_PORT=PORTF -DDEBUG_TIMER_DDR=DDRF \
* -DDEBUG_TIMER_PIN=PORTF4
*/
A debug pin can be used to probe timer interrupts with an oscilloscope or
other time measurement equipment. Thus, determine when an interrupt occurs
and how long the timer ISR takes.
The pin should be defined in the makefile as follows:
CFLAGS += -DDEBUG_TIMER_PORT=PORTF -DDEBUG_TIMER_DDR=DDRF \
-DDEBUG_TIMER_PIN=PORTF4
2ae2100 to
d6c0398
Compare
|
@A-Paul done. |
|
@Josar, thank you for addressing all change requests. CI is happy. ACK and go. |
Debug pin can be used to probe timer interrupts. Thus, determine when an interrupt occurs and how long the ISR takes.
The timer interrupt times can be probed with a oscilloscope if pin
DEBUG_TIMER_PIN, the respectiveDEBUG_TIMER_PORTandDDEBUG_TIMER_DDRare defined in the makefile as follows.