While driving down the freeway, I received a warning that the charging system was not working and had a red battery light come on on the dash. I exited the freeway trying to get to a safe place, the dash and infotainment system begun to flash on and off. We heard a loud pop, smelt something burning, saw smoke coming into the cabin and then flames from under the hood near where the battery is located.