Categories
Categories
VSCP daemon moved

The VSCP daemon now is in it’s of repository https://github.com/grodansparadis/vscp-daemon . The VSCP repository will be streamlined to hold common code that will server other parts and also keep general discussions and wiki.
Categories
Changes to vscp.h

The structures in vscp.h for events now is typedefed as vscp_event_t and vscp_event_ex_t. The old vscpEvent and vscpEventEx is still available for backward compatibility.
Also
vscpEventFilter has change to vscp_event_filter_t
VSCPStatistics to vscp_statistics_t
and
VSCPStatus to vscp_status_t
Old typedefs are still available for compatibility with legacy code.
MeshCore or Meshtastic
Source: MeshCore or Meshtastic: Which one is better? – Latest News from Seeed Studio

Categories
nano second timestamp

The 64-bit nano second timestamp is now introduced for VSCP. This is what we often call a Unix timestamp with nano second resolution and which holds the number of nanoseconds since the epoch (January 1, 1970, 00:00:00 UTC).
The “old” format with separate bytes for year, month, day, hour, minute, second and a 32-bit microsecond timestamp was constructed that way to make it easy for very low-end devices to receive/send time information. This is still possible as the format is preserved. But the new format will be promoted.
Note that it is still possible to send a microsecond timestamp for devices that rely on it. Just multiply the value with 1000 and set it to timestamp_ns. Relative timestamps can easily still be used.
Two header bits 9/8 specify the frame format. They were originally set to 0b00 and would with the new format be set to 0b01. So when a new event is constructed they shoudl be set. The define VSCP_HEADER16_FRAME_VERSION_UNIX_NS in vscp.h does that. Priority is probably also bits that should be altered usually to VSCP_PRIORITY_NORMAL
Helpers to convert between the two formats are available in the helper library and in vscphelper.cpp and vscp-firmware-helper.c. They are
int64_t
vscp_fwhlp_to_unix_ns(int year, int month, int day, int hour, int minute, int second, uint32_t microsecond);
and
void
vscp_fwhlp_from_unix_ns(int64_t unix_ns,
int *year,
int *month,
int *day,
int *hour,
int *minute,
int *second,
uint32_t *microsecond);
year and month is still available in the event defines also if nanosecond timestamps are used. This to preserve the size of frames. It is recommended to set year=0xffff and month=0xff when the new timestamp is used. Still the frame versin bits in the header is the main detection to use for frame type.
Categories
The VSCP general binary frame (gbf)

Binary frames have been around for a long time now. MQTT, UDP and Multicast transport uses them. In the current project I work with, a CAN4VSCP <-> wireless gateway I have finally realized that TLS/SSL is not the perfect solution for an embedded server device. The reason is that certificates need to be updated on a regular basis. This is easy to handle on a pc based higher end solution but very much not so on a remote device. So what to do?
My solution to this problem is to generalize the binary protocol and use it also (as an option) in websockets and tcp/ip. This gives a communication path that allows for secure AES-128/192/256 encryption on all transports supported by VSCP.
With the addition/change of the nanosecond timestamp the frame format is changed to support this. The old frame is still available though. But all conversions in the helper libraries. will convert the format to the newer frame type.
There is also two new packet types (defined in the high nibble of the first byte of the frames).
The first is command frames which have a 16-bit command code and an argument. Looking at the tcp/ip link protocol and the web socket protocols the commands used in both is translated here to a binary form.
The second is reply frames which are designed for command replies to a client. Error codes and state information can be sent here.
Frame format and packet types is a bit confusing.
Packet type 0: Can have frame types 0/1. The frame type is defined in bit 8/9 of the VSCP event head. All frames will be promoted to frame type 1 with nan second timestamp.
Packet type 14: This is the command packet. Just one frame type.
Packet type 15: This is the reply packet. Just one frame type.
The helper library, vscphelper.cpp and vscp-firmware-helper.c will all support the binary protocol. So in reality it is not more work to use than to decide on encryption, share a secret key between devices and send/receive events (and commands) as before.
You can read more about the binary frames in the documentation. Some things may still change.
ps I try not to break things if possible but have done so in the vscp header (vscp.h) by removing the multicast defines and renames them to “binary”… Some applications may thus need to be recompiled after fixing the naming. Sorry for that, but this as a good time for doing this. ds
Categories
State of VSCP
I am currently working on a CAN4VSCP gateway based on ESP32C3. It supports TCP/UDP/Multicast/WebSockets and MQTT. I will do some other modules also with this chip and with other chips. Some “blink examples” are needed for example.
Some changes have been checked in to the spec. today.
nano second timestamp
First some changes will be implemented everywhere when a nanosecond timestamp is introduced. This nanosecond timestamp is 64 bit Unix timestamp holding nanoseconds since the epoch (GMT).
The VSCP main header (vscp.h) already has the change. Both formats can be used. Set year = 0xfff and header bits 8/9 to 1 when using the new timestamp.
The string format will change from
head,class,type,obid,datetime,timestamp,GUID,data1,data2,data3....
to
head,class,type,obid,,timestamp,GUID,data1,data2,data3....
The nill datetime was previously used to set the current date in the receiving interface. The same can be now be achieved by either setting the timestamp to zero or setting it to a number less than a second.
GUID format
The format for the GUID can now be more freely expressed and the standard format for UUID’s and short types are possible. Info is here.
Binary format
A binary encrypted format has been available for a long time in the UDP and Multicast etc frames. Working with the gateway I realized that this is generally useful. So I decided to make it a bit more general as described here. Again there is a change to account for the new timestamp.
Wanting to secure an embedded device that have server capabilities TLS/SSL is the first choice. But soon you realize that certificates last maybe just for 90-days, and you have to create mechanism to handle this. It becomes very messy, and the risk is that the user will brick a lot of remote devices if something fails.
An encrypted solution would be nicer to handle and still be secure. This will be the solution for VSCP and luckily it is in place already for UDP and Multicast and works very well.
So this will be added to the WebSockets, TCP/IP link protocol and MQTT protocols as binary alternatives. MQTT and WebSockets already have TLS as an option and my plan was to add TLS to the TCP/IP link protocol as well. But now I am not sure. Will any way add the binary version first.
/Ake
Categories
VSCP4CANToolBox
Michal Protasowicki made a very nice toolbox that simplifies work with VSCP over CAN. You find more information about it and download it here https://github.com/michpro/VSCP4CANToolBox
Categories
Socketcan bus error simulations

Found a great tool for CAN error simulation if working on socketcan based systems. Check this if you are into this. Really helpful.
Categories
Happy new year
May 2026 be a year of peace for everyone.
