Author Topic: Serial Loader Timout - back to Application  (Read 2852 times)

Offline Al

  • Newbie
  • *
  • Posts: 12
    • View Profile
Serial Loader Timout - back to Application
« on: January 22, 2021, 06:28:07 AM »
I have everything working with the MSD-device serial loader but have one remaining issue.  The application is a full function battery monitor *inside* a line of high capacity lithium batteries (for marine and auto use).  Since the system is inside a sealed battery, there is no way to recycle power to the system as it is started at the battery factory and runs forever from there.  The concern is that a user or technician can get the system into the serial loader and not have a way to recover.

There is a membrane button switch assembly on the battery to restart the system via a serial connection (among othe things) and if the user holds a specific key while the start-up is in process, the serial loader executes (via FORCE_BOOT).  Once in the serial loader. there is no way to return to the application since the serial port no longer exists.

I am looking for a way to have the serial loader timeout and return to the application.  I could enable the SREC serial loader in addition to the MSD-device but don't know how to use that to get back to the applicaiont firmware. The concern here is that while the serial loader menu  would come up, the user would connect to the system with a PC *after* the menu was sent. I was thinking of how to use the watchdog timer but the timout would have to be maybe 30 seconds but I don't see how to do that.

Any advice on this problem is appreciated!

Thanks
Al


Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Serial Loader Timout - back to Application
« Reply #1 on: January 22, 2021, 11:54:01 AM »
Hi Al

If you have a serial board connection there is a small menu (used also by srec or ihex loader) with a "go" command that starts the application.

If the loader comes up as USB-MSD by commanding an eject of the disk it also starts the application. Also simply unplugging the USB will start the application f the option RESET_ON_EJECT is enabled)

Depending on which version of the project you are using there are timeout options in the serial loader which will start the application if there is no activity for a certain time - look for options such as SERIAL_LOADER_TIMEOUT, where there the timeout can be defined with
#define SERIAL_LOADER_TIMEOUT_DELAY  (30.0 * SEC)
for example.

Otherwise you can add it by adding
uTaskerMonoTimer(OWN_TASK, (DELAY_LIMIT)(SERIAL_LOADER_TIMEOUT_DELAY), T_HOOKUP_TIMEOUT); // wait up to a defined amount of time for a response from the PC
when the serial loader starts and calling the same at any point where activity is detected (if you want to it be re-triggered).
When the re-triggerable timer finally fires it generates an event to be sent to the serial loader task, which will cause the application to be started.

Regards

Mark


Offline Al

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Serial Loader Timout - back to Application
« Reply #2 on: January 22, 2021, 09:12:09 PM »
Thanks, Mark.

RESET_ON_EJECT did the trick!

It never fails to amaze me how awesome uTasker is.  Thank you for all your hard work developing it and, especially, for making it availabe to all of us.  Much appreciated!

Al