After sending 21836 messages the TD_SIGFOX_Send function crashes.
This is a reproducible error. I have tried with different source codes, modules (TD1204) and different message sizes and the TD crashes every time after the same number of transmissions.
Either while loops or the scheduler for iterative sending have the same behaviour.
You can find some sample code at the end of the post.
I have also tried longer intervals (15 seconds) between transmissions with the same result.
The error message is (where the first sequence of numbers refers to the message counter):
21827
21828
21829
21830
21831
21832
21833
21834
21835
21836
[TRAP] Time:1.01:22:58.278 : 13:Radio Chip | Param:0x00000014(20)
-- TRAP DUMP --
MSP:0x20001EB0
HardFaultSt:0x00000000
FaultStatus:0x00000000:Stack:0x20001940-0x20002120
-- TRAP Trace@0x20000000 --
Trace stack truncated
Var 0:183
Var 1:135
Var 2:158
Var 3:123
Var 4:63
Var 5:255
Var 6:79
Var 7:114
Var 8:221
-Stack trace-
0|0x0000489D
1|0x00004699
2|0x000025F3
3|0x00000BD7
4|0x00004AAD
5|0x00000CB5
6|0x000019A1
7|0x00001989
8|0x000005D1
9|0x00003E33
10|0x00000EC7
11|0x0000058D
12|0x000016CD
13|0x0000058D
14|0x00001753
15|0x0000554D
16|0x0000024B
17|0x00005A6F
18|0x00005A21
Sample code to reproduce the error as follows:
void TD_USER_Setup(void)
{
uint32_t counter = 0;
int i;
uint8_t message[12];
// Define the LED pin as an output in push-pull mode
GPIO_PinModeSet(LED_PORT, LED_BIT, gpioModePushPull, 0);
// Initialize the LEUART
init_printf(TD_UART_Init(9600, true, true),
TD_UART_Putc,
TD_UART_Start,
TD_UART_Stop);
// Build hex message
for (i = 0; i < 12; i++) {
message[i] = i;
}
tfp_printf("Chasing bug 21836...\r\n", counter);
while(true)
{
// Send hex message with 2 repetitions
GPIO_PinOutSet(LED_PORT, LED_BIT);
//TD_SIGFOX_Send(message, 12, 2);
TD_SIGFOX_Send(message, 1, 2);
GPIO_PinOutClear(LED_PORT, LED_BIT);
tfp_printf("%d\r\n", counter);
// Wait a bit
TD_RTC_Delay(T100MS);
counter++;
}
}