Restore / Upgrade Mindsensor NXTCam Firmware
After receiving my NXTCam a couple of days ago, I experimented with it for an hour or so initially before turning in for the night. The next morning, I found my NXTCam's Firmware didn't like being woken from it's slumber! I found Deepak Patil of Mindsensors extremely helpful in getting me pointed in the right direction initially when I had issues with my NXTCam v3.0. My panicked emails were responded too very efficiently despite a time zone difference of 12+ hours.
If when using NXTCamView you can't connect to the Mindsensor NXTCam, and you receive a "Search Error: The operation has timed out.". But the NXTCam shows up in the NXTCamView Comport list and the MS Windows Device manager, then your NXTCam's Firmware has most probably become corrupted.
The NXTCam has three processors and a CCD within the sensor unit. The PIC16F886 and AVR Mega 8 are the important processors which interest us. Both the PIC16F886 and AVR Mega 8 have a different Firmware each, with both having the ability to be updated. Both these pieces of Firmware can also fail for no good reason that I can determine.
The I2C communication with Host I2C controller (LEGO NXT) is handled by PIC16F886. This processor also communicates with AVR processor to send commands and receive the responses via an internal serial bus.
The ATmega 8 processor runs the image tracking algorithm. In the default firmware, the colour tracking mode is invoked by an ‘Enable Tracking’ command from the PIC processor. In this mode, each scan line from the image is brought into the processor memory, the line is processed and then discarded to get next scan line. As a result the AVR processor is continuously send tracking data to the PIC processor, or until a ‘Stop Tracking’ command is sent. This same communication happens with NXTCamView, or other USB host program as well.
There is one Default firmware available in pre-compiled hex form, which is factory installed on your NXTCam-v3 when you purchase it. There is also a selection of Custom Firmware available. Source code of the firmware is available at NXTCam SourceForge.net Project. You can create your own customised AVR firmware hex file using this source code and AVR programming tools.
Required Before Restore
- Ensure that you have reviewed the NXTCam-v3 User Guide, and followed steps to install the USB drivers, NXTCamView, etc.
- Install the LEGO Enhanced firmware v1.29 on your NXT (this has several improvements/bug fixes)
- Install Firmware Upgrader from following location on your Windows PC.
Ensure that you have all the required Firmware files:
NXTCam Firmware Code Repositories:
svn co https://nxtcam.svn.sourceforge.net/svnroot/nxtcam nxtcam
Start by Restoring the AVR firmware via PIC processor:
First change NXTCam PIC firmware with file nxtcam_AVRbootstrap.hex. This will take about 8 minutes for upgrade / repair.
Run the Firmware Upgrader application
The Firmware Upgrader is designed to run on a MS-Windows XP or Vista computer.
- Place the program and its configuration file and device firmware in any folder on your computer.
- Connect your NXT directly to your PC on USB port. (Do not use USB hub between PC and NXT. Do not connect your device to NXT yet).
- Exit all other softwares that could interfere with NXT connection. (Softwares such as NXT-G, BricxCC, RobotC do connect to NXT).
- Power OFF and Power ON NXT to ensure fresh USB connection.
- Browse to the folder and double-click the application 'firmwareupgrader'.
Select the Device type
From the 'Device' menu, select menu item 'Select Device type …' and choose NXTCam.
Open firmware hex file
From 'Device' menu, select menu item 'Open Firmware hex file …', browse to the hex file, and open it.
Upgrade the device
Now from 'Device' menu, select menu item 'Upgrade Device …' The program will look for the device for about 10 seconds, during this time, connect the device to your NXT on Sensor Port 1.
(If your device is already connected to Sensor Port 1, unplug it and plug it back in while the program is looking for the device.)
Wait for upgrade process to complete
The progress bar will indicate remaining time required to finish this process. Do not disconnect the NXT or your device until the upgrade finishes.
Disconnect the device
It now has the new firmware that you had in the nxtcam_AVRbootstrap.hex file.
When the bootloader shows a dialog indicating upgrade has finished, Ignore the device checksum errors.
- Wait about 45 seconds, Disconnect NXTCam from NXT.
- Exit Firmware Upgrader.
- Power off NXT.
- Connect NXTCam to NXT (while NXT is powered off).
- Power ON NXT and wait. (at this point the bootstrap program will re-image the firmware – it takes about 30 seconds).
- Wait for 30 seconds or longer, and then power off NXT.
Now restore the PIC firmware:
Upon finishing -
- Power off NXT and
- Disconnect NXTCam from NXT.
- At this stage your NXTCam should have both the new firmwares installed.
Check / Restore your NXTCam settings:
- Attach NXTCam to Port 1 of your NXT and run the program nxtcam-settings.rxe.
- Use Gray Arrow buttons to increment or decrement the settings value for your previous value and press Orange button twice to commit that value to NXTCam.
I trust you found this guide useful. All the information I've used is available on the Mindsensors Website, but I found it hard to track down and figure out initially. Hence the reason for this How-To-Guide! I still can't locate 'nxtcam-settings.rxe' on the Mindsensors Website, but you can download it from here: nxtcam-settings.rxe