Page 1 of 1
Sigfox downlink callback unusual behavior
Posted: Tue Jul 07, 2015 8:23 pm
by disk91
Hello, in certain conditions I did not identified, the clal back procedure never reach the RXBEGIN branch .. in fact RX_FRAME seems to be directly == 0 ...
Do you see any reason for this ?
Paul
static int downlink_callback(uint8_t *rx_frame, uint8_t length)
{
if (rx_frame == 0) {
// Finished receiving
TD_SIGFOX_DOWNLINK_SetUserCallback(0);
tfp_printf("RX END\r\n");
// Done
return 1;
} else {
if (length == 0) {
// Start receiving
tfp_printf("RX BEGIN\r\n");
// Done
return 1;
}
// Received one good frame
tfp_dump("RX=", rx_frame, length);
// Done
return 1;
}
}
Re: Sigfox downlink callback unusual behavior
Posted: Wed Jul 08, 2015 8:11 am
by lcheminade
Hi Paul,
The downlink is based on a state machine. Each state setup an interrupt which will change the state flag. New state is then processed in TD_SIGFOX_DOWNLINK_Process which is going to call your callback when required. The itnerrupt triggering the first call to your callback is a timer based on RTC_Alarm_After.
So the reason for your callback not to be called can be:
- TD_SIGFOX_DOWNLINK_Process is not always called in UserLoop
- Your application is messing with the system RTC (disabling interrupt, changing time)
- You're calling an SDK function which is messing with the RTC (they should all be protected against that but well...)
Perhaps that will give you some hints of where to look. Otherwise please send me your code via MP and I'll give it a look.
Regards.
Loïc
Re: Sigfox downlink callback unusual behavior
Posted: Wed Jul 15, 2015 6:53 am
by disk91
Thank you Loic, I'm only executing downlink_process under condition => when it have to run instead on every loop() ... It is possible it come from this but basically it should append at end of the process more than at start.
An explanation could be related to evolution of the donwnlink state machine after the end of the downlink communication ; is that possible ?
Before removing my conditionnal code : what appends in the downlink_process when not in communication ? is the code efficient to ensure no power consumption for doing nothing ?
Paul
Re: Sigfox downlink callback unusual behavior
Posted: Mon Jul 20, 2015 1:23 pm
by lcheminade
Please remove your conditionnal call, we are just doing the same inside the downlink_process so yes it is consumption optimized. In a general point of view all our libraries generate events which are dealts with in the Process callback (when this can/need to be done outside an interrupt). You've got the same for lan/accelero/gps. The process function is just an if which check if there are any events to be processed in the corresponding library.
For example if you think the process is not required anymore but we need to delay some configuration then you will break the whole state machine.