This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/TM4C1294NCPDT: Experiencing Hwi Forced HardFault

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

I am trying to write an MQTT publisher by adding the eclipse paho library to the one of the TcpEcho demos in the TI-RTOS library. The program sends 12 packets and then has the following error:

ti.sysbios.family.arm.m3.Hwi: line 1095: E_hardFault: FORCED
ti.sysbios.family.arm.m3.Hwi: line 1172: E_busFault: PRECISERR: Immediate Bus Fault, exact addr known, address: ffffffff
Exception occurred in background thread at PC = 0x0000de48.
Core 0: Exception occurred in ThreadType_Task.
Task name: {unknown-instance-name}, handle: 0x20001898.
Task stack base: 0x200018e8.
Task stack size: 0x800.
R0 = 0x200062fc R8 = 0xffffffff
R1 = 0x0000000d R9 = 0xffffffff
R2 = 0x00000001 R10 = 0xffffffff
R3 = 0x2000f53c R11 = 0xffffffff
R4 = 0xffffffff R12 = 0x00000001
R5 = 0x00000010 SP(R13) = 0x20001ef0
R6 = 0x0000000a LR(R14) = 0x00006e6b
R7 = 0xffffffff PC(R15) = 0x0000de48
PSR = 0x61000000
ICSR = 0x00423803
MMFSR = 0x00
BFSR = 0x82
UFSR = 0x0000
HFSR = 0x40000000
DFSR = 0x0000000b
MMAR = 0xffffffff
BFAR = 0xffffffff
AFSR = 0x00000000
Terminating execution...

I tried increasing the stack size in the .cfg but that didn't help

My task code is below:

Void tcpHandler(UArg arg0, UArg arg1)
{
int clientfd;
int server;
struct sockaddr_in localAddr;
Error_Block eb;

while (1) {
System_printf("tcpHandler: Creating thread clientfd = %d\n", clientfd);

/* Init the Error_Block */
Error_init(&eb);

MQTTPacket_connectData data = MQTTPacket_connectData_initializer;
unsigned char buf[200];
MQTTString topicString = MQTTString_initializer;
unsigned char* payload = "MQTT Packet Message";
int payloadlen = strlen((char*)payload);
int buflen = sizeof(buf);

data.clientID.cstring = "me";
data.keepAliveInterval = 20;
data.cleansession = 1;
int len = MQTTSerialize_connect(buf, buflen, &data); /* 1 */

topicString.cstring = "TivaMQTT";
len += MQTTSerialize_publish(buf + len, buflen - len, 0, 0, 0, 0, topicString, payload, payloadlen); /* 2 */

len += MQTTSerialize_disconnect(buf + len, buflen - len); /* 3 */

server = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

localAddr.sin_family = AF_INET;
localAddr.sin_addr.s_addr = htonl(0xc6291ef1);
localAddr.sin_port = htons(arg0);

connect(server, (struct sockaddr *)&localAddr, sizeof(localAddr));
send(server, buf, len, 0);
close(server);

Task_sleep(250);
}
}