Other than the referred thread, have there been any advances on how to get either a HWI or SWI on RAT timer match from the CM0 RF Core to the CM4 application processor?
Thanks!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Other than the referred thread, have there been any advances on how to get either a HWI or SWI on RAT timer match from the CM0 RF Core to the CM4 application processor?
Thanks!
Hi Mike,
I am not sure if this is the solution you are looking for. But have you looked into the RF_ratCompare and RF_ratCapture APIs?
It seems this might be what you are looking for. This is the only content I could find about this.
Regards.
Sid
Thanks Sid! I did not see the callback option.
I only saw capture/compare and assumed we could only wiggle GPIO.
I'll give this a try, thank you.
Thanks again Sid.
So I'm calling this for 100 us after I schedule an RX or TX using RF_runCmd.
My callback is firing constantly with RF_EventError. On the scope, the timing is off, which agrees with RF_EventError
I don't suppose there is an example of this somewhere.
Here's the invocation. My master sync's on Tx start time, and slaves sync on Rx rxTime from the packet as in the rfSynchronizedPacket example. This part has been working well. I included it for context because I just add 100 uS to startTime.
if (isMaster()) {
rf_ctx.RF_cmdPropTx->startTime += RF_convertUsToRatTicks(slotTimeUs);
rf_ctx.RF_cmdPropRx->startTime = rf_ctx.RF_cmdPropTx->startTime;
} else {
rf_ctx.RF_cmdPropRx->startTime += RF_convertUsToRatTicks(slotTimeUs);
rf_ctx.RF_cmdPropTx->startTime = rf_ctx.RF_cmdPropRx->startTime;
}
scheduleTask(rf_ctx.RF_cmdPropRx->startTime + RF_convertUsToRatTicks(100));
Here's the scheduler
static void scheduleTask(uint32_t timeout) {
RF_RatConfigOutput ioCfg;
RF_RatConfigOutput_init(&ioCfg);
RF_RatConfigCompare channelCfg;
RF_RatConfigCompare_init(&channelCfg);
channelCfg.callback = &scheduleTaskCb;
channelCfg.timeout = timeout;
RF_ratCompare(rfHandle,&channelCfg, &ioCfg);
}
Here's the callback, just toggling a GPIO and posting a semaphore (which never happens)
static void scheduleTaskCb(RF_Handle h, RF_RatHandle rh, RF_EventMask e, uint32_t compareCaptureTime) {
switch(e) {
case RF_EventRatCh:
GPIO_toggle(CONFIG_GPIO_TP1);
Semaphore_post(rfSem);
GPIO_toggle(CONFIG_GPIO_TP1);
break;
case RF_EventError:
// printf("RF_EventError\n");
break;
}
}
This worked. Thanks again Sid!
Wonder if I can map to an unusedRatGpo to save on pin IO
static void scheduleTask(uint32_t timeout) {
RF_RatConfigOutput ioCfg;
RF_RatConfigOutput_init(&ioCfg);
ioCfg.select = RF_RatOutputSelectRatGpo7;
ioCfg.mode = RF_RatOutputModePulse;
RF_RatConfigCompare channelCfg;
RF_RatConfigCompare_init(&channelCfg);
channelCfg.callback = &scheduleTaskCb;
channelCfg.timeout = timeout;
channelCfg.channel = RF_RatChannelAny;
RF_ratCompare(rfHandle,&channelCfg, &ioCfg);
}