Windows 10 Visual Studio SDK problem

rhulme77
rhulme77 New Member Posts: 10

Hi,
I am trying to make headway with the SDK samples.
The precompiled sample works just fine and does what I would expect it to do.
However, when trying to run the app through debug i get a PInvokeStackImbalance.

The error occurs on all commands that require information to be passed to or from the IO Pins.
has anyone come across this issue before?

Comments

  • rhulme77
    rhulme77 New Member Posts: 10

    To go into a little more detail.
    AAEON Framework Driver V 18.1.11.0
    Hi-Safe is installed Version 2.2018.01.11

    Under Vb.net have tried

    Declare Function EApiPwmSetValue Lib "aaeonEAPI.dll" (byval device as uint32, byval baseUnitInt as UInt32, byval baseUnitFrac as UInt32, ByVal BaseDutyCycle as UInt32) as Integer

    Declare Function EApiPwmSetValue Lib "aaeonEAPI.dll" (byval device as uint32, byval baseUnitInt as UInt32, byval baseUnitFrac as UInt32, ByVal BaseDutyCycle as UInt32) as Uint32

    Declare Function EApiPwmSetValue Lib "aaeonEAPI.dll" (<In, MarshalAs(UnmanagedType.U4)> byval device as uint32,
    <Out, MarshalAs(UnmanagedType.U4)> byval baseUnitInt as UInt32,
    <Out, MarshalAs(UnmanagedType.U4)> byval baseUnitFrac as UInt32,
    <Out, MarshalAs(UnmanagedType.U4)> ByVal BaseDutyCycle as UInt32) as Integer

    The error is the same on each variant, with the the PInvoke function unbalancing the stack, stating that the the PInvoke signature does not match the the unmanaged target signature. But in the Header file it states:

    EApiPwmSetValue(
    __IN EApiId_t Id, /* PWM Id /
    __IN uint32_t PWMBaseUnitInt, /
    PWM Base Unit Integer /
    __IN uint32_t PWMBaseUnitFrac, /
    PWM Base Unit Integer /
    __IN uint32_t PWMDutyCycle /
    PWM Base Unit Integer */

    So the command is expecting UInt32 on each of the four variables, so this should in theory work.

    Any clues or suggestions would be great.

    Thanks

  • rhulme77
    rhulme77 New Member Posts: 10

    I'm starting to wonder if any technical support exists..............

  • rhulme77
    rhulme77 New Member Posts: 10

    OK I have an answer to the solution:

    <DllImport("aaeonEAPI.dll", EntryPoint:="EApiPwmSetValue", CallingConvention:=CallingConvention.Cdecl)>
    Public Shared Function EApiPwmSetValue(ByVal device As UInt32, baseint As UInt32, basefrac As UInt32, duty As UInt32) As UInt32
    End Function
    

    This method of calling the DLL works and the IO functions.

    However, with the Digital I/O it takes 159ms to set a pin high or low, which seems excessive.