Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Mote Application Note: ATmega 128 Programming Problems and Fuse Control UISP Parallel Port Problems Some users experience problems with the UISP firmware download program. These problems manifest themselves in several modes: 1. UISP cannot detect the presence of the ATmega128 processor on the Mote processor board (MPR). 2. Once programmed the part cannot be reprogrammed. 3. Flash errors occur after download, during the verify cycle. Assuming that the MIB programming board is correctly connected to the PC and the mote power supply/battery voltage is adequate, one of the following is generally the cause of these problems: 1. The PC printer port driver is not supported correctly by the UISP program. 2. The PC is outputting serial programming data to the mote too fast. If either of these issues occurs, the ATmega’s fuses may become set incorrectly during the programming process. Depending on which fuses get incorrectly set, this can be fatal and require replacement of the COU chip. Normally, the fuses can be reset to the correct state using the UISP program with fuse control or a JTAG ice. The following items should be checked if problems occur: 1. Use the simplest printer port driver in the BIOS. These drivers go by various name (SPP, AT..). The printer driver EPP and ECP can cause these problems. To change the driver, reboot the computer, enter the bios (before Windows boots) then change the printer driver. 2. In the makerules file (tinyos/apps directory) slow down the uisp clock. Replace the following: PROGRAMMER_FLAGS=-dprog=dapa $(PROGRAMMER_EXTRA_FLAGS) With: PROGRAMMER_FLAGS=-dprog=dapa –dt_sck=40 $(PROGRAMMER_EXTRA_FLAGS) This will slow down the uisp serial clock to 80usec (40 hi, 40lo) Faster times may also work. 3. If using batteries, check the battery voltage. If the battery voltage is less than 3.0V the flash may not be reprogrammed correctly. This can also cause the ATmega128 fuses to be set incorrectly which will defeat any further reprogramming. Users are advised to use a Crossbow MIB500 interface board that detects low battery voltages. This unit also accepts an external wall mounted power supply. (5-15VDC) ATmega128 FUSE CONTROL This is a procedure for controlling ATmega processor fuses via a PC parallel port. © 2002 Crossbow Technology, Inc. 1 of 1 Mote Application Note: ATmega 128 Programming Problems and Fuse Control The setup is identical as used for general UISP programming of a MICA Mote (eg make install.15 mica) Configuration You must use a version of UISP.exe that is v2002.06.26 or later. To determine the uisp.exe version: At cygwin prompt: uisp –h The following should be returned: uisp version 20020626 (c) 1997-1999 Uros Platise, 2000-2002 Marek Michalkiewicz uisp is free software, covered by the GNU General Public License. You are welcome to change it and/or distribute copies of it under the conditions of the GNU General Public License. Syntax: uisp [-v{=level}] [-h] [--help] [--version] [--hash=perbytes] [-dprog=avr910|pavr|stk500] [-dprog=type] [-dlpt=address|/dev/parportX] [-dno-poll] [-dno-retry] [-dvoltage=...] [-dt_sck=time] [-dt_wd_{flash|eeprom}=time] [-dt_reset=time] [-dinvert=sck,mosi,miso,reset] [-dserial=device] [-dpart=name|no] [-dspeed=1200|2400|4800|9600|19200|38400|57600|115200] [--upload] [--verify] [--erase] [if=input_file] [--download] [of=output_file] [--segment=flash|eeprom|fuse] [--terminal] [--rd_fuses] [--wr_fuse_l=byte] [--wr_fuse_h=byte] [--wr_fuse_e=byte] [--wr_lock=byte] Programming Methods: -dprog=avr910 Standard Atmel Serial Programmer/Atmel Low Cost Programmer pavr http://avr.jpk.co.nz/pavr/pavr.html stk500 Atmel STK500 -dprog=dapa|stk200|abb|avrisp|bsd|fbprg|dt006|maxi|dasa|dasa2 Programmer type: dapa Direct AVR Parallel Access stk200 Parallel Starter Kit STK200, STK300 abb Altera ByteBlasterMV Parallel Port Download Cable avrisp Atmel AVR ISP (?) bsd http://www.bsdhome.com/avrprog/ (parallel) fbprg http://ln.com.ua/~real/avreal/adapters.html (parallel) dt006 http://www.dontronics.com/dt006.html (parallel) maxi Investment Technologies Maxi (parallel) dasa serial (RESET=RTS SCK=DTR MOSI=TXD MISO=CTS) dasa2 serial (RESET=!TXD SCK=RTS MOSI=DTR MISO=CTS) Parallel Device Settings: -dlpt= specify device name (Linux ppdev, FreeBSD ppi, serial) or direct I/O parallel port address (0x378, 0x278, 0x3BC) -dno-poll Program without data polling (a little slower) -dno-retry Disable retries of program enable command -dvoltage Set timing specs according to the power supply voltage in [V] (default 3.0) -dt_sck Set minimum SCK high/low time in micro-seconds (default 5) -dt_wd_flash Set FLASH maximum write delay time in micro-seconds -dt_wd_eeprom Set EEPROM maximum write delay time in micro-seconds -dt_reset Set reset inactive (high) time in micro-seconds -dinvert=... Invert specified lines Use -v=3 option to see current settings. © 2002 Crossbow Technology, Inc. 2 of 2 Mote Application Note: ATmega 128 Programming Problems and Fuse Control Atmel Low Cost Programmer Serial Device Settings: -dserial Set serial interface as /dev/ttyS* (default /dev/avr) -dpart Set target abbreviated name or number If -dpart is not given programmer's supported devices are listed. Set -dpart=auto for auto-select. -dspeed Set speed of the serial interface (default 19200) Functions: --upload --verify --download --erase --segment Upload "input_file" to the AVR memory. Verify "input_file" (processed after the --upload opt.) Download AVR memory to "output_file" or stdout. Erase device. Set active segment (auto-select for AVA Motorola output) Fuse/Lock Bit Operations: --rd_fuses Read all fuses and print values to stdout --wr_fuse_l Write fuse low byte --wr_fuse_h Write fuse high byte --wr_fuse_e Write fuse extended byte --wr_lock Write lock bits. Argument is a byte where each bit is: Bit5 -> blb12 Bit4 -> blb11 Bit3 -> blb02 Bit2 -> blb01 Bit1 -> lb2 Bit0 -> lb1 --lock Write lock bits [old method; deprecated]. Files: if of Other Options: -v --hash --help -h --version --terminal Input file for the --upload and --verify functions in Motorola S-records (S1 or S2) or 16 bit Intel format Output file for the --download function in Motorola S-records format, default is standard output Set verbose level (-v equals -v=2, min/max: 0/3, default 1) Print hash (default is 32 bytes) Help Print version information Invoke shell-like terminal Report bugs to: Maintainers <[email protected]> Updates: http://freesoftware.fsf.org/download/uisp/ If the version is not correct: 1. Install UISP v 2002.06.26 or later. Usually this is installed in cygwin folder under ..\usr\local\bin 2. Install and run giveio.sys driver if running under NT/2000/XP as follows (you need giveio.sys and loaddrv.exe. A source of both is at National Semiconductor. Windows2000 driver installation procedure----------1. Log onto Windows2000 as the User/Administrator 2. Go to "Start - Programs - NatSemi" Invoke the LoadDrv utility (or go to C:\Program Files\National Semiconductor\SNAPS\WIN2000\LoadDrv) 3. Modify the path and add "giveio.sys" into the path (The default path should be C:\winnt\system32\drivers\giveio.sys) Click Install © 2002 Crossbow Technology, Inc. 3 of 3 Mote Application Note: ATmega 128 Programming Problems and Fuse Control Click Start 4. Go to "Start - Control Panel - System - Hardware- Device Manager" Under "View", click "Show hidden device" Under "Non-Plug and Play Drivers", click "Giveio" Go to "Driver" tab, change the "Startup type" from "Demand" to "Automatic" ---*A Note If it is not successful, install the Window2000 Recovery Console (if not installed already): - Insert the Windows2000 installation CD, go to directory "i386" and enter the command "winnt32 /cmdcons" - Select the Window2000 installation you want to log onto (ussually 1) - Change the start option of the giveio.sys driver to "automatic" by entering the command "enable giveio service_auto_start" Invoke the LoadDrv utility and start the driver WindowsXP driver installation procedure----------1. Log onto WindowsXP 2. Go to "Start - All Programs - NatSemi" Invoke the LoadDrv utility (or go to C:\Program Files\National Semiconductor\SNAPS\WIN2000\LoadDrv) 3. Check the path and add "giveio.sys" into the path (The default path should be C:\windows\system32\drivers\giveio.sys) Click Install Click Start 4. Reboot 5. Go to "Start - Control Panel - Performance and Maintenance - System" Under "Hardware" tab, click "Device Manager" Under "View", click "Show hidden device" Under "Non-Plug and Play Drivers", click "Giveio" Go to "Driver" tab, change the "Startup type" from "Demand" to "Automatic" Click "Start" Trouble Shooting-------------------- IBM Thinkpad laptop For EPP parallel port mode, don't use address 0x3BC (which is the default address setting in Thinkpad) 0x3BC causes address conlict with video display resulting black screen when SNAPS is launched, press 'Function F7' to set the © 2002 Crossbow Technology, Inc. 4 of 4 Mote Application Note: ATmega 128 Programming Problems and Fuse Control screen back to normal Solution: Change the EEP address to 0x378 or 0x278 Go to "Control Panel - Thinkpad Icon - Parallel Port - Resources" Unclick 'Use automatic setting', change 'Basic configuration' - Notebook which doesn't have EPP Change BIOS configuration to Bi-directional parallel port Use SPP port mode in SNAPS See the list of laptop that has been tested with SNAPS in User Guide Appendix C © 2002 Crossbow Technology, Inc. 5 of 5 Mote Application Note: ATmega 128 Programming Problems and Fuse Control To Program Fuses via UISP 1. Run CYGWIN 2. Install MICA PROGRAMMING module (w/ Mica mote installed) on LPT1: port of PC. Power up board – power is NOT available from LPT1 port. At Cygwin prompt (assumed to be ‘$’): $ uisp -dprog=dapa --rd_fuses//note the two (2) dashes - - in front of ‘rd_fuses’ Atmel AVR ATmega128 is found. pulse Fuse Low Byte Fuse High Byte Fuse Extended Byte Calibration Byte Lock Bits BLB12 -> 1 BLB11 -> 1 BLB02 -> 1 BLB01 -> 1 LB2 -> 1 LB1 -> 1 = = = = = 0xfe 0x19 0xfd 0xa8 0xff -- Read Only This indicates everything is working ok. To disable JTAG and ONCHIP DEBUGGING (doing so is necessary for correct operation of the PZ Sensor module): $uisp –dprog=dapa --wr_fuse_h=0xD9 To enable JTAG (doing so is required for JTAG download and debugging): $uisp –dprog=dapa --wr_fuse_h=0x19 It is recommended the fuse state be verified by reading the settings following a write: $uisp –dprog=dapa --d_fuses For More Information or Help-------------------Contact [email protected] ### © 2002 Crossbow Technology, Inc. 6 of 6