Skip to content

cpu/[msp|cc]430: added peripheral timer driver#3724

Merged
haukepetersen merged 21 commits intoRIOT-OS:masterfrom
haukepetersen:add_msp430_periph_timer
Sep 3, 2015
Merged

cpu/[msp|cc]430: added peripheral timer driver#3724
haukepetersen merged 21 commits intoRIOT-OS:masterfrom
haukepetersen:add_msp430_periph_timer

Conversation

@haukepetersen
Copy link
Copy Markdown
Contributor

To get RIOT ready for the xtimer, here is the low-level timer implementation for all MSP430 based boards. For backward compatibility, all effected boards do now use the hwtimer_compat module.

Please note, that the vtimer will not work correctly anymore, as it depends on a 32-bit hwtimer (while we now only have 16-bit wide low-level timers). But this should not matter much, as the boards run perfectly with the xtimer!

Note2 (especially @kaspar030): So far there is almost identical code for the cc430 and the msp430fxyz. Especially for some other peripherals, they seem to differ quite a bit, but I am not sure yet to which extend. So the strategy is clearly for now: implement separately and merge again as soon as I have a better feeling for those MCUs - so be patient :-)

PRs for other peripheral timers will follow soon...

@haukepetersen haukepetersen added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Platform: MSP Platform: This PR/issue effects MSP-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT Impact: major The PR changes a significant part of the code base. It should be reviewed carefully Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: timers Area: timer subsystems labels Aug 26, 2015
@haukepetersen haukepetersen added this to the Release 2015.08 milestone Aug 26, 2015
@kaspar030
Copy link
Copy Markdown
Contributor

Nice! will test ASAP.

(you probably need to (void) some arguments)

@PeterKietzmann PeterKietzmann mentioned this pull request Aug 27, 2015
10 tasks
@haukepetersen
Copy link
Copy Markdown
Contributor Author

@kaspar030, any progress testing this?

@kaspar030
Copy link
Copy Markdown
Contributor

nope, busy, will do later today!

@kaspar030
Copy link
Copy Markdown
Contributor

Works as expected on msb-430h. Can't test on other boards. Do you want to fix the "N" define in xtimer or the msb headers? ACK after that is fixed.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

Just fixing it as we speak..

@haukepetersen haukepetersen force-pushed the add_msp430_periph_timer branch from 08e2f43 to 151dbf9 Compare September 2, 2015 15:10
@haukepetersen
Copy link
Copy Markdown
Contributor Author

fixed the xtimer tests that Travis was complaining about and removed the TI legacy header (legacymsp430.h). The xtimer test should work fine on all effected boards.

@kaspar030
Copy link
Copy Markdown
Contributor

Tested again on msb-430h, ACK holds from my side if travis is happy.

@OlegHahm
Copy link
Copy Markdown
Member

OlegHahm commented Sep 2, 2015

Will test on Z1 and WSN430 now.

@OlegHahm
Copy link
Copy Markdown
Member

OlegHahm commented Sep 2, 2015

Hm, on Z1 with example/timer_periodic_wakeup I observe a weird pattern (look at the pyterm timestamp):

2015-09-02 17:31:06,363 - INFO # slept until 79065481
2015-09-02 17:31:07,348 - INFO # slept until 80065481
2015-09-02 17:31:08,335 - INFO # slept until 81065481
2015-09-02 17:31:08,338 - INFO # slept until 81002729
2015-09-02 17:31:08,341 - INFO # slept until 81005633
2015-09-02 17:31:08,344 - INFO # slept until 81008539
2015-09-02 17:31:08,346 - INFO # slept until 81011447
2015-09-02 17:31:08,349 - INFO # slept until 81014352
2015-09-02 17:31:08,352 - INFO # slept until 81017263
2015-09-02 17:31:08,355 - INFO # slept until 81020174
2015-09-02 17:31:08,358 - INFO # slept until 81023079
2015-09-02 17:31:08,361 - INFO # slept until 81025989
2015-09-02 17:31:08,364 - INFO # slept until 81028893
2015-09-02 17:31:08,367 - INFO # slept until 81031799
2015-09-02 17:31:08,369 - INFO # slept until 81034706
2015-09-02 17:31:08,372 - INFO # slept until 81037615
2015-09-02 17:31:08,375 - INFO # slept until 81040522
2015-09-02 17:31:08,378 - INFO # slept until 81043426
2015-09-02 17:31:08,381 - INFO # slept until 81046332
2015-09-02 17:31:08,384 - INFO # slept until 81049242
...

The node seems to run fine for some while and then trigger a lot of interrupts at once, go back to normal mode and so on...

@haukepetersen
Copy link
Copy Markdown
Contributor Author

I can reproduce this behavior on the msb-430h. @kaspar030, any hint if this is xtimer related or if is this caused by the peripheral timer?

@OlegHahm
Copy link
Copy Markdown
Member

OlegHahm commented Sep 2, 2015

For the record: very similar pattern on wsn430-v1_3b

@kaspar030
Copy link
Copy Markdown
Contributor

same on msb430h. hm, whenever that happens, the actual sleep time goes backwards by around 63k us, which sounds like a 16bit handling issue.

@kaspar030
Copy link
Copy Markdown
Contributor

@haukepetersen yes, let me try to rule out xtimer stuff, but it actually looks like that.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

yap. Is there maybe some mask define for 16-bit timers that I missed to set for the boards, but xtimer needs?

@OlegHahm
Copy link
Copy Markdown
Member

OlegHahm commented Sep 2, 2015

I don't know if related and/or helpful, but tests/xtimer_usleep_until terminates at

2015-09-02 17:46:34,409 - INFO # Testing interval 95...
2015-09-02 17:46:34,415 - INFO # Testing interval 94...
2015-09-02 17:46:34,416 - INFO # Testing interval 93...
2015-09-02 17:46:34,416 - INFO # Testing interval 92...
2015-09-02 17:46:34,434 - INFO # Testing interval 91...
2015-09-02 17:46:34,435 - INFO # Testing interval 90...
2015-09-02 17:46:34,435 - INFO # Testing interval 89...
2015-09-02 17:46:34,436 - INFO # Testing interval 88...
2015-09-02 17:46:34,436 - INFO # Testing interval 87...
2015-09-02 17:46:34,437 - INFO # Testing interval 86...
2015-09-02 17:46:34,437 - INFO # Testing interval 85...
2015-09-02 17:46:34,437 - INFO # Testing interval 84...
2015-09-02 17:46:34,438 - INFO # Testing interval 83...
2015-09-02 17:46:34,439 - INFO # Testing interval 82...
2015-09-02 17:46:34,439 - INFO # Testing interval 81...
2015-09-02 17:46:34,505 - INFO # Testing interval 80...
2015-09-02 17:46:34,572 - INFO # Testing interval 79...
2015-09-02 17:46:34,639 - INFO # Testing interval 78...
2015-09-02 17:46:34,705 - INFO # Testing interval 77...
2015-09-02 17:46:34,772 - INFO # Testing interval 76...
2015-09-02 17:46:34,839 - INFO # Testing interval 75...
2015-09-02 17:46:34,905 - INFO # Testing interval 74...
2015-09-02 17:46:34,972 - INFO # Testing interval 73...
2015-09-02 17:46:35,039 - INFO # Testing interval 72...
2015-09-02 17:46:35,105 - INFO # Testing interval 71...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

minor: but why did you revert this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

propably copy+paste. I tend to use guards without trailing underscores in the files I create...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No strong feelings, would just vote for consistency and currently we have 36 PERIPH_CONF_H_s and only 6 PERIPH_CONF_Hs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't care, I can offer you to open a follow-up PR to make them all consistent. Would that work?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

works for me

@haukepetersen
Copy link
Copy Markdown
Contributor Author

re-introduced eINT and dINT, as it seems that the pthread implementations still use them and Travis fails without them...

@kaspar030
Copy link
Copy Markdown
Contributor

re-introduced eINT and dINT, as it seems that the pthread implementations still use them and Travis fails without them...

Uff, that should seriously be fixed in pthreads. Promise to at least create an issue. ;)

@kaspar030
Copy link
Copy Markdown
Contributor

I have the feeling that this somehow loses interrupts, but I can't pinpoint it. I'm on it.

@kaspar030
Copy link
Copy Markdown
Contributor

No, my problem is xtimer related. ACK when travis is happy!

@haukepetersen
Copy link
Copy Markdown
Contributor Author

nice :-)

@haukepetersen
Copy link
Copy Markdown
Contributor Author

Travis is happy -> and go!

haukepetersen added a commit that referenced this pull request Sep 3, 2015
cpu/[msp|cc]430: added peripheral timer driver
@haukepetersen haukepetersen merged commit fb8d15d into RIOT-OS:master Sep 3, 2015
@haukepetersen haukepetersen deleted the add_msp430_periph_timer branch September 3, 2015 10:00
@kaspar030
Copy link
Copy Markdown
Contributor

yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: timers Area: timer subsystems CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: major The PR changes a significant part of the code base. It should be reviewed carefully Platform: MSP Platform: This PR/issue effects MSP-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants