Skip to content

[LPC1549] Tickers stop working after 32-bit rollover #1699

Closed
@neilt6

Description

@neilt6

Just noticed that Tickers quit firing on the LPC1549 at the 1:11:34 mark (when the 32-bit space overflows). Here's a code snippet to start the underlying μs timer at a high value and make testing easier:

us_ticker_init();
LPC_RIT->COUNTER_H = 0x00000047;

Update

This has just become a show-stopping bug on one of my projects, and needs to be fixed ASAP. I've investigated this issue, and it's stemming from the fact that the µs_ticker implementation on this target is using the 48-bit Repetitive Interrupt Timer (RIT) which is clocked at 72MHz. The 32-bit microsecond timestamps are being converted to 48-bit compare values that roll over at 0x0047FFFFFFB8, long before the RIT's 48-bit counter rolls over. The RIT has a mask register, but I don't think it's useful here since the rollover point isn't an even power of 2.

@0xc0170 Any ideas on what could be done to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions