How to Scan velbus

Hello

I am writing an application and I would like to scan the bus to gather all modules that I have on the velbus.

How can I code it?

thks a lot

Valery

The trick is to send a scan packet to all possible addresses and see which addresses respond. Their response contains a byte that indicates the type of module.

The scan packet is always 0F FB ?? 40 ?? 04 where the first ?? is the address of the module and the second ?? is the checksum of the packet. Each module will respond with a module type packet which can vary among modules, but the first bytes are mostly the same. The 6th byte is the module type.

List of module types (hexadecimal)

What each byte is exactly is explained in the Velbus Protocol Summary and in the protocol manual of the corresponding module.

Protocol manuals can be found on the download page of the Velbus website:
velbus.eu/support/downloads/

If you are coding in .NET, check out this post for a communications library:
viewtopic.php?f=26&t=383

If you want to use TCP/IP with the VMB1RS, VMB1USB or VMBRSUSB, check out his post:
https://forumtest.velbus.eu/t/k8056-pulse-mode-fails-k8056-rx433-k8058/133/1

Hello,

So if I well understood I have to loop on all the existing address 0x00 -> 0xFF and wait for their responses (checking the type of modules)

I don’t use the .net or tcp/ip implementation but the last one developped by a guy of this forum : jvelbus (java implementation)

thks

Valery

Does anyone have a .net code sample for scanning synchronously the modules?

But communication is asynchronous by nature, any packet can be received at any time, and there is no guarantee that one packet will have one response nor is there a guarantee about the order in which packets will be received

Does it mean that the scan progressbar in VelbusLink is simply based on a timer ?

If so, what is a reasonable time to wait for a full scan

Make sure you use a 60ms delay between each packet, otherwise you’ll flood the buffer on the USB/Serial interface.
After the last packet is sent I wouldn’t wait more than a few seconds, by then the module with the last address scanned will have sent an answer.

All this assuming your scanning directly to the bus, not via sockets.

And as VEL448 said, don’t ever assume that your modules will answer in any specific order!

It is not based on a timer. VelbusLink uses a sending queue which makes sure there is a 60ms delay between each outgoing packet. Each time that queue sends a scan packet, the progress bar is updated with the address of that packet. When the last scan packet has been sent, the dialog closes.

So it doesn’t wait for a response, because it is not really necessary. If a module type packet is received when the scan dialog is already closed, the module is simply added to the project (if it was not present already). The scan dialog is merely a ‘Please wait while we scan’ dialog.

This all achieved through multithreading (main thread, sending thread, receiving thread).