How program update in the field can be done?

Designing hardware and software for systems that use the VS1010 MP3 Audio DSP Microcontroller.
Post Reply
techtoys
Senior User
Posts: 31
Joined: Tue 2012-04-10 17:51

How program update in the field can be done?

Post by techtoys »

Sirs

We are developing an outdoor playback device that needs field update from time to time. Unlike development environment in a lab with full blown PC, USB-UART cable and lab-grade power supply, we wish to implement the update in a handy way.

The first idea is to copy new files (config.txt, *.idx files, and *.mp3) to the SD card onboard from a USB thumb drive in the field. No PC action is required. A sub-routine in the old program needs to recognize a USB thumb has been installed and copy/replace new files to the SD card.

That relates one of the various protocols in Developer Handbook on page 147:
"4 Protocols: To upload boot firmware and other programs to standard SPI NOR flashes or SD cards, you can use the USB Mass Storage protocol."
By reading further, I find Hexadecimal upload protocol, VS3EMU protocol, & UART streaming protocol. But there is no mention of USB Mass Storage protocol.

Is there any example program or direction for studying on this?

John
Hannu
Senior User
Posts: 264
Joined: Mon 2016-05-30 11:54

Re: How program update in the field can be done?

Post by Hannu »

These are problems which don't have off the shelf solutions. At least I find some stupid issue which makes the update harder.

Basically there are three tools. usbhost, delete and copy. Then you need some startup module.
For content the pattern is something like this:
  1. Startup module checks if there is need for update (magic button pattern)
  2. Loads usbhost as device U:
  3. Reads instructions what to update
  4. Calculates checsums of the files on USBdisk and verifies them to instructions
  5. Un-needed content is deleted
  6. Updated content is copied.
  7. Updated content is verified
The firmware:
  1. Copy files from sys/ to backup/
  2. Calculate checksums for both and check those match.
  3. Remove unused dlx files.
  4. copy new dlx files
  5. verify dlx files
  6. delete backup files
If everything goes well U:updatesuccesful.mp3 is played. and system is rebooted.

The big problem is what happens if USB stick is disconnected (bad connection, user in hurry etc.) how to survive from that. The startup system has to restore the files from backup or do something sane. Also battery power must be sufficient. Or if there are backups, d:contactservice.mp3 is played at start. There are so many ways how to get this wrong and so few ways to get it right and they are always HW dependent.

So think it like this. Power can always fail. Disk access can always fail. Both situations needs to be checked and there needs to be way to handle that. Also user can have done stupid things like formatted the USB stick to NTFS or similar.
techtoys
Senior User
Posts: 31
Joined: Tue 2012-04-10 17:51

Re: How program update in the field can be done?

Post by techtoys »

Hannu

Agree with your opinion. An alternative is acceptable today with an OTG-enabled smartphone. Not sure if it works:

1. System in power down mode.
2. A magic button is exposed for field upgrade, pending for click and hold.
3. Smart phone connected through an OTG cable to USB port of VS1010. Smartphone works as the host and VS1010 as USB device.
4. New files are copied from smartphone's UI and old files deleted from VS1010 drive.

This is not much different from a lab environment with USB cable except that the PC is now replaced by a smartphone.

John
Hannu
Senior User
Posts: 264
Joined: Mon 2016-05-30 11:54

Re: How program update in the field can be done?

Post by Hannu »

Yes.

That is one way how it could work. If you have OTG cable and you connect VS1010 device in mass media mode, it could be possible to copy files there. Runlevel 2 should work, 14 maybe and my UMSHS viewtopic.php?f=15&t=2850 should also but I haven't tested it with Android or Iphone.

My understanding on mobile phones is really limited. I know those are computers which I don't know how to program. A quick look tells me that it can be done and then it is just small matter of programming the update mobile app with your favourite tool.
Post Reply