This script creates a wireless CAN bus. It collects data from one CAN bus and broadcasts those using UDP datagrams. Other Avisaro CAN-WLAN modules or other WLAN clients such as a regular PC receives those messages and writes them to their CAN bus.
| Script name: | wc1.txt |
| Current version: | v 1.7 , dated from 06.10.2008 |
| Firmware: | v3.36 or higher required |
| Hardware: | Logger wlan cube or logger wlan module |
| History: | v1.7: More than one CAN message in one UDP paket v1.4: LEDs indicate traffic, more speed v1.0: Initial release |
If purchased a "Box" or "Cube" product, the application script is usually preloaded. If not, or the script should be changed or updated, load the script as described
here.
Power Up and Connect to your device as described
here in the User Manual section "First Steps".
To summarize, the default settings of the data and WLAN / TCP interface are:
Baudrate: 125 kbits/s
CAN ID send: 49 (hex)
CAN ID receive: 49 (hex)
For this application, the UDP message format is used. This allows to set up wireless Bus Architectures when using broadcast addresses.
For setting up your device you have to do the following:
Follow the steps mentioned above for the second device. Make sure that the IP Addresses in the target UDP field fit to each other. Alternatively you can use UDP broadcast messages to send the massage to all IP's in this WLAN area.
Key:
Is used to stop a TCP connection.
Green LED:
Indicates power up. Flashing: Waiting for TCP connection to be established
Red LED:
Indicates a successfull established TCP connection
If the module is configured in such a way that it can not be reached via web site or via RS232 connection, there is a back-door:
Power down the module. Press the push button and hold it pressed. Power up the module. Both LEDs will flicker for about 2 minutes and than light up solid. The module is set to above stated default values. Release the button and power down / up the module. If the module with no push button is used, the IO-pin tied to ground can be used.
There is a second way to recover a module
more
CAN messages are packed into a 28 Bytes format. Message ID and Frame descriptor are presented in 'little endian' format (the most significant Byte last position). CAN Data are presented as in the message itself. A TCP/UDP packet is filled with one 28 Byte block.
|
Byte |
Bits |
Description |
|
1 |
7..0 |
User definable header bytes. Usually all '0'. |
|
2 |
15...8 |
|
|
3 |
23..16 |
|
|
4 |
31..23 |
|
|
5 |
7..0 |
Frame descriptor: reserved bits, all '0' |
|
6 |
7..0 |
Frame descriptor: reserved bits, all '0' |
|
7 |
7..4 |
Frame descriptor: CAN data length |
|
|
3..0 |
Frame descriptor: reserved bits |
|
8 |
7 |
Frame descriptor: Frame type (0 = standard, 1 = extended) |
|
|
6 |
Frame descriptor: RTR bit ('1' = RTR bit is set) |
|
|
5..0 |
Frame descriptor: reserved bits |
|
9 |
7…0 |
Message ID |
|
10 |
15...8 |
|
|
11 |
23..16 |
|
|
12 |
31..23 |
|
|
13 |
7..0 |
CAN data bytes in the order 1 …8 |
|
14 |
7..0 |
|
|
15 |
7..0 |
|
|
16 |
7..0 |
|
|
17 |
7..0 |
|
|
18 |
7..0 |
|
|
19 |
7..0 |
|
|
20 |
7..0 |
|
|
21 |
7…0 |
Real time clock time stamp in seconds since 01.01.2007 |
|
22 |
15...8 |
|
|
23 |
23..16 |
|
|
24 |
31..23 |
|
|
25 |
7…0 |
Millisecond time stamp. Value in ms since module power on. |
|
26 |
15...8 |
|
|
27 |
23..16 |
|
|
28 |
31..23 |
Several CAN messages are packaged into one UDP message for speed purpose. This can be changed by modifying the script: search for 'DIM C(1400)'. Change this to DIM C(28). This will cause the temporary buffer to hold only one CAN message instead of a maximum of 50.