主题中讨论的其他器件: SysConfig
大家好。 我使用的是 CCS 版本:12.3.0.00005、SimpleLink v6.41.0.17
在某种架构中、我将等待数据包、然后使用一次性计时器来等待以微秒为单位的偏移、接着使用几个周期的固定间隔的连续计时器。
例如、我得到一个数据包、t=1000us、等待偏移2000us、然后每3000us 触发一个连续计时器、运行10个周期。
我在示波器上使用 GPIO 来验证计时、它看起来与我的无线电线程和 UART 线程同时运行的效果很好。
其最终目的是将系统事件调度、例如 GPIO 切换或 ADC 读取、精确地安排在我希望发生这些事件的时间、超出一系列串联的无线电命令。
使用链接的 API 时、似乎需要解耦这些引脚。
经过一个随机的时间间隔,运行完美的几分钟甚至几个小时,我得到一个硬故障,跳到无效的 PC @ 0x00。
直到我开始使用连续计时器时才发生这种情况。 我以前使用过很多一次性计时器、现在我正在使用一次性+连续计时的组合、此时我注意到了这种故障模式。
计时器回调是在引导时设置的、这些值永远不会改变。
我的任务有大量堆栈空间、这是我第二次猜测环境会受到破坏。
下面是代码-没有针对生产进行优化、只是尝试一些东西。
几个问题
- 使用无线电命令链时、是否有更好的方法来计划系统事件?
- 在这么多个周期后、我是否需要为计时器重新注册回调?
- 是否有更好的工具来调查硬故障?
- 我需要使用 ROV 来获取 PC、LR、SP、然后在寄存器视图中覆盖它们以查看硬故障的调用堆栈
- 不是很能给我一个我要找的吸烟枪
void gpTimerWithCBOneShot(int timer_num, int timeout_us, void(cb)(Timer_Handle myHandle, int_fast16_t status)) { Timer_Params params; Timer_Params_init(¶ms); params.period = timeout_us; params.periodUnits = Timer_PERIOD_US; params.timerMode = Timer_ONESHOT_CALLBACK; params.timerCallback = cb; timer[timer_num] = Timer_open(timer_num, ¶ms); if (timer[timer_num] == NULL) { while (1) {} // should only happen when adding new timers and not closing them } } void gpTimerWithCBContinuous(int timer_num, int timeout_us, void(cb)(Timer_Handle myHandle, int_fast16_t status)) { Timer_Params params; Timer_Params_init(¶ms); params.period = timeout_us; params.periodUnits = Timer_PERIOD_US; params.timerMode = Timer_CONTINUOUS_CALLBACK; params.timerCallback = cb; timer[timer_num] = Timer_open(timer_num, ¶ms); if (timer[timer_num] == NULL) { while (1) {} // should only happen when adding new timers and not closing them } } ... // init timers w/ callbacks but do not start gpTimerWithCBOneShot(CONFIG_TIMER_5,1, &offsetCb); gpTimerWithCBContinuous(CONFIG_TIMER_7,1, &slotTimerCb); ... // radio RX callback, time to start offset timer gpStopTimer(CONFIG_TIMER_5); gpStartTimer(CONFIG_TIMER_5, offsetInterval); ... // offsetCb void offsetCb(Timer_Handle myHandle, int_fast16_t status) { gpStopTimer(CONFIG_TIMER_5); // turn off offset timer gpStopTimer(CONFIG_TIMER_7); gpStartTimer(CONFIG_TIMER_7, peroidicInterval); } ... // after a number of periodic interrupts, we shut off the peroidic timer gpStopTimer(CONFIG_TIMER_7);