We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm wondering if anyone can help me out with this issue? I'm using a Luminary LM3S3748 Cortex-M3 with the provided Luminary Class-d amp library to play PCM audio data. Every thing works great as long as I start playback (using their ClassDPlayPCM function) before entering RTX.
If I Start play back once the RTOS is running, I receive a hard fault on the line
ROM_IntEnable(INT_PWM1);
which enables the PWM irq. It is also worth noting that I can begin playback then immediately call os_sys_init and both the RTOS and audio playback run concurrently as expected.
On inspection of the fault registers the Forced bit of the Hard Fault Register is set and the Bfarvalid and Preciserr bits are set in the Bus Fault Status Register.
I'll admit that I'm not that familiar with PWM's which is why I've opted to try and use the Luminary provided Libraries. Did I miss anything obvious? What would cause a fault when enabling an irq while RTX is running? Any help is appreciated.
Franc, thanks that worked. I converted that function to a SVC function so that I don't have to run the entire RTOS in priv mode.
I went back to the Luminary audio example, and it turns out that they are making the function call from an irq i.e. privileged mode. I failed to see that connection, or any documentation that stated that it would need to run in privileged mode.
One thing still didn't make sense to me though, I was able to call the function successfully from main, which I thought was executed in User mode. Reverting back to the code where I called the function from main, the debugger shows that main is executing in privileged mode. I opened up a STM32 example provided with Keil and I get the same thing. Is this normal?