Hi Guys, I have a problem on a project i'm working on.
The board is based on an Atmel2560 (arduino Mega like) programmed as a standard arduino board with arduino IDE, the board has multiple sensor onboard and an SD card to log some activity. The LCD ( Gen4-uLCD-70 ) is connected directly to the Serial3 of the micro.
Everything works good but if for some external reason I lost the power supply of the uLCD I face a lag on the loop of about 3000 ms and i'm not able to recovery this lag, even forcing a new reset "on the fly" will cause the micro to reboot.
The problem occurs after some time of working, sometimes minutes, sometimes hours, but I'm able to replicate it by force a glitch on the serial line or a power cycle on the +5v of the display.
I try catch the lag with this code but will cause unexpectedly the 2560 to reset, after reset everything work again but of course I loose the running data and logs.
the question is if there is a way to catch a timeout on uLCD comunication that will non block the code and try a reset of the uLCD, like in case of a power glitch that will reset the display but not the 2560.
The whole code is very long and articulated but I think is not involved in this problem.
Sorry for my bad English and thanks for any help
Flavio
The board is based on an Atmel2560 (arduino Mega like) programmed as a standard arduino board with arduino IDE, the board has multiple sensor onboard and an SD card to log some activity. The LCD ( Gen4-uLCD-70 ) is connected directly to the Serial3 of the micro.
Everything works good but if for some external reason I lost the power supply of the uLCD I face a lag on the loop of about 3000 ms and i'm not able to recovery this lag, even forcing a new reset "on the fly" will cause the micro to reboot.
The problem occurs after some time of working, sometimes minutes, sometimes hours, but I'm able to replicate it by force a glitch on the serial line or a power cycle on the +5v of the display.
I try catch the lag with this code but will cause unexpectedly the 2560 to reset, after reset everything work again but of course I loose the running data and logs.
Code:
timerled = millis() - currentMillis ; // Calculate looptime in ms if (timerled > 1000 && millis()-last_reset > 15000 ){ // if I face a Lag > 1 sec try reset the display in 15 sec shedule last_reset = millis(); digitalWrite(lcd_reset, 0); // Reset the Display via D30 delay(100); digitalWrite(lcd_reset, 1); // unReset the Display via D30 delay (5000); //let the display start up }
The whole code is very long and articulated but I think is not involved in this problem.
Sorry for my bad English and thanks for any help
Flavio
Comment