Skip to content

MCUXpresso_MCUS: Apply K64F us_ticker fix across all MCU's #6287

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

Merged
merged 1 commit into from
Mar 14, 2018

Conversation

mmahadevan108
Copy link
Contributor

No description provided.

@cmonr
Copy link
Contributor

cmonr commented Mar 6, 2018

@mmahadevan108 Please fill out this PR's description.

Basic information such as where the fix is coming and/or what issues this is fixing would be appreciated. We provide a PR template as a quick way to get it started.

@mmahadevan108
Copy link
Contributor Author

The below change was applied to K64F.


commit b6a01de
Author: Przemyslaw Stekiel [email protected]
Date: Fri Feb 9 14:29:24 2018 +0100

K64F lp ticker driver - calculation bug fix.

Delta calculation from lp_ticker_set_interrupt() function:
delta_us = timestamp > now_us ? timestamp - now_us : (uint32_t)((uint64_t)timestamp + 0xFFFFFFFF - now_us);

Lets assume that timestam == now_us.
Expected delta value should be 0 and in this current version is 0xFFFFFFFF.

The following condition:
timestamp > now_us
should have the following form:
timestamp >= now_us

Additionally modified us ticker driver to provide the same logic.

diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/us_ticker.c b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/us_ticker.c
index dc6ab710f..e4796608a 100644
--- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/us_ticker.c
+++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/us_ticker.c
@@ -83,10 +83,15 @@ void us_ticker_clear_interrupt(void)

void us_ticker_set_interrupt(timestamp_t timestamp)
{

  • uint32_t now_us, delta_us;
  • now_us = us_ticker_read();
  • delta_us = timestamp >= now_us ? timestamp - now_us : (uint32_t)((uint64_t)timestamp + 0xFFFFFFFF - now_us);
  • uint32_t delta = timestamp - us_ticker_read();
    PIT_StopTimer(PIT, kPIT_Chnl_3);
    PIT_StopTimer(PIT, kPIT_Chnl_2);
  • PIT_SetTimerPeriod(PIT, kPIT_Chnl_3, (uint32_t)delta);
  • PIT_SetTimerPeriod(PIT, kPIT_Chnl_3, (uint32_t)delta_us);
    PIT_EnableInterrupts(PIT, kPIT_Chnl_3, kPIT_TimerInterruptEnable);
    PIT_StartTimer(PIT, kPIT_Chnl_3);
    PIT_StartTimer(PIT, kPIT_Chnl_2);

This PR includes this change for other MCUXpresso platforms.

cmonr
cmonr previously approved these changes Mar 6, 2018
@cmonr
Copy link
Contributor

cmonr commented Mar 6, 2018

@mprse Fyi.

@cmonr
Copy link
Contributor

cmonr commented Mar 6, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 6, 2018

Build : SUCCESS

Build number : 1371
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6287/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Mar 7, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 7, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 7, 2018

@mmahadevan108 The info shared above about the fix should be part of the commit message. It is not clear what is this fixing and how (can you amend the commit message to add there the info from #6287 (comment)) ?

Applied changes from commit b6a01de
for other MCUXpresso MCUs

Signed-off-by: Mahesh Mahadevan <[email protected]>
@mmahadevan108
Copy link
Contributor Author

@0xc0170 I have updated the commit message.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 7, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 7, 2018

Build : SUCCESS

Build number : 1380
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6287/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Mar 7, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 7, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 8, 2018

/morph test

@mbed-ci
Copy link

mbed-ci commented Mar 8, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 8, 2018

/morph test

@mbed-ci
Copy link

mbed-ci commented Mar 8, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 8, 2018

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

Successfully merging this pull request may close these issues.

4 participants