Avisaro AG - Wiki (en) > Script Manuals > Embedded WLAN > WC1: Wireless CAN bridge

WC1: Wireless CAN bridge

Description

CAN - WLAN

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.

Version history

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
Script
Download Script: WC1.txt (1,3 kB) (right mouse-button and 'save under ..' to download)

Initial Setup

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 Mehr here.

Power Up and Connect to your device as described Mehr here in the User Manual section "First Steps".

To summarize, the default settings of the data and WLAN / TCP interface are:

CAN default settings

Baudrate: 125 kbits/s
CAN ID send: 49 (hex)
CAN ID receive: 49 (hex)

WLAN settings

SSID: avisaro
Channel: 11
Mode: adhoc
Encryption: none

TCP/IP settings for WLAN interface

IP: 192.168.0.74
Subnet: 255.255.255.0
DHCP: off
Login user: admin, pass: 1234

Setup a wireless CAN connection

CAN Bridge WLAN
Script Settings (click to enlarge)

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:

  1. Power on your device.
  2. Connect a PC with your device first and open the WEB-administration-page first. For further explanation to do so please see here
  3. Choose the menu 'CAN' in section 'Interface' and set your interface parameters right and press 'submit'
  4. (if you have a module, select the CAN interface in the menu-section 'generals')
  5. Go to menu 'scripts'. If the right script is loaded you will find a screen as it is shown in the picture to the right.
  6. (if you have a module, load the script first)
  7. Enter your target IP address as 'target UDP-IP'. The IP of the target device must differ from the one you are just setting up by the last two digits.
  8. If necessary change the IP of your device in menu 'wlan'.
  9. Press 'reboot' under menu 'generals'
  10. You are done with this device. Follow the same steps for the second device if you want to connect two devices.

Connect to a Windows PC

  • Set up your PC by using a TCP socket.
  • Use a UDP tool for testing the connection.

Connect to another Avisaro WLAN Device

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.

 

More details

LEDs and Key

LED and KEY

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

Reset to default values

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 Mehr more

CAN Data Format in UDP message

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
Standard message: valid bits 10..0
Extended message: valid bits 28..0

10

15...8

11

23..16

12

31..23

13

7..0

CAN data bytes in the order 1 …8
Valid number of bytes defined by CAN data length

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.