Robot Firmware Revised, fixing state machine error

562 views
Skip to first unread message

Steve Pendergrast

unread,
Nov 14, 2017, 10:55:55 PM11/14/17
to Vorpal Robotics Forum

Many thanks to Ahmed Hamdy Mahmoud who last night pointed out a critical finite state machine error in the robot code.

A fix has now been posted to github, and for the convenience of those who are not familiar with github is also in the summary vorpal dropbox files folder here:

What Was The Problem?

The robot has a finite state machine (FSM) that processes incoming bluetooth packets. An error was discovered in the FSM. The error would trigger if the length byte of the packet was corrupted (for example by noise on the bluetooth radio channel). This could cause memory in the robot to be corrupted, which would hang the nano on the robot. The robot would not respond to any commands, including things like turning the dial to "DEMO" or "STAND", until rebooted by switching power off and then back on. This would happen more frequently in environments with lots of bluetooth radio noise.  The robot would simply stop responding until rebooted. Rebooting the gamepad would not help.

Does my robot have the Problem?

This was fixed late in the day on November 14, 2017.  If your kit was shipped on or before November 14, 2017, then your robot firmware has the error.  Kits and robots shipped after November 14 will have the new firmware with the fix.

How Do I Fix It?

Upgrading the robot firmware to the latest version in the shared online folder linked above will fix the issue. See the article "Debugging Tips: Gamepad Does Not Control Robot" for instructions on how to flash a Nano if you have never done it before.  Note: you will be flashing the robot for this fix, not the gamepad.

What If I don't Fix It?

Without the fix, the robot may sometimes hang until rebooted. Depending on how much bluetooth channel radio noise there is in your area, this hang could be rare (once an hour or less) or it could be fairly frequent (every ten to fifteen minutes or maybe more).

The error won't hurt the robot, so there's no need to rush to flash the fix unless you find the hangs are frequent for you (due to your radio noise environment).

What other things can cause the robot to hang?

The robot can still hang even with this patch for other reasons having to do with power:
  • The robot can hang if the batteries get very low, because activity will cause the nano to "brown out" due to lack of required voltage. This is like any other electrical device: the battery needs to be reasonably charged for it to function properly.  This software fix will not cure hangs that occur due to batteries being nearly dead.
  • Other types of hardware issues such as one or more bad servos, bad BEC, bad servo controller, etc., could also cause hangs due to nano brown outs and low voltage conditions.

Dave Leiner

unread,
Nov 15, 2017, 12:40:16 PM11/15/17
to Vorpal Robotics Forum
Great news, Steve. This version seems to have have solved several hangup issues I've been having, including having to turn on both devices at the same time and hanging up running a bad recording. I'll send more details in a PM. Thanks!

--Dave

Joel Einhorn

unread,
Nov 16, 2017, 10:58:20 AM11/16/17
to Vorpal Robotics Forum
I am frantically loking for the instructions to flash the Nano but searching for "Debugging Tips: Gamepad Does Not Control Robot" does not get me anywhere. COuld you please provide a link to the instructions? I find my robot freezes frequently where you hear it receiving signals but won't respond. I assume (hope) that is what is fixed in this update.

Thanks!


On Tuesday, November 14, 2017 at 7:55:55 PM UTC-8, Steve Pendergrast wrote:

Steve Pendergrast

unread,
Nov 16, 2017, 1:01:39 PM11/16/17
to Vorpal Robotics Forum
Hi Joel,

I will get a page up on the wiki explaining the whole process, but a quick summary is:

1) Install the Arduino IDE on your computer. if you have a Mac you will also need a driver. This is explained in the posting mentioned previously. The Arduino IDE download is here:
Use the downloaded library, not the online one. There are some issues with the online one.

2) You will need the Adafruit servo library and the Pixy library. For your convenience I have put these in the same support folder as the code, which is here:

The two zip files are what you want, download them onto your computer.

3) Instructions for loading the library into your IDE (once they're on your computer) are here:

4) Once you have all that done, open up the file in the support folder previously mentioned, called Vorpal-Hexapod-Robot.ino

5) Plug a USB A to mini cable into your computer and into the nano on the robot. You can with a little wiggling get it plugged into the robot nano without removing any electronics from the robot.

6) In the TOOLS menu of the IDE, select BOARD: Arduino Nano,  PROCESSOR: ATmega328, PORT: whatever port shows up is probably your nano, if more than one port shows up take a guess, or unplug the nano for a moment to see which one dissappears.

7) Click the little right facing arrow icon in the toolbar (on the right) and the program will upload to the robot. It should take less than a minute.

Once you have all this setup on your computer you won't have to do the setup again, it will be very easy to load new firmware.

Truthfully, this all doesn't take very long to set up, it goes pretty quick.

Stan Hurd

unread,
Nov 21, 2017, 5:37:34 PM11/21/17
to Vorpal Robotics Forum
Where and what is the wiki?
Stan


On Tuesday, November 14, 2017 at 7:55:55 PM UTC-8, Steve Pendergrast wrote:

Steve Pendergrast

unread,
Nov 21, 2017, 8:20:10 PM11/21/17
to Vorpal Robotics Forum
the wiki is the place on our website with information about the hexapod project (and other future projects will be there too).


There is an insert card with every kit that points you there for the build instructions. There is also technical information, suggested activities, and more.

Fra Gee

unread,
Feb 26, 2018, 10:51:46 AM2/26/18
to Vorpal Robotics Forum
There are 2 ino files, digital and analog! Which one must i flash?
Thanks,
Frans

Op woensdag 15 november 2017 04:55:55 UTC+1 schreef Steve Pendergrast:

Steve Pendergrast

unread,
Feb 26, 2018, 11:55:14 AM2/26/18
to Vorpal Robotics Forum
Hello,

If you got the kit from us and there are no labels on the servos, use the ANALOG version.

If you got the kit from us and there is a label that says TOWER PRO, use the DIGITAL version.

If you sourced your own parts and you are certain the servos are digital, use the DIGITAL version, otherwise it's always safe to use the ANALOG version.

Hope this helps,
Steve P.

Fra Gee

unread,
Feb 28, 2018, 10:58:40 AM2/28/18
to Vorpal Robotics Forum
Hello,
Some trouble with flashing sketch! See attcached text-file!


Op maandag 26 februari 2018 17:55:14 UTC+1 schreef Steve Pendergrast:
hexapod_robot.txt

Steve Pendergrast

unread,
Feb 28, 2018, 11:24:28 AM2/28/18
to Vorpal Robotics Forum
Hello,

Everything at the beginning are warnings. I will be cleaning all those up with the next release, but none of them are going to cause any problems in practice. For example, the "unsigned vs. signed" problems will only cause an issue 2 billion milliseconds after boot,which is something like 23 days. If you can get 23 days of battery life from an 18650 I applaud you!    But anyway, i am cleaning the warnings up, they did not show on the prior version of the IDE which I was still using until recently.

The more serious issue are the "out of sync" errors. This typically means either you have a problem with your usb port, or the nano's usb chip is blown out, or you have something connected to digital pins 0 and/or 1.  The usb chip can blow out due to static electricity and also due to power being applied incorrectly to the nano.

Sometimes if you unplug the nano, plug it into a different usb port, then try again, it will simply work.  Make sure nothing is connected to digital pins 0 and 1, and you're not resting those pins on something metal that could conduct electricity. 

Did you buy the kit from us or source your own parts?  We do flash the programs on the chips here so you should be able to run without flashing until we can get you a new nano.

Fra Gee

unread,
Feb 28, 2018, 11:34:27 AM2/28/18
to Vorpal Robotics Forum
This is the nano that didn’t connect to my remote. Can you remember it? It’s from Kickstarter. Thought I do a reflash, maybe then the problem is solved. It’s not connected to the hexapod, only usb to my computer. Maybe this nano is defect because it didn’t work in my hexapod.
Reply all
Reply to author
Forward
0 new messages