Skip to content

Serial error interrupt #2566

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

Closed
wants to merge 3 commits into from
Closed

Conversation

c1728p9
Copy link
Contributor

@c1728p9 c1728p9 commented Aug 27, 2016

Extend the serial API to add error interrupts.

@c1728p9
Copy link
Contributor Author

c1728p9 commented Aug 27, 2016

/morph test

@c1728p9
Copy link
Contributor Author

c1728p9 commented Aug 27, 2016

@mbed-bot: TEST

HOST_OSES=ALL
BUILD_TOOLCHAINS=GCC_ARM
TARGETS=K64F,NRF51_DK,NRF51_MICROBIT,NUCLEO_F411RE,NCS36510

@mbed-bot
Copy link

[Build 858]
SUCCESS: Building succeeded and tests were run! Be sure to check the test results

@mbed-bot
Copy link

Result: FAILURE

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

/morph test

Output

mbed Build Number: 737

Test failed!

@bridadan
Copy link
Contributor

@c1728p9 The failure was caused by the Windows failure we saw earlier. Feel free to restart when you're ready

@c1728p9
Copy link
Contributor Author

c1728p9 commented Aug 29, 2016

/morph test

@mbed-bot
Copy link

Result: FAILURE

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

/morph test

Output

mbed Build Number: 740

Test Prep failed!

TxIrq,
ErIrq,

IrqCnt
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add IrqCnt to other drivers

Copy link
Contributor

@0xc0170 0xc0170 Aug 30, 2016

Choose a reason for hiding this comment

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

Add IrqCnt to other drivers

Serial or others?

Edit:I see the CAN, so that's what you meant.

@c1728p9
Copy link
Contributor Author

c1728p9 commented Aug 29, 2016

/morph test

@mbed-bot
Copy link

Result: ABORTED

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

/morph test

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 30, 2016

This is a new feature (adding new serial error interrupt handler), shall we move this from master to its own feature branch, to add implementation for the rest of the platforms prior landing to master? I would say yes.

This error IRQ would be useful, I recall this similar change was to be added in mbed 3. Here's the change proposed: https://github.com/ARMmbed/mbed-hal/pull/70/files. It's not documented here what is expected to be reported (if error happens, what a user should do ? all error flags are cleared, and it's just a report callback ?). Do a user get a function to retrieve an error (what was proposed in the link I referenced) ?

@c1728p9
Copy link
Contributor Author

c1728p9 commented Aug 30, 2016

@0xc0170, my expectation of this function is an overrun or some other error occurred. If the device/protocol is fault tolerant then whichever operation it performed should be retried. If not, an error should be triggered.

This change might not require a feature branch, since nothing bad will happen for targets which don't implement this error interrupt. Applications just won't get that event. In the future when we want to start enforcing that all targets support this, a test could easily be added which causes an overrun and asserts that this interrupt occurs. What do you think @0xc0170. Also, @sg-, any thoughts on this?

@c1728p9
Copy link
Contributor Author

c1728p9 commented Aug 30, 2016

/morph test

c1728p9 and others added 3 commits August 30, 2016 10:33
Rather than hard coding the size of the callback array for irqs,
instead set the size to IrqCnt which is defined by the irq enumeration.
Add an error interrupt option to serial_api.h and SerialBase.h in
addition to the transmit and receive options. This allows serial
driver to report error conditions that could indicate a dropped byte
or other loss of data.
Update the K64F to call the serial error interrupt handler when an
overrun occurs. Prior to this overrun errors were ignored.
@c1728p9 c1728p9 force-pushed the serial_error_interrupt branch from 02bec3a to 03367f9 Compare August 30, 2016 15:43
@c1728p9
Copy link
Contributor Author

c1728p9 commented Aug 30, 2016

This PR is on top of #2584

@c1728p9
Copy link
Contributor Author

c1728p9 commented Aug 30, 2016

/morph test

@mbed-bot
Copy link

Result: FAILURE

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

/morph test

Output

mbed Build Number: 751

Test failed!

@c1728p9
Copy link
Contributor Author

c1728p9 commented Aug 30, 2016

/morph test

@mbed-bot
Copy link

Result: FAILURE

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

/morph test

Output

mbed Build Number: 754

Test failed!

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 31, 2016

@0xc0170, my expectation of this function is an overrun or some other error occurred. If the device/protocol is fault tolerant then whichever operation it performed should be retried. If not, an error should be triggered.

This should be documented? A user should know when an error is invoked and what happens with those errors (any serial error triggers ErIRQ callback, error clearance is handled by HAL). Same description for HAL, the implementation should conform.

It might be sufficient to add this description to the enum.

This change might not require a feature branch, since nothing bad will happen for targets which don't implement this error interrupt. Applications just won't get that event. In the future when we want to start enforcing that all targets support this, a test could easily be added which causes an overrun and asserts that this interrupt occurs. What do you think @0xc0170. Also, @sg-, any thoughts on this?

It's implemented for really small subset of targets. There's no defined timeline where it should be implemented for the rest. If this goes to a release, we are releasing a new feature for just 1,3 or targets. I would like to avoid that. I'll discuss this with you guys, as we should have a clear definition how to extend HAL - that's my main concern.

For instance, my proposal could be:

  • define the timeline for this feature to be released (lets assume this error IRQ for serial should go out for mbed-os 5.2)
  • create a feature branch here on mbed-os (feature_serial_error for instance)
  • send there an initial PR with a design description, tag all HAL maintainers to get feedback for the initial design, integrate to the feature branch (the only files present there could be just a header file with documentation)
  • implement it for a subset of MCU families + tests
  • send a feature addition to master (there's should be a definition of acceptance criteria for a HAL feature - targets coverage (how many percentage should be done, tests written, documentation provided, etc).

Feature branch provides time for design, review, test and integration.

@c1728p9
Copy link
Contributor Author

c1728p9 commented Aug 31, 2016

Moving to a feature branch at the request of @0xc0170.

@c1728p9 c1728p9 closed this Aug 31, 2016
@c1728p9 c1728p9 deleted the serial_error_interrupt branch August 31, 2016 20:34
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