This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP GANG DLL - Help is needed urgently

Hi,

What we needed: to develop our test program in Visual Basic using MSP-Gang.dll for MSP GANG Programmer.

What we found in our Visual Basic program:

1. Some functions work as expected, for example, after executing function MSPGANG_InitCom, the correct com port is initialised correctly.

2. Some functions do not work as expected, for example, after executing function MSPGANG_Default_Config, and use function MSPGANG_GetConfig to check index of CFG_TARGET_EN_INDEX (value is = 10), and data stored is 255, which is correct as stated in TI document.

Then, if we call function MSPGANG_SetConfig(10,1), and then use function MSPGANG_GetConfig to check index of CFG_TARGET_EN_INDEX, we found that instead of having data of 1, the data changed to a very big number, like 1636112, which doesn't make any sense to us.

What we believe is that similar to other DLLs, the MSP-Gang.dll should be able to call by any program easily. Can anyone help on this? We need to get it solve urgently.

Thank you.

  • We who watch this forum have no expertise with MSPGANG.  I have let the MSP430 experts know about this thread.

    Thanks and regards,

    -George

  • Hi Quote,

    Above two articles were posted by me when I was trying to understand how MSP-GANG DLL works, anyway, we still have problem to use the MS-GANG DLL in our VB6 test application. Can TI Team elaborate the issue and get back to us soon as possible? Thank you.

    Regards,

    Lisa 

  • Hi Lisa,

    I'm going to move this to the MSP430 forum.

    There should theoretically be no issue using VB6 with the MSP-GANG.dll, but we do not provide any example for it and it has not been tested with VB6 (so you use at your own risk). We only provide C and C++ examples of using the MSP-GANG.dll. Unfortunately there are so many different options that different customers may choose to use (some even use Labview) that we can only provide examples for some of them, and we've chosen and tested with the most popular options which are C and C++. We don't provide any examples or support for other platforms because there are simply too many different options that one could use for this to be feasible to write and test - when you use these other unsupported options you are unfortunately somewhat on your own when it comes to the mechanics of the particular programming language that you've chosen. If you want to continue down your current path I would strongly recommend that you seek help in a VB support forum about your issue as it is really a VB6 + C++ DLL usage issue rather than an issue with the MSP-GANG.

    Rosty's answer from the earlier thread is 100% the authoritative answer here: http://e2e.ti.com/support/development_tools/compiler/f/343/p/294298/1038671.aspx#1038671

    If you want an example of using a GANG programmer DLL with VB6 and don't want to try to make your own way from scratch or seek help from some Visual Basic experts, there already is an example for the old MSP-GANG430 and its DLL - VB6 was a more popular option way back when the MSP-GANG430 was released so there is an example for it included in the software download for the old tool. http://www.ti.com/tool/msp-gang430

    You would take that example project and then change it to use the wrapper DLL included in the new MSP-GANG software (under C:\Program Files (x86)\Texas Instruments\MSP-GANG\API-DLL Gang430 Wrapper)

    This wrapper DLL allows you to use the old GANG430.DLL with the new MSP-GANG hardware, so you would with a little effort be able to use the old VB6 example project that was built for the MSP-GANG430 tool, and use the software instead with the new MSP-GANG hardware. I hope that this helps to get you up and running.

    Regards,

    Katie

  • Hi Katie,

    What we found is MSPGANG_SetConfig did not work as expected, the other functions are working, if TI can fix this, our problem will be gone.

    Regards,

    Lisa

  • Hi Lisa,

    I tested both the MSPGANG_SetConfig and MSPGANG_GetConfig commands in our C example DLL project with the latest MSP-GANG software (v1.1.5.0) and I cannot reproduce your error, therefore I don't think there is anything wrong with the MSP-GANG.dll and the error must instead be the handling in your VB6 code. However, as I mentioned before, this is untested/unsupported with VB6 so you use it at your own risk.

    Are you sure the issue might not be the handling in VB6 of the value returned by MSPGANG_GetConfig, a types issue perhaps? It may be that the SetConfig correctly sets the value but that when you get the result there is an error interpreting the number that was returned. Since I cannot reproduce the issue I really don't think it is a problem with the DLL itself, but could be some VB6 conflict with the types of parameters passed back and forth and their handling. If I were you, I think you should show your lines of code concerning SetConfig/GetConfig to someone more familiar with using VB6 with DLLs built from C++, and also show them for comparison the same lines of code for SetConfig/GetConfig from the C/C++ examples we provide, to see if there might be something being handled incorrectly in your code. But I cannot really help with that myself as I am not familiar with VB6 and this is not really a supported platform for the MSP-GANG.dll.

    Regards,

    Katie

    Regards,

    Katie

  • hi Katie,

    Thanks for putting time to help us. Yes, the sample C++ code is working, but it doesn't mean it will work on VB (doesn't matter VB.net or VB6).

    1. Long time ago, we had created our test jig application in VB6 using prgs430.dll to control the MSP430-PRGS430 programming adapter, and the application is using till now.

    2. In doc SLAU358D page 65, it says MSP-GANG.lib is required, but there is no way to link the lib file in VB, not sure if  that is the reason why the set config doesn't work in visual basic.

    3.  When I look back the sample code for GANG430, the C++ code uses GANG430.lib, and the VB.net sample doesn't use it, and doc SLAU101Q doesn't specify that  GANG430.lib is required.

    4. As Texus is a worldwide leading company with high reputation, should the product it produced easy to use and implement?

    Thank you.

    Regards,

    Lisa

     

  • Hi Lisa,

    Lisa Qian said:
    4. As Texus is a worldwide leading company with high reputation, should the product it produced easy to use and implement?

    We try to make our tools as easy to use as possible for most customers, but even as a large company we have limited time and resources. We chose to make examples and test for C/C++ with the MSP-GANG as these are accessible to almost all customers, but unfortunately with our constraints it is simply unfeasible to create an example or support every different possible programming environment that someone might use. In general most people I've encountered have been satisfied with the C/C++ examples we provide, but I'm sorry that in your particular case your environment is something we don't support.

    I still strongly recommend that you should try the Gang430.dll Wrapper, incorporating it into the old Gang430 VB example code that I mentioned above. This is more likely to work as the Gang430.dll was tested with VB and had VB support. As you can see in section 4.1 on p. 65 of the user's guide, no .lib is required to use the wrapper DLL - you simply need to add these three files in the same directory as the application code for the old Gang430 (you can get the old code from the page here www.ti.com/tool/msp-gang430):

    1. Gang430.dll (make sure to use the Gang430.dll from the new MSP-GANG projects, not the version from the original Gang430 VB example)
    2. Gang430.ini
    3. MSP-GANG.dll

    I'm sorry that we don't support using the MSP-GANG.dll with VB6 - you can keep trying to get it to work, but it's simply something we don't support and I can't really help you with. Since the old MSP-GANG430 did have VB support though, I strongly recommend that you try the wrapper DLL as I've mentioned above and Rosty mentioned months ago in the other thread. I know this may not be the answer you want to hear, but unfortunately it's really the only answer I can give right now. I hope that the wrapper DLL works for you.

    Regards,

    Katie

  • Please also note there is another option available:

    If you don't need all of the control of the DLL, you could just write software to control the MSP-GANG over the USB/serial port. This might not be very hard, especially if you just need to be able to program the parts and then monitor whether there were any programming errors, and could use existing images already stored in the MSP-GANG image memory. Please see this other post for details on a setup like that: http://e2e.ti.com/support/microcontrollers/msp430/f/166/p/319595/1112314.aspx#1112314

    -Katie

  • Hi Katie,

    I tried to wrap the DLL today, but kept getting error message of type mismatching. here is what I did:

    1. Download and install GANG430, and get the sample code in VB.net
    2. Copy GANG430.dll in C:\Program Files (x86)\Texas Instruments\MSP-GANG\Examples\Wrapper\Output\(I'm using 64 bit windows 7) to the application folder, here is the GANG430.dll property:
    3. Copy file MSP-Gang.dll and MSP-Gang.dll to the same folder
    4. Run the VB.net code and got error message.

    Did I  misunderstand or miss anything? What we need to do is program, verify, and secured the board, then test board to see if it meets our spec.

    Thank you.

     

    Regards,

    Lisa

     

  • Hi Lisa,

    Did you also have GANG430.ini in the directory? Note that I think that all of these should be in the same directory as the .exe that is the output generated by your project. So the directory where the .exe is should have GANG430.ini, GANG430.dll (from the new MSP-GANG project like you showed above), and MSP-GANG.dll. You should also have the GANG430.h file (you might want to use the one from the new MSP-GANG wrapper example as well).

    -Katie

  • Hi Katie,

    Here is the sample VB.net project, changes made are adding fours files in sub folder Bin:

    • Gang430.dll
    • MSP-Gang.dll
    • GANG430.ini
    • GANG430.h (I don't think we need this header file for VB project, as an definition file is created for VB program, anyway, I added it in as your suggestion)

    4456.VB_NET.zip

    And I got error to initialise the Comm port. Here is the error message:

    System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
       at Project1.Modul2.InitCom(String& lpszComPort, Int32 IBaudRate)
       at Project1.Modul2.InitGANG() in D:\Lisa Projects\Hawk\Lisa Software\Texus Intruments\GANG430 TI\GANG430 DLL_usage_Examples\VB_NET\Gang430.vb:line 80
       at Project1.Modul2.Gang430_demo() in D:\Lisa Projects\Hawk\Lisa Software\Texus Intruments\GANG430 TI\GANG430 DLL_usage_Examples\VB_NET\Gang430.vb:line 65
       at Project1.frmGANGInterface.test1() in D:\Lisa Projects\Hawk\Lisa Software\Texus Intruments\GANG430 TI\GANG430 DLL_usage_Examples\VB_NET\GANG_Interface.vb:line 454
       at Project1.frmGANGInterface.frmGANGInterface_Load(Object eventSender, EventArgs eventArgs) in D:\Lisa Projects\Hawk\Lisa Software\Texus Intruments\GANG430 TI\GANG430 DLL_usage_Examples\VB_NET\GANG_Interface.vb:line 419
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    Can you help?

    Thank you.

     

    Regards,

    Lisa

     

     

  • Hi Lisa,

    I don't know that this is the best place for advice on using a C/C++ DLL with VB. But I see with a quick google search that the MSDN forums seem to be pretty helpful with this VB.net error message: http://social.msdn.microsoft.com/Forums/vstudio/en-US/f07427cd-a3be-42cb-bd04-3722402b9778/badimageformatexception-when-importing-c-dll-in-vb?forum=vbgeneral

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/6eeb2917-856a-4e65-98f2-a6f2d9315b3f/badimageformatexception-when-importing-c-dll-in-vb?forum=vcgeneral

    You may want to try posting your issue there. You may want to try posting your original issue there as well (when using MSP-GANG.dll) to see if they might spot a VB related issue there as well.

    Best of luck,

    Katie 

**Attention** This is a public forum