PCAN-Router flash tool for Linux (BETA)

Universal CAN Converter
Post Reply
User avatar
O.Hartkopp
Posts: 40
Joined: Fri 22. Nov 2013, 19:47

PCAN-Router flash tool for Linux (BETA)

Post by O.Hartkopp » Sat 18. Jun 2016, 12:42

Hey all,

as the software development for PCAN-Router(s) is already working under Linux when installing the cross-compilation tools (see: http://www.peak-system.com/forum/viewto ... =34&t=1112) the only missing part to move completely to Linux is the lack of the Windows PCAN-Flash functionality.

Especially due to support of Philipp Steil and Michael Maidhof from PEAK-System I was able to build a flash tool pcanflash for Linux which can flash the PCAN-Router firmware (bin-file).

The current implementation should be able to flash
  • 1. PCAN-Router
    2. PCAN-Router DR
    3. PCAN-Router pro
    4. PCAN-RS-232
To flash the bin-file which was built e.g. in

Code: Select all

Examples/1_ROUTING/.out/example_can.bin
the process is to set the PCAN-Router into bootloader mode and then run

Code: Select all

$ ./pcanflash -f example_can.bin can0

found modules:
module id 14 - date 30.09.2008 bootloader v2.0
             - hardware 16 (PCAN-Router) flash type 12 (LPC_IAP)

flashing module id : 14

erasing flash sectors:
erasing block at startaddr 0x002000 with block size 0x002000
erasing block at startaddr 0x03C000 with block size 0x002000

writing flash blocks:
writing non empty block at offset 0x2000 with csum 0xEF02
writing non empty block at offset 0x2200 with csum 0xD700
writing non empty block at offset 0x2400 with csum 0xBF0A
writing non empty block at offset 0x2600 with csum 0xE1CF
writing non empty block at offset 0x2800 with csum 0xD61A
writing non empty block at offset 0x2A00 with csum 0x9AE0
writing non empty block at offset 0x2C00 with csum 0xC503
writing non empty block at offset 0x2E00 with csum 0xBE2D
writing non empty block at offset 0x3000 with csum 0xCFB0
writing non empty block at offset 0x3200 with csum 0xDCE4
writing non empty block at offset 0x3400 with csum 0xE6AD
writing non empty block at offset 0x3600 with csum 0xE0C6
writing non empty block at offset 0x3800 with csum 0xDE77
writing non empty block at offset 0x3A00 with csum 0x3102
str=CRC-Arrays ver=0x21 D/M/Y=5/5/6 mode=1 count=1
block[0] .address=0x2000  .len=0x1B8C  .crc=0x0
block[0] .address=0x2000  .len=0x1B8C  .crc=0x8833
writing non empty block at offset 0x3DE00 with csum 0xD55A

done.
The pcanflash tool is still BETA as some checks are missing and it is currently only tested on x86 (little endian) systems. For the other hardware types (e.g. PCAN-MicroMod) the flash layout is not finalized and therefore only the PCAN-Routers are enabled in the code. The tool requires a CAN netdevice interface which is standard in Linux/SocketCAN - the PEAK PCAN hardware interfaces (e.g. PCI/USB/ISA) are supported by recent Linux Kernels out of the box.

As there's no flow control when a flash block is transferred the tx-queue-len should be extendend:

Code: Select all

ip link set can0 up type can bitrate 500000
ip link set can0 txqueuelen 500
If you are interested in testing you can clone the git repository from

https://github.com/hartkopp/pcanflash

and run 'make' to build pcanflash.

Feedback & (probably) bug reports are welcome!

Have fun,
Oliver

Post Reply