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.

TM4C123GH6PM: My Controller getting automatically flashed

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: ENERGIA, EK-TM4C123GXL

Dear Experts,

Currently, i am working with tm4c123gh6pm based project i am using Energia for programming then i am trying to control 230V Solenoid through relay but when i switch the solenoid my controller getting automatically flashed, i can't understand what is going on there, i have attached my schematic for your reference kindly help to solve this issue,

  

  • Hi,

      Some comments and questions:

      - Is this a custom board with the tm4c123gh6pm chip in it or the PF_1 pin is coming from the EK-TM4C123GXL launchPad?

      - Can you repeat the same problem with another board?

      - Can you reflash the MCU with the same firmware again?

      - If you can reflash the MCU again and rerun the code, can you repeat the same problem?

      - Is the PF_1 the only pin connected to your solenoid system or there are other signals not shown?

      - Can you monitor the power supply going to the MCU with a scope? Do you see any out-of-spec voltage spike? Also monitor the PF_1 pin on the scope. 

      - We don't support Energia on this forum as stated in your FAQ https://e2e.ti.com/support/microcontrollers/other/f/908/t/695568. I don't know if you correctly configure the device using Energia. If PF_1 is the only driver from the MCU to your solenoid then I will suggest you write your code using TivaWare. It should be as simple to driving a GPIO pin. There are TivaWare examples you can reference to do that. 

  • Hi  

    thanks for the quick response and my answers as per your doubts below

    1. Yes this is our customized board with tm4c123gh6pm IC based on TivaC development Board

    2. Yes i have faced the same problem with TivaC Development board also

    3. yes i can reflash the controller with same firmware

    4. Yes this problem repeated when i am trying to switch solenoid

    5. Yes i have connected PF_1 pin to my optocoupler 

    6. i have already tested the same circuit with Arduino UNO board that time i have connected my power supply and digital pin(which is control the solenoid) with my DSO i don't see anything wrong in screen but some time that controller getting reset but not much time controller getting reset.

    7. i have download tiva ware from this site  

    but i don't know how to use this if you have any reference for how to use tivaware with tivac kindly share with me it will help to resolve this problem if energia code is not sufficient

    note: i can't use any paid IDE like IAR workbench and all other paid IDE for development  

  • Unwanted, Automatically Flashed, Greetings,

    surya said:
    ... When I switch the solenoid my controller is getting automatically flashed

    May it be simply asked,

    • "HOW have you come to such a conclusion?"   

    and

    • "What is the extent of (any) such unwanted Flash Programming?"   (i.e. Is the MCU completely or just partially re-programmed?)

    My group is "doubtful" that such (unwanted) programming is occurring - again your reasons for making such claim are of "high interest."

    Should (some) unwanted, "Re-Programming" occur - what is the state of your Debugger during these (unwanted) events?    (we suspect that it is still "attached" - and thus (any/all) "Guilt" resides w/in your "energy-lite" development system...)

  • Hi cb1,

      Thank you for your great questions that I should have asked in my post. I was led to think that the "automatically flashed" as "automatically erased". There is no way the MCU can be reflashed with another piece of firmware whether or not the debug probe is attached to the JTAG. If there is a bootloader, in my wildest guess, some noise from the solenoid triggers the bootloading to start. More clarification is needed from the posters. I appreciate your turning the troubleshooting in the right direction. I would request the poster to show the memory content of the flash after the problem occurs. 

  • Hi Charles,

    Thank you for your great kindness - much appreciated.    And - these observations are primarily "Young Staff recognized & presented!"    (Yet cb1 claims "Automatically Flashed, Greetings!"   One of the rare times staff applauds moi...)

    We must "keep in mind" that (too often) "poster diagnostics" prove, NOT "Good for Gov't Work!"   (Would they, "Arrive here - if they (really) knew?")

  • Hi ,

    i have attached my Energia code for your review and this code working fine for the last 2weeks but just two days before i have added solenoid control for my project after that I have faced this "flashed issue" that why i am getting confused because of this same circuit if i connect with my Arduino UNO that is working fine and some times controller getting reset but not too much time but don't get flash memory to erase problem, 

    #include<EEPROM.h>
    #include <ArduinoJson.h>
    #include "driverlib/interrupt.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/watchdog.h"
    #include "driverlib/rom_map.h"
    #include "driverlib/rom.h"
    
    HardwareSerial &HC12 = Serial2;
    
    #define flow_pin  31
    
    #define SET  10
    
    const int LED = 15;    //31; 
    
    const int S_LED =  30;
    const int W_LED =  29;
    
    long int Count;
    String UNIQID;
    int IDlen;
    int prvState = 0;
    int flowState = 0;
    String StrAT = "AT+C";
    String SerialData = "";
    String HCData;
    String data;
    static long previousMillis;
    
    /***** LED BLINK *****/
    int ack = 0;
    int count = 0;
    int led_on;
    /***** LED WARN *****/
    int ack1 = 0;
    int count1 = 0;
    int led_warn;
    
    /*********************/
    byte sensorPin       = 17;              //15
    float calibrationFactor = 4.5;
    
    //static long pulseCount=0;
    long pulseCount;
    float flowRate;
    float flowLitres;
    float totalLitres;
    unsigned long oldTime;
    float val;
    long send_lit = 0;
    
    float Final_flow;
    String Flow_rate;
    float fprint;
    float fstore;
    
    String HC_ID="001";
    
    String F_rate;
    
    void setup()
    {
      pinMode(LED, OUTPUT);
      pinMode(W_LED, OUTPUT);
      pinMode(S_LED, OUTPUT);
    
      digitalWrite(W_LED, LOW);
      digitalWrite(S_LED, LOW);
      
      digitalWrite(LED, HIGH);
      delay(3000);
      digitalWrite(LED, LOW);
    
      Serial.begin(115200);
      HC12.begin(9600);
    
      pinMode(flow_pin, INPUT);
      pinMode(SET, OUTPUT);
      pinMode(sensorPin, INPUT_PULLUP);
    
      // digitalWrite(sensorPin, HIGH);
    
      watchdog();
    
      pulseCount        = 0;
      flowRate          = 0.0;
      flowLitres        = 0.0;
      totalLitres       = 0.0;
      oldTime           = 0.0;
    
      Serial.println("Water_Flow_Monitor");
      digitalWrite(SET, LOW);
      delay(100);
    
      HC12.print("AT+RX");
      delay(200);
    
      while (HC12.available())       // HC-12 Serial5
      {
        HCData = HC12.readString();
      }
      Serial.println(HCData);
      digitalWrite(SET, HIGH);
      HCData = "";
    
      UNIQID = read_id();
      IDlen = UNIQID.length();
    
      F_rate = read_count();
      Count = F_rate.toInt();
    
      Serial.print("Flow Rate:");
      Serial.println(Count);
    
      attachInterrupt(sensorPin, pulseCounter, FALLING);
    
      Flow_rate        = read_flow();
      Final_flow       = Flow_rate.toFloat();
      //totalLitres = Final_flow;
      Serial.print("CONSUMED LITERS:");
      Serial.println(Final_flow);
      
      //fstore = Final_flow;
      // totalLitres1=totalLitres;
    
      flowState = digitalRead(flow_pin);
      prvState = flowState;
    }
    
    void loop()
    {
    
    
      flowState = digitalRead(flow_pin);
    
      /*****************************************************************************************************/
      if (flowState != prvState)
      {
        if (flowState == LOW)
        {
          String FLOW;
          Count += 1;
          FLOW = String(Count);
          write_count(FLOW);
          delay(500);
        }
        prvState = flowState;
      }
      /*****************************************************************************************************/
      led_blink();
      led_Warn();
      /*****************************************************************************************************/
      if (((millis() - oldTime) > 5000) || (pulseCount >= 3500))
      {
        detachInterrupt(sensorPin);
        oldTime = millis();
        if (pulseCount >= 3500)
        {
          Final_flow += pulseCount / 3500;
          Serial.print("Total Pulses: ");
          Serial.println(Final_flow);
          flow_store();
          pulseCount = 0;
        }
        Serial.print("Current Pulses: ");
        Serial.println(pulseCount);
        //HC12.print("HC Current Pulses: ");
        //HC12.println(pulseCount);
        attachInterrupt(sensorPin, pulseCounter, FALLING);
      }
    }
    /*****************************************************************************************************/
    void serialEvent()
    {
      if (Serial.available())
      {
        char inChar = (char)Serial.read();
        SerialData += inChar;
        if (inChar == '\n')
        {
          Serial_Check();
        }
      }
    }
    /*****************************************************************************************************/
    void serialEvent2()
    {
      if (HC12.available())
      {
        char inChar = (char)HC12.read();
        HCData += inChar;
        if (inChar == '\n')
        {
          HC_Check();
        }
      }
    }
    /*****************************************************************************************************/
    void pulseCounter()
    {
      pulseCount++;
      Serial.print("PULSES");
      Serial.println(pulseCount);
      delay(10);
    }
    /*****************************************************************************************************/
    
    void Check_id()
    {
      int i;
      IDlen = UNIQID.length();
      if (IDlen > 2)
      {
        Serial.println("ALREADY SET");
      }
      else
      {
        String data = SerialData.substring(9, 23);
        int _size = data.length();
    
        for (i = 0; i < _size; i++)
        {
          EEPROM.write(i, data[i]);
        }
        EEPROM.write(i + _size, '\0'); //val termination null character for String Data
        UNIQID = "";
        UNIQID = read_id();
        IDlen = UNIQID.length();
        Serial.println("SET OK");
      }
    }
    
    /*************************************************************************************************************/
    void write_count(String off)
    {
      int i;
      int j;
      int _size = off.length() + 40;
      //count_clear();
      for (i = 40; i < _size; i++)
      {
        EEPROM.write(i, off[j]);
        j++;
      }
      EEPROM.write(_size + 1, '\0'); //val termination null character for String Data
      Count = 0;
      String nul = read_count();
      Serial.print("read_Count");
      Serial.println(nul);
      Count = nul.toInt();
    }
    
    /*************************************************************************************************************/
    void write_flow(String data)
    {
      int i;
      int j = 0;
      int _size = (data.length() + 80);
      for (i = 80; i < _size; i++)
      {
        EEPROM.write(i, data[j]);
        j++;
      }
      EEPROM.write(i + _size, '\0');
      String nul = read_flow();
      Final_flow = nul.toFloat();
      Serial.print("Read_One: ");
      Serial.println(Final_flow);
    }
    
    void Serial_Check()
    {
      //  Serial.print("SerialData:");
      // Serial.println(SerialData);
      if (SerialData.substring(0, 9) == "KALA+SID=")
      {
        led_on = 100;
        count = 1;
        if (SerialData.length() == 25)
        {
          Check_id();
        }
        else
        {
          //Serial.print(SerialData.length());
          Serial.println("ERR CHECK ID");
        }
      }
      else if (SerialData.substring(0, 9) == "KALA+PING")
      {
        led_on = 100;
        count = 1;
        if (IDlen > 2)
        {
          Serial.print("CHILD/");
          Serial.println(UNIQID);
        }
        else
        {
          Serial.println("CHILD/NO ID");
        }
      }
    
      else if (SerialData.substring(0, 8) == "CLEAR_ID")
      {
        led_on = 100;
        count = 1;
        ID_clear();
      }
       else if (SerialData.substring(0, 9) == "CLEAR_ALL")
      {
        led_on = 100;
        count = 1;
        Clear_All();
      }
      else if (SerialData.substring(0, 9) == "KALA+DATA")
      {
        led_on = 100;
        count = 1;
        json_data(1,1);
      }
    
        else if (SerialData.substring(0, 10) == "FLOW+CLEAR")
      {
        led_on = 100;
        count = 1;
        //flow_clear();
        delay(500);
        count_clear();
      }
      else
      {
        Serial.println("Check Command");
      }
      SerialData = "";
    }
    
    void ID_clear()
    {
      int i;
      for (i = 0; i <30 ; i++)
      {
        EEPROM.write(i, 0);
        UNIQID = "";
        IDlen=0;
      }
      Serial.println("ID CLEARED");
    }
    /*****************************************************************************************************/
    void count_clear()
    {
      int i;
      for (i = 40; i < 60; i++)
      {
        EEPROM.write(i, 0);
      }
      Serial.println(" COUNT DATA CLEARED");
    }
    /*****************************************************************************************************/
    void flow_clear()
    {
      int i;
      for (i = 80; i < 100 ; i++)
      {
        EEPROM.write(i, 0);
      }
      Serial.println(" FLOW DATA CLEARED");
    }
    /*****************************************************************************************************/
    
    void Clear_All()
    {
      int i;
      for (i = 0; i < 1024 ; i++)
      {
        EEPROM.write(i, 0);
      }
      Serial.println(" ALL DATA CLEARED");
    }
    
    void ftoa(float n, char *res, int afterpoint)
    {
      int ipart = (int)n;
      float fpart = n - (float)ipart;
      int i = intToStr(ipart, res, 0);
      if (afterpoint != 0)
      {
        res[i] = '.';  // add dot
        fpart = fpart * pow(10, afterpoint);
        intToStr((int)fpart, res + i + 1, afterpoint);
      }
    }
    void reverse(char *str, int len)
    {
      int i = 0, j = len - 1, temp;
      while (i < j)
      {
        temp = str[i];
        str[i] = str[j];
        str[j] = temp;
        i++; j--;
      }
    }
    int intToStr(int x, char str[], int d)
    {
      int i = 0;
      while (x)
      {
        str[i++] = (x % 10) + '0';
        x = x / 10;
      }
      while (i < d)
        str[i++] = '0';
      reverse(str, i);
      str[i] = '\0';
      return i;
    }
    
    /*************************************************************************************************************/
    
    void Fprint()
    {
      Serial.print("Current Flow Rate: ");
      Serial.print(flowLitres * 60);
      Serial.println(" L/MIN");
    
      Serial.print("Total Pulses: ");
      Serial.print(Final_flow);
      Serial.println(" L");
      Serial.println("*****************************************");
    }
    /*************************************************************************************************************/
    
    void flow_store()
    {
      char buffer[30];
      String stringOne;
      ftoa(Final_flow, buffer, 2);
      stringOne += buffer;
      Serial.print("string Conversion ");
      Serial.println(stringOne);
      write_flow(stringOne);
    }
    /*************************************************************************************************************/
    
    
    void HC_Check()
    {
      Serial.print("HC Data");
      Serial.print(HCData);
      if (HCData.substring(0, 14) == UNIQID)     // 0,14
      {
        if (HCData.substring(15, 19) == "DATA")
        {
          led_on = 100;
          count = 1;
          json_data(2,1);
        }
        //********************************************************************************
        //Warning Alart
        //********************************************************************************
        else if (HCData.substring(15, 19) == "WARN")
        {
          led_on = 100;
          count = 1;
          led_warn = 100;
          count1 = 1;
          //digitalWrite(W_LED, HIGH);
          digitalWrite(S_LED, LOW);
          json_data(2,2);
        }
        //********************************************************************************
       //Cutoff Alart
        //********************************************************************************
        else if (HCData.substring(15, 19) == "STOP")
        {
          led_on = 100;
          count = 1;
          led_warn = 0;
          digitalWrite(S_LED, HIGH);
          digitalWrite(W_LED, LOW);
          json_data(2,3);
        }
        //********************************************************************************
       // Relay ON trip
        //********************************************************************************
        else if (HCData.substring(15, 20) == "START")
        {
          led_on = 100;
          count = 1;
          led_warn = 0;
          digitalWrite(S_LED, LOW);
          digitalWrite(W_LED, LOW);
          json_data(2,4);
        }
        //********************************************************************************
    
        else if (HCData.substring(15, 19) == "PING")
        {
          led_on = 100;
          count = 1;
          if (IDlen > 2)
          {
            HC12.print("CHILD OK");
            //Serial.println(recivedData);
          }
          else
          {
            HC12.println("CHILD/NO ID");
          }
        }
    
        else if ((HCData.substring(15, 16) == "0") || (HCData.substring(15, 16) == "1"))
        {
          led_on = 100;
          count = 1;
          digitalWrite(SET, LOW);
          delay(100);
          String StrDos = StrAT + HCData.substring(15, 18);
          HC12.print(StrDos);
          delay(200);
          String HCData = "";
          while (HC12.available()) // HC-12 Serial2
          {
            HCData = HC12.readString();
          }
          digitalWrite(SET, HIGH);
          delay(200);
          Serial.println(HCData);
        }
      }
      HCData = "";
    }
    
    void json_data(int json, int stat)
    {
      StaticJsonBuffer<1024> jsonBuffer;
      JsonObject& root = jsonBuffer.createObject();
    
      if(stat==1)
      {
        JsonArray& data = root.createNestedArray("DATA");
        data.add(HC_ID);
        data.add(Final_flow);
        data.add(Count);
        //data.add(pulseCount);
      }
      else if(stat==2) 
      {
        JsonArray& data = root.createNestedArray("CMD");
        data.add(HC_ID);
        data.add("WARN|OK");
      }
    
      else if(stat==3) 
      {
        JsonArray& data = root.createNestedArray("CMD");
        data.add(HC_ID);
        data.add("STOP|OK");
      }
      else if(stat==4) 
      {
        JsonArray& data = root.createNestedArray("CMD");
        data.add(HC_ID);
        data.add("START|OK");
      }
    
      if (json == 1)
      {
        root.printTo(Serial);
        Serial.println();
      }
      if (json == 2)
      {
        root.printTo(HC12);
        HC12.println();
        root.printTo(Serial);
        Serial.println();
      }
    
      if (json == 3)
      {
        Serial.print("Flow Rate: ");
        Serial.println(Flow_rate);
        Serial.print("Count: ");
        Serial.println(F_rate);
      }
    }
    /*****************************************************************************************************/
    void led_blink()
    {
     if(led_on!=0)
      {
        if(count==1)
        {
          if(ack==0)
          {
          ack=1;
          previousMillis = millis();
          previousMillis += led_on;
          }
          if (previousMillis >= millis())
          {
            count+=1;
            digitalWrite(LED, HIGH);
          }
          else
          {
            digitalWrite(LED, LOW);
           // led_on=0;
            count=2;
            ack=0;
          }
        }
        if(count==2)
        {
          if(ack==0)
          {
          ack=1;
          previousMillis = millis();
          previousMillis += led_on;
          } 
          if (previousMillis >= millis())
          {
            digitalWrite(LED, LOW);
          }
          else
          {
            digitalWrite(LED, HIGH);
            //led_on=0;
            ack=0;
            count=3;
          }
        }
        if(count==3)
        {
          if(ack==0)
          {
          ack=1;
          previousMillis = millis();
          previousMillis += led_on;
          }
          if (previousMillis >= millis())
          {
            digitalWrite(LED, HIGH);
          }
          else
          {
            digitalWrite(LED, LOW);
           // led_on=0;
            count=4;
            ack=0;
          }
        }
       if(count==4)
        {
          if(ack==0)
          {
          ack=1;
          previousMillis = millis();
          previousMillis += led_on;
          } 
          if (previousMillis >= millis())
          {
            digitalWrite(LED, LOW);
          }
          else
          {
            digitalWrite(LED, HIGH);
            //led_on=0;
            ack=0;
            count=5;
          }
        }
        if(count==5)
        {
          if(ack==0)
          {
          ack=1;
          previousMillis = millis();
          previousMillis += led_on;
          } 
          if (previousMillis >= millis())
          {
            digitalWrite(LED, HIGH);
          }
          else
          {
            digitalWrite(LED, LOW);
            led_on=0;
            ack=0;
            count=0;
          }
        }
      }
    }
    //***************************************************************************************************************************
    
    void led_Warn()
    {
      if(led_warn!=0)
      {
        if(count1==1)
        {
          if(ack1==0)
          {
          ack1=1;
          previousMillis = millis();
          previousMillis += led_warn;
          }
          if (previousMillis >= millis())
          {
            count1+=1;
            digitalWrite(W_LED, HIGH);
          }
          else
          {
            digitalWrite(W_LED, LOW);
           // led_on=0;
            count1=2;
            ack1=0;
          }
        }
        if(count1==2)
        {
          if(ack1==0)
          {
          ack1=1;
          previousMillis = millis();
          previousMillis += led_warn;
          } 
          if (previousMillis >= millis())
          {
            digitalWrite(W_LED, LOW);
          }
          else
          {
            digitalWrite(W_LED, HIGH);
            //led_on=0;
            ack1=0;
            count1=3;
          }
        }
        if(count1==3)
        {
          if(ack1==0)
          {
          ack1=1;
          previousMillis = millis();
          previousMillis += led_warn;
          }
          if (previousMillis >= millis())
          {
            digitalWrite(W_LED, HIGH);
          }
          else
          {
            digitalWrite(W_LED, LOW);
           // led_on=0;
            count1=1;
            ack1=0;
          }
        }
        }
    }
    
    //**************************************************************************************************************************************
     /*****************************************************************************************************/
    String read_id()
    {
      int i;
      char data[100]; //Max 100 Bytes
      int len = 0;
      unsigned char k;
      k = EEPROM.read(0);
      while (k != '\0' && len < 20) //Read until null character
      {
        k = EEPROM.read(len);
        data[len] = k;
        len++;
      }
      data[len] = '\0';
      return String(data);
    }
    /*****************************************************************************************************/
    String read_count()
    {
      int i=40;
      char data[100]; //Max 100 Bytes
      int len = 0;
      unsigned char k;
      k = EEPROM.read(40);
      while (k != '\0' && len < 20) //Read until null character
      {
        k = EEPROM.read(i);
        data[len] = k;
        len++;
        i++;
      }
      data[len] = '\0';
      return String(data);
    }
    /*****************************************************************************************************/
    String read_flow()
    {
      int i = 80;
      char data[100];
      int len = 0;
      unsigned char k;
      k = EEPROM.read(80);
      while (k != '\0' && len < 20)
      {
        k = EEPROM.read(i);
        data[len] = k;
        len++;
        i++;
      }
      data[len] = '\0';
      return String(data);
    }
    /*****************************************************************************************************/
    
    void watchdog()
    {
    
      MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0);                  // Enable the watchdog peripheral
    
      MAP_WatchdogReloadSet(WATCHDOG0_BASE, MAP_SysCtlClockGet() * 2);  // Set timeout of watchdog to 2 sec
    
      MAP_WatchdogResetEnable(WATCHDOG0_BASE);                          // Reset when watchdog expires
    
      WatchdogIntRegister(WATCHDOG0_BASE, &WatchdogIntHandler);         // Register the watchdog interrupt handler
    
      MAP_WatchdogEnable(WATCHDOG0_BASE);                               // Enable the watchdog
    
      if (SysCtlResetCauseGet() & SYSCTL_CAUSE_WDOG0)                   // Get and print the reset cause
      {
        Serial.println("Watchdog Reset");
      }
      else if (SysCtlResetCauseGet() & SYSCTL_CAUSE_EXT)
      {
        Serial.println("External reset");
      }
      
      SysCtlResetCauseClear(SYSCTL_CAUSE_WDOG0 | SYSCTL_CAUSE_EXT);
    }
    
    void WatchdogIntHandler(void)
    {
      WatchdogIntClear(WATCHDOG0_BASE);                         // Clear the watchdog interrupt.
    // Serial.println("REG CLEAR");
    }

     if you find any mistakes in my code kindly let me know 

    regards

    kannannatesh

  • Apparently "Not Quite, Automatically Flashed" Greetings,

    That's a wealth of code to review - is it not?    And - as the vendor agent wrote - neither he nor my small group are "fans" of the "low-energy" group's (much relaxed) efforts!

    Without reading through that vast code - there (may) be a means to resolve your (MCU Reset [FAR from Automatically Flashed]) issue:

    • Double check that your "protective diode" is installed as the schematic notes (i.e. w/diode's anode tied to the transistor's open collector)
    • Temporarily remove the 220V from the "Solenoid Drive" portion of your circuit & repeat your tests.    (objective is to learn "IF & HOW" the 220V aspect of the circuit causes your issue - or if the Relay Drive (alone) contributes/causes.)
    • Reposition the 220Ω resistor so it is "in series" (and close to) the driving MCU pin -  & not tied to ground.   You may add a 0.1µF capacitor at the junction of that resistor & the MCU pin, too.

    Your schematic representation for the relay  is "non-standard."    Rather than showing "Switched Contacts" it almost appears that a transformer winding has "Joined the Mix."   

    The "low energy group" should be the ones who "enjoy the pleasure" of reviewing (their code) creation - not those blameless - (yet armed w/REAL Energy) assisting here...

  • Hi,

      In my first reply to you, I already stated that we don't support Energia in this forum. Thanks to cb1 for the various suggestions, I hope they will help you narrow down your problem. Earlier you mentioned that your Arduino exhibits reset as a symptom instead of automatically reflashed as on the Tiva device. The two different devices all exhibit unexpected behavior when subjected to external interference. I think the problem is on your system hardware not the software. You can cut down your code to the minimal with only the portion that control the PF1 pin and I think you will still see the same problem. 

      You didn't show what was in the flash after the problem? Was the entire flash erased with all F's in the memory browser? Or were only some locations corrupted?

      You didn't show any scope captures of the power supply, reset pin and I/O pins that are connected to your solenoid system. What about any inrush current to the MCU?