Part Number: MSP430FR2355
So I have the main body of my software running in a loop. The loop keeps going for awhile. For this conversation it is pretty much an infinite loop.
before the loop occurs its really just setting up TimerB, RTC, and GPIO pins.
Once we hit the loop this is the flow
if usb connected AND !burst_cycle Enter menu mode else if !usb connected AND burst_cycle disable burst_cycle else if !burst_cycle prep 4 LPM if !usb connected AND lpm time hasn't been met enter LPM exit LPM calculate time in LPM and add to system time wake up if usb connected AND !burst_cycle restart at beginning of loop prep for scan scan for predetermined period of time or until !usb connected end scan functionatlity start at beginning of loop
and here is the actual code of the loop itself.
while (localrecord < 0xFFFF) //FFFF is the last record possible on the disk { // checks to see if a USB cable is connected to the device, but not in terminal_debug. if ((P2IN & BIT4) && !BURST_CYCLE) { run_menu(); continue; } else if( !(P2IN & BIT4) && BURST_CYCLE) { BURST_CYCLE = 0; continue; } // Normal operation when the USB cable is connected or disconnected, but has exited the main menu and not in terminal debug mode. else if (!BURST_CYCLE) { prep_4_sleep(); while ( !(P2IN & BIT4) && (lpm_count < lpm_multiplier) ) { enter_low_power_mode(); calc_sys_time(lpm_period); lpm_count++; } lpm_count = 0; wake_up(); delay_ms(500); if ((P2IN & BIT4) && !BURST_CYCLE) continue; } prep_scan(); start_read = time2Sec(); readFlag = 1; do { read_sensor(); if( readFlag) readFlag = counter(start_read, READTIME); if( !(P2IN & BIT4) && (numOfComReads == 1) ) break; }while (readFlag || (numOfComReads != 1) ); end_scan(); }
What I'm seeing is at random times the application itself is resetting. It will be running just fine and then it starts all over from the beginning of the Main method.
Now I know that the software examples for LPM doesn't use a loop, rather it will enter LPM for the predetermined time, exit and the main menu restarts itself. It was predetermined, by someone not me, that they wanted to implement the software by utilizing a loop. Rather than the using the auto restart aspect of the chip.
How do I keep the software from relaunching from the beginning of the main method?
Keep in mind, I thought that it was exciting the while loop, so I threw a break point outside of the while loop and its never tripped.
Now that I think of it, I'm pretty sure that its not restarting from the beginning of the Main Method rather reloading the entire software package. Am I correct on that?