CAN Sender

CAN Sender

Previous pageReturn to chapter overviewNext page

The CAN Sender module can be used for simple CAN testing applications which require sending one or several fixed CAN frames.

It is not a full scripting engine (for that, use the Automation module) but a simple macro sequence for quick and easy testing.

Available commands:

send <ID>,<data Size>,<data Hex>

delay <milliseconds>

wait <ID>,<data size>,<data Hex>[,<timeoutMillisec>]

 

ID and data size can be provided as hex expressions:

send 0x7e5,2,04 01 

or

send 7e5h,0x2,04 01

wait supports string wildcards * and ? for the <data hex> parts. An additional timeout can be specified.

Example:

wait 581h,8,4b 41 60 00 ?? ?4 *,1000

(waits for a status word where the highest four bits are "4". gives up after one second)

 

Extended 29 bit CAN ID support: Use the "ext" specifier before the ID value.

Example:

send ext 432635,8,06 01 00 00 00 00 00 00  

or with the CAN ID in HEX format:

send ext 699FBh,8,06 01 00 00 00 00 00 00  

 

Remote Frames support: Use the "R" specifier before the ID

Example:

send R 701h,1,00 

 

ManSymNote

Notice

The current fullmo USB2Drive firmware for CAN bus does not support extended 29 bit IDs. Remote Frame requests are supported.

The following macros can be used inside the send and wait commands:

canid(<expression>) - calculates the expression and returns a CAN ID in hex format

canunsigned32(<expression>) or caninteger32(<expression>) 

- calculates the expression and returns a 4-byte CAN data block

canunsigned16(<expression>) or caninteger16(<expression>) 

- as above, but 2 byte

canunsigned8(<expression>) or caninteger8(<expression>) 

- as above, but 1 byte

 

Example:

nodeId = 1

velocity = 1000

send canid(0x600 + nodeId),8,23 ff 60 00 canunsigned32(velocity)

 

A simple do...loop syntax can be used for endless loops. Or use do...loop until found in combination with a wait macro.

Example:

do

   do 

      ; request status 

      send canid(0x600 + nodeId),8,40 41 60 00 00 00 00 00

      ; wait for target reached (status word upper four bits = 4)

      ; using 0.5 seconds timeout

      wait canid(0x580 + nodeId),8,4b 41 60 00 ?? ?4 ?? ??,500

   loop until found

 

   ; target has been reached. wait until drive moves again

 

   do 

      send canid(0x600 + nodeId),8,40 41 60 00 00 00 00 00

      wait canid(0x580 + nodeId),8,4b 41 60 00 ?? ?0 ?? ??,500

   loop until found

loop