Skip to content

test/xtimer_drift: DEBUG_PINS#10173

Closed
Josar wants to merge 3 commits intoRIOT-OS:masterfrom
Josar:pr/xtimer_drift/debug_pins
Closed

test/xtimer_drift: DEBUG_PINS#10173
Josar wants to merge 3 commits intoRIOT-OS:masterfrom
Josar:pr/xtimer_drift/debug_pins

Conversation

@Josar
Copy link
Contributor

@Josar Josar commented Oct 16, 2018

This PR adds debug pins to probe this test with an oscilloscope.
This helps debugging #9595

Before the merge of #9211 (comment) we can observe the hanging behaviour of the system.

image

After #9211 (comment) is merged a pariodic a race condition appears which can be seen in the prints of the test #9596.

When #9595 is merged this will result in an stable System.

@PeterKietzmann PeterKietzmann added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: tests Area: tests and testing framework Area: timers Area: timer subsystems labels Oct 17, 2018
@PeterKietzmann
Copy link
Member

@leandrolanzieri is this helpful? Mind to have a look?

@PeterKietzmann PeterKietzmann requested a review from kYc0o October 17, 2018 07:06
@Josar
Copy link
Contributor Author

Josar commented Nov 1, 2018

Set generic pin definition as in #10174

@PeterKietzmann
Copy link
Member

@MichelRottleuthner, @leandrolanzieri you took care of #10174, how about this PR?

Copy link
Member

@A-Paul A-Paul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me. Just one location where we could save some space.

#CFLAGS += -DDEBUG_TIMER_PORT=PORTF
#CFLAGS += -DDEBUG_TIMER_DDR=DDRF
#CFLAGS += -DDEBUG_TIMER_PIN=PORTF4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 8-14: This description is already in <cpu/atmega_common/periph/timer.c> since #9025.
Just place a reference, please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then you will have to copy paste them from there everytime you want to use this debug pins.
As i understand the tests also as testing tools, having such info in place is imho more helpfull then the space saved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@A-Paul A-Paul i am willing to remove the comments if this is the showstopper here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should be independent of the atmega implementation. Ideally, we would have a generic debug pin for this purpose configured for every platform. Now that this is out of scope for your PR, I'd say we remove it.

@A-Paul A-Paul added Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines and removed Reviewed: 3-testing The PR was tested according to the maintainer guidelines labels Nov 8, 2018
@Josar Josar mentioned this pull request Dec 18, 2018
@Josar
Copy link
Contributor Author

Josar commented Mar 17, 2019

@A-Paul can we continue here?

@Josar
Copy link
Contributor Author

Josar commented Apr 17, 2019

@A-Paul @PeterKietzmann @kYc0o is it possible to get this merged as this is a part of the xtimer improvement i started a long time ago.

I somehow get the feeling that there is no interrest from the maintainers to get xtimer working proprerly.

Now old and known issues are coming up again #11149.

@kYc0o
Copy link
Contributor

kYc0o commented Apr 18, 2019

So far the only thing missing is the testing part. Unfortunately I don't have the tools anymore to proceed with a good testing here, however I also think that this PR has waited too much and would be beneficial to merge it.

@A-Paul would you have time for the testing?

Copy link
Member

@PeterKietzmann PeterKietzmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Josar I ran the application on a samr21-xpro with

CFLAGS += -DSLACKER_THREAD_PIN=GPIO_PIN\(0,22\)
CFLAGS += -DMAIN_THREAD_PIN=GPIO_PIN\(1,3\)
CFLAGS += -DPRINT_THREAD_PIN=GPIO_PIN\(1,22\)

Results look slightly different in comparison to yours, but they seem reasonable to me.

xtimer_drift_samr21_dbgpins

In a nutshell:

  • print occurs every second
  • main occurs every ~15.6ms and takes a little longer when print happens around the same time
  • slacker occurs in (non constant) intervals between 1...10ms

#CFLAGS += -DDEBUG_TIMER_PORT=PORTF
#CFLAGS += -DDEBUG_TIMER_DDR=DDRF
#CFLAGS += -DDEBUG_TIMER_PIN=PORTF4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should be independent of the atmega implementation. Ideally, we would have a generic debug pin for this purpose configured for every platform. Now that this is out of scope for your PR, I'd say we remove it.


# Define test probing pins GPIO API based.
# Port number should be found in port enum e.g in cpu/include/periph_cpu.h
#FEATURES_REQUIRED += periph_gpio
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a single platform that has no GPIO driver but xtimer support? In my opinion it should be fine to always include that feature (otherwise we would see what Murdoch says later)

# Define test probing pins GPIO API based.
# Port number should be found in port enum e.g in cpu/include/periph_cpu.h
#FEATURES_REQUIRED += periph_gpio
# Jiminy probing Pins
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really wanna have the jiminy config here, please define the CFLAGS in

ifneq (,$(filter jiminy,$(BOARD)))

endif


#if defined(SLACKER_THREAD_PIN)
gpio_t slacker_pin = SLACKER_THREAD_PIN;
gpio_init(slacker_pin, GPIO_OUT);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not directly gpio_init(SLACKER_THREAD_PIN, GPIO_OUT); here and following?


#if defined(SLACKER_THREAD_PIN)
gpio_set(slacker_pin);
gpio_clear(slacker_pin);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a matter of taste, but wouldn't a single toggle be simpler and easier to read on the scope?

@Josar
Copy link
Contributor Author

Josar commented May 22, 2019

@PeterKietzmann i think its a 32 bit timer which is used for xtimer, waiting for that to overflow takes some time. Maybe you could configure it to use a 16bit timer.

@PeterKietzmann
Copy link
Member

PeterKietzmann commented May 22, 2019

waiting for that to overflow takes some time

I wasn't waiting for an overflow :-). Are you saying this because I mentioned that my results look slightly different to yours? I'm fine with the concept of this PR and IMO it only needs some small polish in order to be merged
Edit: With "polish" I meant addressing my comments

@stale
Copy link

stale bot commented Nov 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Nov 23, 2019
@MichelRottleuthner MichelRottleuthner removed the State: stale State: The issue / PR has no activity for >185 days label Nov 27, 2019
@stale
Copy link

stale bot commented Oct 11, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Oct 11, 2020
@stale stale bot closed this Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: tests Area: tests and testing framework Area: timers Area: timer subsystems Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines State: stale State: The issue / PR has no activity for >185 days Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants