LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET Callbacks with flash programming tool

Hi

 

I'm writing VIs to implement flash programming functionality for NXP processors using Flash Magic 7.62.

 

My problems arise when I would like to use the Progress Functions as described in the manufacturers documentation. It looks like I could use the procedure described here, but I cannot get it to work. The menu entry "Create Callback VI" is always greyed out.

 

Register Callback VIs for .NET Events in LabVIEW

 

Any ideas how I proceed? I have never programmed .NET

 

(I'm not able to provide .NET assemblies due to license issues.)

 

 

Anything which can point me in the right direction is greatly appreciated.

 

 

From the .NET assembly documentation:

Untitled.png

 

Code currently used to implement verify functionality. Still need to implement check if verify passed (hence Result = False):

 

Screenshot 2014-05-13 11.10.00.png

0 Kudos
Message 1 of 14
(4,868 Views)

Hi Teknik Kim

 

So I read your quesion as this:

 

You need to catch a .NET event (to update the status while erasing is going on). How do I do this.

 

So first you need to have the .NET reference (you already have that in your program as Flash Magic Reference In).

 

Next step is to configure what to do when an event occurs. It is important that you configure this before you call the Verify Function because that function will stall LabVIEW until it is finished. (Which is why we need event to get the status). So before the Invoke node you put in a Register Event Callback node 

 

It is important that you wire the Flash Magic reference to the event source (number 3 from the buttom) - Note don't wire it to the reference in. Next step you left click on the Event Source to the right of where you wired in your reference. This will give you a drop down of all the events available in you DLL. Here you browse to the ProgressHandler.

 

After this you will be able to Right-Click and select Create Callback VI. In the callback VI you can access the status, value and other options.

 

Normally you would need that Register for event Callback node to actually do something for you in your main app, so it is fairly normal that you wire in a control refernece (i.e. to a progress bar) or a queue reference into the User Parameter input. Please note that the connector pane in the callback VI needs to match up with the user parameter. Normally it is the easiest to configure the user parameters and then create the callback VI, or recreate the callback VI if you change the User Parameter and then just copy your code.

 

 

Let me know how this works for you.

 

 

 

Best Regards

Anders Rohde

Applications Engineer

National Instruments Denmark 

0 Kudos
Message 2 of 14
(4,827 Views)

Hello,

 

I have already faced similar problem. Writing a wrapper dLL for the original flash programming tool DLL helps solving this Callback problems. In this way one can show the progress in LabVIEW.

0 Kudos
Message 3 of 14
(4,821 Views)

Hi Anders

 

Thank you for your quick reply.

 

I have tried the method you've outlined, but I get stuck when I'm supposed to choose the event - the list is simply empty(?).

 

I have also tried to create a new invoke node directly to flash magic, but the result is the same.

 

dd.png

 

 

No matter which object I choose in the .NET assembly I cannot locate any events(?).

 

0 Kudos
Message 4 of 14
(4,817 Views)

Hej Kim

 

Thanks for your reply. I didn't test this since I didn't have the DLL's. 

 

Seems like the event might be on another class than the Flash Magic. I believe they might be on the Progress Handler Class. 

 

In the screenshot you can see you just have a blank constant for the progress .NET object and the same with the CallbackParam. 

 

I got the DLL now. Let me try to see if I can figure out how this works then.

 

/ Anders

0 Kudos
Message 5 of 14
(4,802 Views)

Hi Kim

 

I looked into the specifications and the API doesn't support you to call a LabVIEW function for handeling the Progress. 

 

The PRogress takes an input of the type FlashMagic+ProgressFunc, you can crete this as a new constructor. 

 

.NET.PNG

 

Problem is that the FlasMaghic+PROGRESSFUNC takes a pointer to a .NET method as an input. We can't really use a LabVIEW funtion here. 

 

Same goes on for the CallbackParam because that input is actually linked to the ProgressHandler. From the specifications:

 

"Every function that accepts a progress delegate also has a parameter called
"CallbackParam" with the object type. This is an arbitrary object that can be passed to the
Flash Magic function and then returned to the progress callback function."

 

So your are basically facing the issue that the .NET API functions have a high coupling. A high coupling is generally not good because we need LabVIEW to be the glue between the functions and here we can face issues in some circuimstances.

 

/ Anders

0 Kudos
Message 6 of 14
(4,792 Views)

Hi Anders

 

I will talk to the people that programmed the assembly.

 

What should I ask them to change, specifically?

 

-Kim

0 Kudos
Message 7 of 14
(4,789 Views)

I would tell them that you cannot use function pointers from LabVIEW and ask them to make a .NET event that you can catch for the ProcessStatus instead. Then you can use the method we have talked about previously. 

 

Alternatively they can expose some ,NET properties that you can access from a property node if you only real purpose is to see if it passed or failed the verification. 

 

/ Anders

 

 

0 Kudos
Message 8 of 14
(4,782 Views)

Hi Anders

 

I will ask them right away.

 

I would like a progress bar and the ability to read the status of the completed operation.

 

They claim to have excellent support, I think I'll put it to the test.

 

Thank you for your help. I'll post an update when I hear from Flash magic support.

 

-Kim

0 Kudos
Message 9 of 14
(4,778 Views)

Hi

 

Unfortunately I have no experience writing DLLs 😞

 

0 Kudos
Message 10 of 14
(4,777 Views)