Page 1 of 1

[solved] TD1204 reboot when LEUART0_IRQHandler();

Posted: Wed Jan 13, 2016 12:19 pm
by omlu
Hi,

I have a TD1204 sending requests to an other module through its RX/TX pins. The TD1204 does sends frames, the other module recognizes them and answers to the request. At that moment, my TD1204 reboots.

The UART is initialiazed with TD_UART_InitGlobal(); and it is started with TD_UART_Start();. (So the interrupt on LEUART0 should be init too)

Here is the interrupt routine (it is the same as the one available in the libraries)

void LEUART0_IRQHandler(void) //OG in td_uart.c put as comment
{
uint8_t msg;

TD_SIGFOX_Send((uint8_t *) "LEUART0 IRQ",11,2);

msg = LEUART0->RXDATA;

next = (TD_UART[0].RxWriteIndex) + 1;
if (next >= TD_UART_RXBUFSIZE) {
next = 0;
}

if (next != TD_UART[0].RxReadIndex) {

TD_UART[0].RxBuffer[TD_UART[0].RxWriteIndex] = msg;
TD_UART[0].RxWriteIndex = next;
} else {
if (TD_UART[0].Stats.SoftOverflow != 0xFF) {
TD_UART[0].Stats.SoftOverflow++;
}
}
TD_WakeMainLoop();
}


The TD1204 never sends the "LEUART0 IRQ" message at the beginning of the LEUART0_IRQHandler.

I tried to find the reset cause with
uint32_t RMU_ResetCauseGet(void);

But it returns '0'.

I don't know what else to do to find the reset reason.

Can anyone help me?

Kind regards,

Re: TD1204 reboot when LEUART0_IRQHandler();

Posted: Thu Jan 14, 2016 7:17 am
by omlu
OK I found out what caused the reboot:

It turns out you cannot send sigfox messages in a interrupt handler (why? dunno). So no TD_SIGFOX_Send(...) allowed ! I commented it and it ran fine.

The lack of documentation/information/code visibility got me losing time ! (PS: I am an amateur programmer so that could explain it also :oops: )

Re: [solved] TD1204 reboot when LEUART0_IRQHandler();

Posted: Thu Jan 14, 2016 8:27 am
by lcheminade
Hi,

Sorry I missed the Sigfox line when reading your post... From a general point of view interrupt functions should return as quickly as possible so having a 6s Sigfox transmission is a bad design idea. Anyway Sigfox transmission itself requires an interruptable context which we don't have when inside an other interrupt.

Basically what you're getting is a software trap made to prevent any use of the Sigfox function inside an interrupt. Trap will reset your chip unless you specify an other option (see trap.c in tdcore).

Regards.