USB-CAN
Two step programming procedure:
STEP ONE
MProg.exe (actually in 'C:\Documents and Settings\eche027\Desktop\USB_CAN\ftdi\MProg 3.5 release' dir)
use USB_CAN.ept on Desktop (in 'C:\Documents and Settings\eche027\Desktop\USB_CAN\ftdi' dir)
Select "Scan", then "Program":
STEP TWO
Connecting the programmer (don't forget power from the USB as well):
Atmel parallel programmer (STK200 complient?) C:\Documents and Settings\eche027\Desktop\USB_CAN\Firmware\firm>avrdude -c stk200 -p ATmega162 -U flash:w:firmware_1.07.hex -U hfuse:w:0xD9:m
Or Make Program will do the same thing.
The following nearly works - it lacks the JTAG fuse disable, which breaks functionality
C:\Documents and Settings\eche027\Desktop\USB_CAN\Firmware\firm>avrdude -c stk200 -p ATmega162 -U flash:w:firmware_1.07.hexavrdude: AVR device initialized and ready to accept instructions
Reading || ################################################## || 100% 0.02s
avrdude: Device signature = 0x1e9404
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "firmware_1.07.hex"
avrdude: input file firmware_1.07.hex auto detected as Intel Hex
avrdude: writing flash (5178 bytes):
Writing || ################################################## || 100% 2.56s
avrdude: 5178 bytes of flash written
avrdude: verifying flash memory against firmware_1.07.hex:
avrdude: load data flash data from input file firmware_1.07.hex:
avrdude: input file firmware_1.07.hex auto detected as Intel Hex
avrdude: input file firmware_1.07.hex contains 5178 bytes
avrdude: reading on-chip flash data:
Reading || ################################################## || 100% 2.25s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x0c ! 0xff
avrdude: verification error; content mismatch
avrdude: safemode: lfuse changed! Was 62, and is now ff
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: hfuse changed! Was 99, and is now ff
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: Fuses OK
avrdude done. Thank you.
C:\Documents and Settings\eche027\Desktop\firm>
FAULTS
1)
SJA1000 Chip Select (pin4) needs grounding. Using a resistor or direct short to groud works (HW solution). SW solution preferred - output LOW Signal from Atmel PC.
2)
V1.07 has baud rate irregularity, see http://www.mictronics.de/projects/usb-can-bus/ user comments ~jan2011 -- Main.PhilipCourt - 2011-04-20
NOTES
Fuses:
http://www.engbedded.com/fusecalc/
Ebay device fuse settings: h,l,e 0xD1, 0xD0, 0xFB
Mictronics recommended 0xD0, 0xF7, 0xFB
Our fuse settings: 0xD9, 0xD0, 0xFB
C:\>avrdude -c stk200 -p ATmega162 -U hfuse:w:0xd9:m -U lfuse:w:0xd0:m -U efuse:w:0xfb:m
CAN PINOUT
- RJ45 Pinout:
JF2 Lata cables connect to CAT5 cables as follows (using T568B termination http://en.wikipedia.org/wiki/TIA/EIA-568#T568A_and_T568B_termination):
- CANH to CAT5 pin 1 (PIN One - White/Orange)
- CANL to CAT5 pin 2 (PIN Two - Orange))