Jump to content
  • 0

dpcutil.dll DpcOpenData fail 3103 error


oscargomezf

Question

Hi,

 

I am trying to use the dpcutil.dll library with Visual .Net [C#]. I've managed to import the functions what I need to write and read registers in my BASYS2 EVB [250].

const string _dllLocation = "C:WindowsSystem32dpcutil.dll";
[DllImport(_dllLocation, CallingConvention = CallingConvention.Cdecl)]
private static extern bool DpcInit(ref int perc);
[DllImport(_dllLocation, CallingConvention = CallingConvention.Cdecl)]
private static extern void DpcTerm();
[DllImport(_dllLocation, CallingConvention = CallingConvention.Cdecl)]
private static extern bool DpcGetDpcVersion(StringBuilder szVersion, ref int perc);
[DllImport(_dllLocation, CallingConvention = CallingConvention.Cdecl)]
private static extern bool DpcOpenData(IntPtr phif, System.Text.StringBuilder szdvc, ref int perc, IntPtr ptrid);
[DllImport(_dllLocation, CallingConvention = CallingConvention.Cdecl)]
private static extern bool DpcCloseData(IntPtr hif, ref int perc);
[DllImport(_dllLocation, CallingConvention = CallingConvention.Cdecl)]
private static extern bool DpcPutReg(IntPtr hif, byte bAddr, byte bData, ref int perc, IntPtr ptrid);
[DllImport(_dllLocation, CallingConvention = CallingConvention.Cdecl)]
private static extern bool DpcGetReg(IntPtr hif, byte bAddr, ref byte pbData, ref int perc, IntPtr ptrid);

I know that I am using correctly the dll because I get the dll version from the function DpcGetDpcVersion(). My problem is when I try to use the funciton DpcOpenData. I got the error number 3103. I've read in the  Digilent Port Communications Programmers Reference Manual that:

 

ercCantConnect: 3103. Description: Can’t connect to communication module.

 

First of all  I've recored the rom flash of the BASYS2 with the reference design: https://www.inf.pucrs.br/calazans/undergrad/laborg/mat_plataformas/Nexys2/dpimref.vhd

 

In my DEV Visual .Net Application [C#]. I've been using the following steps:

 

1º.- DpcInit(ref theErc) -> theErc = 0

 

2º.- DpcGetDpcVersion(theVersion, ref theErc)  -> theErc = 0 and theVersion =2.9.2

 

3º-. devCount = getDevCount() -> devCount = 2

 

4º.- for i= 0 to i < devCount => getDevName(i, devTemp); devTemp -> Basis2 AND devTemp -> Basis2_bis

 

5º.- DpcOpenData(hif, theDevice, ref theErc, ptrid) -> theErc = 3103

 

I am stacked in this step. Could you help me out how I can solve this problem?

 

 

Thank you so much. Best regards.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

I've solved the problem. I've been managing the function so:

private static extern bool DpcOpenData(IntPtr phif, string szdvc, ref int perc, IntPtr ptrid);

Instead of:

private static extern bool DpcOpenData(ref IntPtr phif, System.Text.StringBuilder szdvc, ref int perc, IntPtr ptrid);

The problem is solved and works fine.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...