Hello,
I am doing my MSc project and I am having a problem driving my CAN bus using C#.
I am using this ARM based HMI and the supported BSP source files for Windows CE 6.0 coming from the manufacturer's webpage:
http://www.technexion.com/index.php/products/hmi/th-0735w[
^]
There is a CAN bus example written in C++ which I have successfully tested. I have designed my application using C# and I want to include CAN bus in my application. I don't know how to link C# with CAN bus drivers. I have several .dll files and I think the omap_can.dll is the one associated with the CAN bus drivers.
I am referring to this manual (CAN Driver section) for invoking the CAN driver because TechNexion does not provide any documentation:
http://processors.wiki.ti.com/index.php/WinCE-BSP_ARM-A8_User_Guide#CAN_Setup_and_Demo[
^]
I searched how to use invoke online but I am doing something wrong in my code. The application p/invoke which generates the code does not open the omap_can.dll, so I have to type it properly on my own.
The Dependency Walker application that I used to see the contents of omap_can.dll gives the message "Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module." and allows me to view the functions (slightly different names as opposed to the ARM guide):
CAN_Close
CAN_Deinit
CAN_Init
CAN_IOControl
CAN_Open
CAN_PowerDown
CAN_PowerUp
I can also see that the omap_can.dll is linked with the cedk.dll, coredll.dll and fpcrt.dll.
I really need to understand what I am doing because I almost try random solutions.
I was attempt to call a function "CAN_Init" using C#. Here is my code (it compiles in Visual Studio 2005, but crashes when used on the device):
namespace HMIShell
{
public partial class HMIShell : Form
{
[DllImport("\\Storage Card\\omap_can.dll")]
public static extern void CAN_Init();
public HMIShell()
{
InitializeComponent();
CAN_Init();
}
Thank you in advance.