Part Number:CC3200-LAUNCHXL
Hi,
I create three tasks(MqttClient, WifiFlagSetting, wificonnect) and message queue in my main().
Flow is when I press button, message event PUSH_BUTTON_SW2_PRESSED will be write in the queue,
and in the WifiFlagSetting task, I use a loop to read message queue.
But it always stuck in FaultISR().
Could you help?
Thanks!
Regards,
Lex
void main()
{
long lRetVal = -1;
//===== Initialize the board configurations =====
BoardInit();
//===== Pinmux for UART =====
PinMuxConfig();
//===== Register push button handlers
Button_IF_Init(pushButtonInterruptHandler2,pushButtonInterruptHandler3);
//===== Start the SimpleLink Host =====
lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
if(lRetVal < 0)
{
UART_PRINT("Fail to start the simplelink host\n");
LOOP_FOREVER();
}
//===== Create message queue =====
create_messageQueue();
//===== Start the MQTT Client task =====
lRetVal = osi_TaskCreate(MqttClient,
(const signed char *)"Mqtt Client App",
OSI_STACK_SIZE, NULL, 2, NULL );
if(lRetVal < 0)
{
UART_PRINT("Fail to start the MQTT client task\n");
LOOP_FOREVER();
}
//===== Start Wifi direct flag setting task =====
lRetVal = osi_TaskCreate(WifiFlagSetting,
(const signed char *)"Set Flag for Wifi setting",
OSI_STACK_SIZE, NULL, 2, NULL );
if(lRetVal < 0)
{
UART_PRINT("Fail to start wifi flag setting task\n");
LOOP_FOREVER();
}
//===== Start Wifi connection task =====
lRetVal = osi_TaskCreate(wificonnect,
(const signed char *)"Wifi connect",
OSI_STACK_SIZE, NULL, 2, NULL );
if(lRetVal < 0)
{
UART_PRINT("Fail to start WiFi connection task\n");
LOOP_FOREVER();
}
//===== Start the task scheduler =====
osi_start();
}
void pushButtonInterruptHandler2()
{
event_msg msg;
msg.event = PUSH_BUTTON_SW2_PRESSED;
msg.hndl = NULL;
UART_PRINT("WiFi setting key is pressed\n");
// write message indicating exit from sending loop
write_messageQueue(&msg);
Button_IF_EnableInterrupt(SW4);
}
void WifiFlagSetting(void *pvParameters)
{
event_msg RecvQue;
wifi_new_setting wifiNewSetting;
for(;;)
{
read_messageQueue(&RecvQue);
if(PUSH_BUTTON_SW2_PRESSED == RecvQue.event)
{
if(connectionBreak != 1)
{
wififlag = '1';
UART_PRINT("SW2 PRESSED\n");
if(WriteFileToDevice(wififlag, wifiNewSetting) < 0)
{
UART_PRINT("Failed to write the flag(=1) into file\n");
}
}
UART_PRINT("\n\n****SYSTEM REBOOT!!****\n\n");
// Restart system
MAP_PRCMHibernateIntervalSet(330);
MAP_PRCMHibernateWakeupSourceEnable(PRCM_HIB_SLOW_CLK_CTR);
MAP_PRCMHibernateEnter();
}
}
}
void create_messageQueue()
{
UART_PRINT("Create queue\n");
//===== Create message queue =====
osi_MsgQCreate(&g_PBQueue,"PBQueue",sizeof(event_msg),10);
}
void write_messageQueue(event_msg *write_msg)
{
UART_PRINT("Write queue\n");
//===== Write message queue =====
osi_MsgQWrite(&g_PBQueue,&write_msg,OSI_NO_WAIT);
}
void read_messageQueue(event_msg *read_msg)
{
UART_PRINT("Read queue\n");
//===== Read message queue =====
osi_MsgQRead( &g_PBQueue, &read_msg, OSI_WAIT_FOREVER);
//osi_MsgQRead( &g_PBQueue, &read_msg, 100);
}