Skip to content

[NUC472/M453] Fix serial error with sync/async calls interlaced #4241

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 4 commits into from
May 15, 2017

Conversation

ccli8
Copy link
Contributor

@ccli8 ccli8 commented Apr 28, 2017

Description

This PR includes the following bugfixes for NUMAKER_PFM_NUC472/NUMAKER_PFM_M453 targets.

  1. Fix serial error with sync/async calls interlaced.
  2. Remove unreleased register setting from flash algorithm.
  3. Other minor bugfixes

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 28, 2017

Can you please remove the merge commit and rebase ?

Remove unreleased register setting from flash algorithm

I dont see this one in the changeset?

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 28, 2017

How was this tested? It might be beneficial for bigger changes to add more details into the commit message (for instance the serial fix changes lot of lines, and introducing new internal API, plus explaining what was the bug that this commit is fixing).

Serial implementation uses different vector handlers for sync/async calls respectively. The issue can be reproduced with the following flow:
1. Register sync mode callback with Serial.attach().
2. Sync call with Serial.putc()/getc().
3. Change to async call with Serial.write()/read().
4. Change back to sync call with Serial.putc()/getc().
Now, vector handller is still for async mode, not for sync mode.

To fix it:
1. Introduce internal function serial_enable_interrupt() for both sync/async vector handler enable/disable.
   Original HAL function serial_irq_set() is reduced to call it for sync mode vector handler enable/disable.
2. Introduce internal function serial_rollback_interrupt() to roll back sync mode vector handler at end of async transfer.
@ccli8
Copy link
Contributor Author

ccli8 commented May 2, 2017

@0xc0170 Please ignore the PR comment below. The related commit has been merged into master before.

Remove unreleased register setting from flash algorithm

I add comment for this commit.
[NUC472/M453] Fix serial error with sync/async calls interlaced

How was this tested? It might be beneficial for bigger changes to add more details into the commit message (for instance the serial fix changes lot of lines, and introducing new internal API, plus explaining what was the bug that this commit is fixing).

@0xc0170
Copy link
Contributor

0xc0170 commented May 2, 2017

Merge branch 'master' into nuvoton

Can you remove this commit please?

@ccli8
Copy link
Contributor Author

ccli8 commented May 2, 2017

Merge branch 'master' into nuvoton

@0xc0170 I remove the commit.

}

int serial_getc(serial_t *obj)
{
// TODO: Fix every byte access requires accompaniness of one interrupt. This degrades performance much.
// TODO: Fix every byte access requires accompaniment of one interrupt. This has side effect of performance degradation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we still have TODOs in the code?

@@ -394,11 +365,12 @@ int serial_getc(serial_t *obj)

void serial_putc(serial_t *obj, int c)
{
// TODO: Fix every byte access requires accompaniness of one interrupt. This degrades performance much.
// TODO: Fix every byte access requires accompaniment of one interrupt. This has side effect of performance degradation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Also here

@ccli8
Copy link
Contributor Author

ccli8 commented May 9, 2017

@theotherjimmy I change the comment for serial_getc/serial_putc by replacing TODO with NOTE to avoid confusion.

@theotherjimmy
Copy link
Contributor

Thanks @ccli8

@0xc0170
Copy link
Contributor

0xc0170 commented May 10, 2017

Restarting travis

@0xc0170
Copy link
Contributor

0xc0170 commented May 10, 2017

/morph test

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 178

All builds and test passed!

@0xc0170 0xc0170 merged commit 3ca5c36 into ARMmbed:master May 15, 2017
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.

5 participants