Skip to content
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

Fix corner cases in STM32 16bit tickers #4424

Merged
merged 8 commits into from
Jun 7, 2017

Commits on Jun 5, 2017

  1. STM32 16bits ticker: rework us_ticker_read()

    Move to a single more reliable implementation of us_ticker_read()
    There were historically 2 versions of us_ticker_read() implementation.
    
    The one removed here was not reliable because us_ticker_read() can be
    called in interrupt context which means that TIM_MST->CNT would have
    wrapped around while SlaveCounter is not yet updated. So there is a need
    to check the TIM_FLAG_UPDATE inside this function, which was not done in
    the implementation that is removed here.
    LMESTM committed Jun 5, 2017
    Configuration menu
    Copy the full SHA
    b9b5f0b View commit details
    Browse the repository at this point in the history
  2. STM32: 16 bits ticker, fixes in set function and handler

    This commit simplifies ticker interrupt set function and handler.
    
    There were issues around the 16 bits timer wrap-around timing as we were
    aligning interrupts with wrap-around limits (0xFFFF) and then reading
    TIM_MST->CNT again in timer_update_irq_handler which could lead
    to crossing case with the wrap-around (TIM_FLAG_UPDATE) case.
    
    Now we're using the 16 lower bits of the timestamp as the reference from
    using in set_compare and never changing it. There is also no need to set
    comparator again in timer_update_irq_handler. This is more robust and
    also more efficient.
    LMESTM committed Jun 5, 2017
    Configuration menu
    Copy the full SHA
    35c6885 View commit details
    Browse the repository at this point in the history
  3. STM32 16 bits tickers, no need to check TIM_FLAG_CC1OF FLAG

    Following previous fixes on 16 tickers handling, the overflow flag
    condition will not happen anymore, so the work-around in place is
    not needed anymore
    LMESTM committed Jun 5, 2017
    Configuration menu
    Copy the full SHA
    1b684ca View commit details
    Browse the repository at this point in the history
  4. STM32 16 bits ticker: don't check FLAG just clear it

    Not having the check will make the code more efficient.
    LMESTM committed Jun 5, 2017
    Configuration menu
    Copy the full SHA
    27be2e1 View commit details
    Browse the repository at this point in the history
  5. STM32 16 bits tickers: remove unused prototype

    Since rework, this prototype is not needed anymore.
    LMESTM committed Jun 5, 2017
    Configuration menu
    Copy the full SHA
    7bcabf7 View commit details
    Browse the repository at this point in the history
  6. STM32 16 bits tickers: save useless instance init

    TimMasterHandle.Instance initialization can be removed from here,
    because it will either have been already done previously,
    or it will be done in the us_ticker_init() call immediately below.
    LMESTM committed Jun 5, 2017
    Configuration menu
    Copy the full SHA
    572a096 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    fbfbb5e View commit details
    Browse the repository at this point in the history
  8. STM32 16bits tickers: consider all corner cases in us_ticker_set_inte…

    …rrupt
    
    The present commit comes from monkiineko mbed contributor.
    The comments in code explains in details all the possible case and
    how they are handled.
    LMESTM committed Jun 5, 2017
    Configuration menu
    Copy the full SHA
    ea2cc1d View commit details
    Browse the repository at this point in the history