-
Notifications
You must be signed in to change notification settings - Fork 39
Enabling Software Interrupts Appears to Freeze Program #34
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
Comments
I have put the full source code of my example code here. By changing the interrupt enable at lines 107-108, the chip will only appear to freeze serial communications when the AM_HAL_PDM_INT_OVF is added. None of the other interrupts appear to invoke this issue. I attached a logic analyzer to the TX0/RX0 UART signals and to the pins 36/37 PDM signal pair. Regardless of whether the AM_HAL_PDM_INT_OVF is enabled, it appears the PDM hardware is outputting the expected 6MHz clock signal and that the microphone is sending data back. My guess is that this is somehow causing the ISR to be called repeatedly and a flag is not being cleared, and the sketch can never return to the |
Hi @ComputerAided - Thanks for reporting. I have replicated the issue and created a PDM branch. I agree, the code gets hung at
Owen recommended we
To try to prevent mangling by Arduino when the ino gets turned into CPP. This didn't fix it. It looks like the weakly defined am_pdm_isr() in startup_gcc is not getting overwritten by our am_pdm_isr. Once we enable the PDM interrupt we are getting sent to interrupt am_default_isr() instead of the correct ISR. I'm still digging. It looks like the linker may be removing our ISR as it is 'unused'? Not sure yet. |
Ah! The isr is named incorrectly. SDK v2.1.0 which our core is based on uses
I found this by looking at startup_gcc.c inside the Nano variant. I'll clean up my example a bit and try to make it use the variant pin defs instead of my hardcoding in a bit. |
@nseidle, glad to see you found the problem. I was looking through SDK v2.1.0 and in the examples for the apollo3 evaluation board, I saw that the PDM ISR is stilled called by Would it be possible for you to post a gist of the software you used to get the example to work? Even if I need to change a few pin definitions, I think it would be a good example for people to use until you can release the example version using the variant pin definitions. |
Good idea. Here's the gist. Please check the branch as well. Please see the startup_gcc.c file. It contains all the current and possible ISRs as exposed through the SDK. I welcome any wiki pages you'd like to create! |
@nseidle, thanks for the gist! I'll have to try it out sometime soon. I started the wiki and it is in pull request #39. As I said in #39, I do not know if the wiki will transfer over by a pull request, so let me know if there is a better way to transfer the wiki pages if you would like them as part of this repository. |
@nseidle we now have a wiki page for this issue here. One thing that needs to be added is that an enabled ISR that is not overwritten will default to a Is it okay to close this issue? |
Enabling Software Interrupts Appears to Freeze Program
Using the ARM NVIC appears to freeze the apollo3 microcontroller a short while after the PDM IRQ is enabled.
My workbench
Steps to reproduce
To do this, I started adapting the code from the pdm_fft example in the apollo3 evaluation board example code. In the init function, it appears the
NVIC_EnableIRQ(PDM_IRQn);
function call freezes the chip a short while later when thepdm_config_print();
function is called.The following functions are called as follows:
Expected behavior
It is expected the interrupt is enabled and the sketch will continue into the
pdm_config_print()
function.Actual behavior
The
pdm_config_print()
function stops output about halfway through the first line it is supposed to print.The text was updated successfully, but these errors were encountered: