Part Number: LAUNCHXL-CC1310
Tool/software: Code Composer Studio
Hey guys,
I am using the collector example in nob-beacon mode 15.4 TI Stack. I've implemented UART read in callback mode. And this works quite good so far, the messages are read and I can rebuild the message and send it back to via UART write. However, something is kind of crashing the application and I cant see how. I store the uart read message in the output buffer and depending on the first byte, I perform different actions.
Llc_deviceListItem_t item;
ApiMac_sAddr_t devAddr;
devAddr.addrMode = ApiMac_addrType_short;
output[index] = '\n';
UART_write(hUart, &output, index++);
index = 0;
if(output[0] == '1')
{
const char reset_note[] = "FRe\r\n";
UART_write(hUart, &reset_note, 5);
Csf_ResetBoard();
}
if(output[0] == '2')
{
const char kick_note[] = "KiS\r\n";
UART_write(hUart, &kick_note, 5);
devAddr.addr.shortAddr = UartCopyBuffer(output);
//Csf_getDevice(&devAddr, &item);
//Cllc_removeDevice(&item.devInfo.extAddress);
}
ClearBuffer(output);
Using breakpoints I can see that both if-loops can be entered. The function Csf_ResetBoard() just resets the board and works fine. However, neither for case 1 or 2, UART_write works, although the UART_write action with "output" as buffer echoing the input works fine. I do then parse the shortAddr from the UART msg and hand it over to dev.Addr.addr.shortAddr, I actually verified, that the number "1" (test) was written into shortAddr. However, if I uncomment the next two functions the board stops working, the red blinking LED stops blinking and nothing happens anymore with the collector application.
The function UartCopyBuffer looks as follows:
uint16_t UartCopyBuffer(char *buffer)
{
char container[32] = {'0'};
char *ptr;
uint8_t p = 0;
ClearBuffer(container);
while (buffer[p] != '\r' && buffer[p] != '\n')
{
/* start with index 1 because index 0 is not necessary */
p++;
container[p-1]=buffer[p];
}
cmd_shortAddr = strtol(container, &ptr, 6);
return(cmd_shortAddr);
}
- Any idea why no prints are performed after the ouput buffer flushing? Posts outside uart_print.c are working when the application reaches them, maybe overflow?
- Any idea what could crash the application? The last function I can get to in debug mode is UARTCC26XX_swiIntFxn() when ClearBuffer() (see above) is finished.
I added a code snipped showing the content of devAddr right before calling Csf_getDevice().
Any comment welcome
Kind regards
Slev1n