Part Number: LAUNCHXL-CC1310
Other Parts Discussed in Thread: CC1310, SYSBIOS
Tool/software: TI-RTOS
Hi Team,
I have written a firmware where I am using Mailbox concept to get the information on the terminal screen obtained on radio and similarly trying to display the key pressed on the keyboard on the terminal.
What ever data is received by radio over the air is displayed without any problem.
But the issue is if I try to display the data that is obtained in the rx_buffer when hitting any key on keyboard I get "HARD FAULT: FORCED: BUSFAULT: PRECISER" Exception.
There is no difference in the way the data is passed to the UART_write function to get it displayed on screen.
/*
* CommandRadioUart.c
*
* Created on: Aug 25, 2016
* Author: greg
*/
#include "CommandRadio.h"
uint8_t *command;
static uint8_t uart_rxBuffer[2];//Read one byte at a time // Data obtained when hitting key on keyboard
bool echo_char = false;// flag to indicate which data has to be displayed
/***** Variable declarations *****/
static UartRead_Callback Callback;
static void uartReceiveFinished(UART_Handle handle, void *uart_rxBuffer, size_t count);
/* This task is declared in CommandRadio.cfg
* It transmits text over the UART backchannel USB */
void uartSendTask(UArg arg0,UArg arg1){
MsgObj dataRx;
//char uart_rxBuffer[10];
//char uart_rxBuffer;//Read one byte at a time
UART_Params uartParams;
/*initializing the UART parameters*/
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_TEXT;
uartParams.readMode = UART_MODE_CALLBACK;
uartParams.readDataMode = UART_DATA_TEXT;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.readCallback = uartReceiveFinished;
uartParams.baudRate = 115200;
uart = UART_open(Board_UART0, &uartParams);
if (uart == NULL) {System_abort("Error opening the UART");}
//int rxBytes = UART_read(uart, &uart_rxBuffer, 1);
int rxBytes = UART_read(uart, &uart_rxBuffer, 1);
/* The task suspends waiting on reciept of mailbox message.*/
while(TRUE){
UART_read(uart, &uart_rxBuffer, 1);
Mailbox_pend(rxDataMailbox, &dataRx, BIOS_WAIT_FOREVER);
processMsg(&dataRx);
//UART_read(uart, &uart_rxBuffer, 1);
}
}
void UartRead_registerCallback(UartRead_Callback callback) {
Callback = callback;
}
/* This function writes the Text messge to the UART, The UART write can be formated here */
void processMsg(MsgObj *message){
UART_write(uart, message->buf, strlen(message->buf));
}
/* this function can be called to write to the UART */
void writeToTerminal(String txtString){
MsgObj writeData;
writeData.id = Event_Data_Rx;
writeData.buf = txtString;
Mailbox_post(rxDataMailbox,&writeData,BIOS_WAIT_FOREVER);
}
static void uartReceiveFinished(UART_Handle handle, void *uart_rxBuffer, size_t count)
{
command = uart_rxBuffer;
if(*command == 0x30)
{
if(!echo_char)
{
echo_char = true;
}
else
{
echo_char = false;
}
}
Callback(command);
}
The callback function "Callback" is as under
void UartReadCallback(uint8_t *dataValue)
{
uint8_t Echo_Char[] = "Echo Char";
if(!echo_char)
{
memcpy((void*)&latestDataValue, dataValue, sizeof(dataValue));
Event_post(Tx_Rx_Event, Key_Pressed_Event);// This triggers to send the data to the other radio and receives acknowledgement which is displayed on the //terminal window
}
else
{
//dataValue[1] = '\0';
//memcpy(Echo_Char,dataValue,sizeof(dataValue));
writeToTerminal((void*)Echo_Char);
}
}
So for any key pressed apart from the number 0 (as I am comparing value to 0x30) key on key board the functionality works fine where the radio sends that across to other radio and received acknowledgement which is displayed as "Acknowledgement received" message on the terminal window.
This is the way it is defined
uint8_t ackMsg[] = "Acknowledgment-received";
& it is send to the uart function as "writeToTerminal((void*)ackMsg);"
But whenever I try to hit number 0 as soon as the firmware executes at Maibox_post fucntion the firmware give hard fault exception.
Please provide some input on how to find where the issue lies.
Thank you in advance
Vikram






