10-12-2023 04:29 AM - edited 10-12-2023 04:30 AM
Hello, i want to control vFlash with LabVIEW.
Vector provide a API to control it but it is not implemented to using it with LabVIEW. I have wrote a Library to call the API to Flash my ECU. Hovewer by step LoadFlash LabVIEW complete Freeze and i must shut it down with the Task Manager.
Here is my LabVIEW code and DLL Library Code:
using System;
using Vector.vFlash.Automation;
namespace vFlash
{
public class ECU : IDisposable
{
private long projectHandle; // Define a private backing field.
public string ECUname { get; private set; }
public string ProjectPath { get; private set; }
public long ProjectHandle { get; set; }
public uint ChannelID { get; private set; }
public uint PercentProgress { get; private set; }
public uint TimeRemaining { get; private set; }
public VFlashStationStatus Status { get; private set; }
public VFlashStationResult Result { get; private set; }
public ECU(string Name, string projectPath, uint channelID)
{
ECUname = Name;
ProjectPath = projectPath;
ChannelID = channelID;
TimeRemaining = 0;
PercentProgress = 0;
}
public VFlashStationResult Initialize()
{
VFlashStationResult initializeResult = VFlashStationAPI.Initialize();
return initializeResult;
}
public VFlashStationResult LoadFlash()
{
long projectHandle = ProjectHandle;
VFlashStationResult loadFlashResult = VFlashStationAPI.LoadProjectForChannel(ProjectPath, ChannelID, out projectHandle);
ProjectHandle = projectHandle;
return loadFlashResult;
}
public VFlashStationResult StartFlash()
{
VFlashStationResult startResult = VFlashStationAPI.Start(ProjectHandle, progressCallback, statusCallback);
return startResult;
}
private void progressCallback(long ProjectHandle, uint progressInPercent, uint remainingTimeInSeconds)
{
PercentProgress = progressInPercent;
TimeRemaining = remainingTimeInSeconds;
}
private void statusCallback(long ProjectHandle, VFlashStationStatus flashStatus)
{
Status = flashStatus;
}
public VFlashStationResult Deinitialize()
{
VFlashStationResult deinitializeResult = VFlashStationAPI.Deinitialize();
return deinitializeResult;
}
public VFlashStationResult UnloadProject()
{
VFlashStationResult unloadResult = VFlashStationAPI.UnloadProject(ProjectHandle);
return unloadResult;
}
public void Dispose()
{
GC.SuppressFinalize(this);
}
// Finalizer (destructor)
~ECU()
{
// The finalizer should only be used if the Dispose method is not called.
// In this case, it is responsible for releasing any unmanaged resources.
Dispose();
}
}
}
And my LabVIEW Code:
Can you give me a advice how to solve this?
Thank You
11-13-2023 02:46 AM
I have do some work and write a vFlash VIs, i became no error but still dont work. I have attached all my vFlash VIs.
Can you help me where I have an Error?
01-16-2025 08:25 AM
Hi,
Did you find a solution to use vFlash with LabVIEW.
We actual locking for a solution to flash the ecu in the production.
It is not possible with die Automotive diagnostic tool kit because of the Security Manager ZenZefi.
Thanks
01-17-2025 03:00 PM
I've never had luck calling vFlash to do work. There are so many hoops to jump through and we know the process of flashing fairly well. For this reason I usually just call the UDS functions themselves for downloading to the ECU. I recommend looking at NI's ADCS toolkit. I know you mentioned issues with security, and if that continues to be an issue you can look at my G implementation of the same functions over on CAN Blog Part 8 here. The source is older, and not currently setup for NI hardware. But you can see the state machine that takes place, and it is possible you could replace the CAN read and write frame functions with the NI equivalent ones to get somewhere.
If you do go the vFlash route, please come back here after and give an update on what you did to get it working so others can better understand it too.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-20-2025 03:23 AM
Hi,
I use the ADCS toolkit in other projects. But in this project it is necessary to authenticate the user other the Daimler ZenZefi application. It is possible to encrypt the CAN UDS messages and get access over the Key and Seed to the ECU.
I now your blog. Great content. Thanks
01-21-2025 11:33 AM
@bodo_online wrote:
But in this project it is necessary to authenticate the user other the Daimler ZenZefi application. It is possible to encrypt the CAN UDS messages and get access over the Key and Seed to the ECU.
I do not know the specifics of your application or the authentication you are using. After requesting the seed, go through whatever steps are needed to get the key, then send it back. At one point I was working on an update over the air solution which required calling into an OEM's server over the internet and authenticate it, to get the key. This process is different from calling a DLL but again the UDS side doesn't really care how you got the key from a seed, only that it matches what they expect. The engineering team responsible for authentication should have documentation on how to properly unlock the device for your flash.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord