Other Parts Discussed in Thread: CC3100, ENERGIA, MSP432WARE, CC3200
Windows 7 / Code Composer Studio 7 / Energia 18 / MSP 432 LaunchPad + CC3100 WifI
I'd like to use a RTC_C calendar alarm to turn on/off my some streaming data collection, however, it doesn't seem to work. That is, once I register the RTC_C interrupt via RTC_C_registerInterrupt, I'm unable to init the WifI. Specifically it hangs here in WiFi.cpp:
int iRet = sl_Start(NULL, NULL, NULL);
I've whittled my code down to what appears below. Does anyone have any ideas? I assuming I'm missing something...
One interesting note, if I start/disconnect my WiFi before I initialize the RTC_C, then WiFi start/disconnect works fine after the RTC_C stuff. So it looks like the Energia WiFi calls are initializing something that I'm missing...Additionally, if I add in a sl_Stop after my initial disconnect before the RTC_C stuff (to reduce power consumption), then I cannot restart the WiFi later...So it looks like the sl_Stop command is then taking away that initial something. My guess would be this is all interrupt related, but I cannot figure out quite what is going wrong...
jrd
-----
// Header files
#include <WiFi.h> // Energia
#include <driverlib/MSP432P4xx/rtc_c.h>
#ifndef cWiFiSSID
cWiFiSSID should be #define as the name of your WiFi SSID
#endif
#ifndef cWiFiPassword
cWiFiPassword should be #define as the name of your WiFi password
#endif
void vRtcIsr() {
// Clear the flag, but don't actually do anything
RTC_C_clearInterruptFlag(RTC_C_CLOCK_ALARM_INTERRUPT);
}
// Main setup section
void setup() {
// Turn on serial output
Serial.begin(115200);
Serial.println("");
// Enable the clock
RTC_C_startClock();
// Set an alarm
RTC_C_setCalendarAlarm( 0, RTC_C_ALARMCONDITION_OFF, RTC_C_ALARMCONDITION_OFF, RTC_C_ALARMCONDITION_OFF);
RTC_C_registerInterrupt(vRtcIsr);
RTC_C_enableInterrupt(RTC_C_CLOCK_ALARM_INTERRUPT);
}
// Main loop section
void loop() {
// Start WiFi
Serial.println("Attempting to turn on Wifi");
WiFi.begin(cWiFiSSID,cWiFiPassword);
Serial.println("Success");
// Hang forever
for(;;);
}