Skip to content

clear out interrupt when freeing the timer #5613

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 2 commits into from
Dec 28, 2021
Merged

Conversation

jepler
Copy link

@jepler jepler commented Nov 23, 2021

@DavePutz I did not put together hardware to test your suggested fix. If you're able to test this, please do so and let me know how it goes.

I hope this Closes #5418

@jepler jepler requested a review from DavePutz November 23, 2021 18:51
@DavePutz
Copy link
Collaborator

In testing, this patch seems to fix the initial issue in #5418. However, the second hang mentioned in that issue; where a similar hang can be generated when running the script from https://learn.adafruit.com/rgb-led-matrices-matrix-panels-with-circuitpython/connecting-with-feather-rp2040-featherwing by hitting CTRL-C during startup; still exists. I captured a stack from that hang:

#0  0x1008cd78 in blast_long (data=0xbc, core=0x2000391c <displays+20>) at ../../lib/protomatter/src/core.c:814
#1  _PM_row_handler (core=0x2000391c <displays+20>) at ../../lib/protomatter/src/core.c:565
#2  0x1008cf98 in _PM_PWM_ISR () at ../../lib/protomatter/src/arch/rp2040.h:194
#3  <signal handler called>
#4  0x1008c6ee in _PM_begin (core=core@entry=0x2000391c <displays+20>) at ../../lib/protomatter/src/core.c:175
#5  0x1005b556 in common_hal_rgbmatrix_rgbmatrix_reconstruct (self=self@entry=0x20003908 <displays>,
    framebuffer=framebuffer@entry=0x0) at ../../shared-module/rgbmatrix/RGBMatrix.c:108
#6  0x10034316 in supervisor_display_move_memory () at ../../supervisor/shared/display.c:145
#7  0x10028c22 in supervisor_move_memory () at ../../supervisor/shared/memory.c:336
#8  0x10027962 in cleanup_after_vm (exception=0x4, heap=0x20006218 <allocations+20>) at ../../main.c:281
#9  run_repl () at ../../main.c:763
#10 main () at ../../main.c:853

It looks like we're still getting into the PWM interrupt handler when not configured to handle things there.

@DavePutz
Copy link
Collaborator

DavePutz commented Dec 2, 2021

Adding the same two new lines from common_hal_rgbmatrix_timer_free() at the end of common_hal_rgbmatrix_timer_disable() seems to resolve both the "syntax error" issue as well as the "CTRL-C" scenerio.

@dhalbert
Copy link
Collaborator

dhalbert commented Dec 8, 2021

Is this is still in process, or does it await a review?

@jepler
Copy link
Author

jepler commented Dec 8, 2021

I need to incorporate @DavePutz 's suggestion

@jepler
Copy link
Author

jepler commented Dec 9, 2021

As it'll be at least a week before I look at this again I encourage @DavePutz to PR his tested and working fix for this issue.

@jepler jepler changed the base branch from main to 7.1.x December 27, 2021 22:44
@jepler
Copy link
Author

jepler commented Dec 27, 2021

@DavePutz ready for your re-review.

Note that I've retargeted this PR for 7.1.x, rather than main.

@dhalbert
Copy link
Collaborator

Note that I've retargeted this PR for 7.1.x, rather than main.

Do you consider this a priority for 7.1.0?

@jepler
Copy link
Author

jepler commented Dec 27, 2021

not super urgent for me, it's just that this was made way before we split 7.1.x from main. I can switch it back, or we can merge it after 7.1.0 goes out.

@dhalbert
Copy link
Collaborator

Sounds good. Let's merge it after 7.1.0 is final, and then we can merge this and any remaining changes into main. In the meantime, it will also be in 7.1.x in case we do a 7.1.1.

Copy link
Collaborator

@DavePutz DavePutz left a comment

Choose a reason for hiding this comment

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

Looks good. In my testing this fixed both issues raised in issue #5418.

@tannewt tannewt merged commit 08d09ac into adafruit:7.1.x Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RP2040 hang when running specific code.py with an exception
4 participants