在做nRF51822的功能时,在GPIOTE的中断处理中直接调用了。IAS的函数,直接HardFault了。
google一下。发现解决方案。
https://devzone.nordicsemi.com/question/31030/gpiote-interrupt-and-ble-send-resulting-in-hard-fault/
这个帖子列举了两个
如果GPIOTE的中断优先级是默认的的GPIOTE IRQ,那比softdevice 服务的优先级高,你不能从高优先级中断调用低优先级中断的处理。解决方法就是吧GPIOTE的优先级设低一点。但是这不适合我的需求。
第二个方案就是用app_scheduler 把事件发送到main 上下文处理。
具体方案可以参见下面的两个文章。
https://devzone.nordicsemi.com/question/17526/examples-using-the-scheduler/
http://blog.chinaunix.net/uid-28852942-id-5679247.html