public void InitializeCAN()
        {
            XL_Status status;

            // Open XL Driver
            status = CANDriver.XL_OpenDriver();

            status = CANDriver.XL_GetDriverConfig(ref driverConfig);

            while (!GetAppChannelAndTestIsOk(1, ref txMask, ref txCi) || !GetAppChannelAndTestIsOk(0, ref rxMask, ref rxCi))
            {
                PrintAssignErrorAndPopupHwConf();
            }

            accessMask     = txMask | rxMask;
            permissionMask = accessMask;

            // Open port
            status = CANDriver.XL_OpenPort(ref portHandle, appName, accessMask, ref permissionMask, 1024, XLDefine.XL_InterfaceVersion.XL_INTERFACE_VERSION, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
            Console.WriteLine("\n\nOpen Port             : " + status);
            if (status != XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }

            // Check port
            status = CANDriver.XL_CanRequestChipState(portHandle, accessMask);
            Console.WriteLine("Can Request Chip State: " + status);
            if (status != XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }

            // Activate channel
            status = CANDriver.XL_ActivateChannel(portHandle, accessMask, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN, XLDefine.XL_AC_Flags.XL_ACTIVATE_NONE);
            Console.WriteLine("Activate Channel      : " + status);
            if (status != XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }

            Console.WriteLine("Set Notification      : " + status);
            if (status != XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }

            status = CANDriver.XL_ResetClock(portHandle);
            Console.WriteLine("Reset Clock           : " + status + "\n\n");
            if (status != XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }
        }
Esempio n. 2
0
        public long CanTpCreateConnection(string appName, uint appChannel, XLDefine.XL_HardwareType hwType, uint hwIndex, uint hwChannel, XLDefine.XL_BusTypes busType)
        {
            XLDefine.XL_Status status;

            status = CANTPDriver.XL_OpenDriver();
            Console.WriteLine("Open Driver       : " + status);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                return(-1);
            }

            status = CANTPDriver.XL_SetApplConfig(appName, appChannel, hwType, hwIndex, hwChannel, busType);
            Console.WriteLine("SetApplConfig      : " + status);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                return(-2);
            }
            accessMask     = CANTPDriver.XL_GetChannelMask(hwType, (int)hwIndex, (int)hwChannel);
            permissionMask = accessMask;
            txMask         = accessMask;

            status = CANTPDriver.XL_OpenPort(ref portHandle, appName, accessMask, ref permissionMask, 1024, XLDefine.XL_InterfaceVersion.XL_INTERFACE_VERSION, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
            Console.WriteLine("Open Port      : " + status);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                return(-3);
            }

            status = CANTPDriver.XL_CanRequestChipState(portHandle, accessMask);
            Console.WriteLine("Can Request Chip State: " + status);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                return(-4);
            }

            status = CANTPDriver.XL_ActivateChannel(portHandle, accessMask, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN, XLDefine.XL_AC_Flags.XL_ACTIVATE_NONE);
            Console.WriteLine("Activate Channel      : " + status);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                return(-5);
            }

            status = CANTPDriver.XL_SetNotification(portHandle, ref eventHandle, 1);
            Console.WriteLine("Set Notification      : " + status);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                return(-6);
            }

            status = CANTPDriver.XL_ResetClock(portHandle);
            Console.WriteLine("Reset Clock           : " + status + "\n\n");
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                return(-7);
            }

            Console.WriteLine("Start Rx thread...");
            rxThread = new Thread(new ThreadStart(CanTp_ReceptionInd));
            rxThread.Start();

            return(0);
        }
Esempio n. 3
0
        public void INITLOG()
        {
            //starting app
            Console.WriteLine("UDS- Vector Client Started \n");
            Console.WriteLine("Vector XL Driver Version: " + typeof(XLDriver).Assembly.GetName().Version + "\n");
            //opening driver
            status = UDSDemo.XL_OpenDriver();
            Console.WriteLine("Opening vector CAN Driver.... \n");
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }
            status = UDSDemo.XL_GetDriverConfig(ref driverConfig);
            //getting config
            Console.WriteLine("Getting CAN Driver Config: \n");
            Console.WriteLine(status + Environment.NewLine);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }
            //getting DLL info
            Console.WriteLine("Getting Vector DLL Version: ");
            Console.WriteLine(UDSDemo.VersionToString(driverConfig.dllVersion) + Environment.NewLine);
            //Getting channels...
            Console.WriteLine("Channels found: " + driverConfig.channelCount + Environment.NewLine);
            for (int i = 0; i < driverConfig.channelCount; i++)
            {
                Console.WriteLine("   Channel Name:" + driverConfig.channel[i].name);
                Console.WriteLine("   Channel Mask:" + driverConfig.channel[i].channelMask);
                Console.WriteLine("   Transceiver Name:" + driverConfig.channel[i].transceiverName);
                Console.WriteLine("   Serial Number:" + driverConfig.channel[i].serialNumber);
                Console.WriteLine("\n\n");
            }

            //Check config
            if ((UDSDemo.XL_GetApplConfig(appName, 0, ref hwType, ref hwIndex, ref hwChannel, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN) != XLDefine.XL_Status.XL_SUCCESS) ||
                (UDSDemo.XL_GetApplConfig(appName, 1, ref hwType, ref hwIndex, ref hwChannel, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN) != XLDefine.XL_Status.XL_SUCCESS))
            {
                //...create the item with two CAN channels
                UDSDemo.XL_SetApplConfig(appName, 0, XLDefine.XL_HardwareType.XL_HWTYPE_NONE, 0, 0, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
                UDSDemo.XL_SetApplConfig(appName, 1, XLDefine.XL_HardwareType.XL_HWTYPE_NONE, 0, 0, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
                //PrintAssignErrorAndPopupHwConf();
                ThreadMutex = 1;
            }
            // Request the user to assign channels until both CAN1 (Tx) and CAN2 (Rx) are assigned to usable channels
            if (!GetAppChannelAndTestIsOk(0, ref txMask, ref txCi) || !GetAppChannelAndTestIsOk(1, ref rxMask, ref rxCi))
            {
                ThreadMutex = 0;
            }
            //Printing application configuration on log screen
            //PrintConfig();
            //making masks
            accessMask     = txMask | rxMask;
            permissionMask = accessMask;
            //opening port
            status = UDSDemo.XL_OpenPort(ref portHandle, appName, accessMask, ref permissionMask, 1024, XLDefine.XL_InterfaceVersion.XL_INTERFACE_VERSION, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
            Console.WriteLine("Open Port  :" + status + Environment.NewLine);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }
            //chip state checking
            status = UDSDemo.XL_CanRequestChipState(portHandle, accessMask);
            Console.WriteLine("CAN Request Chip state  :" + status + Environment.NewLine);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }
            //ON Bus
            status = UDSDemo.XL_ActivateChannel(portHandle, accessMask, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN, XLDefine.XL_AC_Flags.XL_ACTIVATE_NONE);
            Console.WriteLine("Activate Channel  :" + status + Environment.NewLine);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }
            //can ids display
            Console.WriteLine("TESTER REQUEST CAN ID: 0x735" + Environment.NewLine);
            Console.WriteLine("ECU RESPONSE CAN ID: 0x73D" + Environment.NewLine);
            //giving info

            //putting notifications on can
            int tempInt = -1;

            status = UDSDemo.XL_SetNotification(portHandle, ref tempInt, 1);
            xlEvWaitHandle.SafeWaitHandle = new SafeWaitHandle(new IntPtr(tempInt), true);
            Console.WriteLine("Set Notification  :" + status + Environment.NewLine);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }

            if (TimerRate == 1)
            {
                TimerRate = 0;
            }
            else
            {
                TimerRate = 20000;
            }
            status = UDSDemo.XL_SetTimerRate(portHandle, TimerRate);
            Console.WriteLine("setTimer  :" + status + Environment.NewLine);
            //resetting clock
            status = UDSDemo.XL_ResetClock(portHandle);
            Console.WriteLine("Reset Clock  :" + status + Environment.NewLine);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }
            //TPLOCK = 1;
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("\nDevice Connected " + driverConfig.channel[0].name + " and " + driverConfig.channel[1].name + " active\n");
            Console.ForegroundColor = ConsoleColor.White;
            //starting rx thread
            Console.WriteLine("Starting Receive Thread........" + Environment.NewLine);
            rxThread = new Thread(new ThreadStart(RXHANDLER));
            rxThread.Start();
            Console.WriteLine("Is main thread is alive" +
                              " ? : {0}", rxThread.IsAlive);
        }
Esempio n. 4
0
        /// <summary>
        /// The initialization of the Vector CAN driver
        /// </summary>
        /// <param name="_iEventHandle"></param>
        /// <param name="_iPortHandle"></param>
        /// <param name="_ui64TransmitMask"></param>
        public void xlStartCan(ref int _iEventHandle, ref int _iPortHandle, ref UInt64 _ui64TransmitMask)
        {
            UInt64 ui64AccessMask     = 0;
            UInt64 ui64PermissionMask = 0;
            uint   uiHWType           = 0;
            uint   uiHWIndex          = 0;
            uint   uiHWChannel        = 0;
            uint   uiBusType          = (uint)XLClass.XLbusTypes.XL_BUS_TYPE_CAN;
            uint   uiFlags            = 0;

            XLClass.XLstatus xlRet;

            if ((_xlDriverTx.XL_GetApplConfig("xlCANSimulator", 0, ref uiHWType, ref uiHWIndex, ref uiHWChannel, uiBusType) != XLClass.XLstatus.XL_SUCCESS) ||
                (_xlDriverTx.XL_GetApplConfig("xlCANSimulator", 1, ref uiHWType, ref uiHWIndex, ref uiHWChannel, uiBusType) != XLClass.XLstatus.XL_SUCCESS))
            {
                _xlDriverTx.XL_SetApplConfig("xlCANSimulator", 0, 0, 0, 0, 0);
                _xlDriverTx.XL_SetApplConfig("xlCANSimulator", 1, 0, 0, 0, 0);
            }
            log("DRIVER-Open xlCANSimulator configuration");
            _xlDriverTx.XL_GetApplConfig("xlCANSimulator", 0, ref uiHWType, ref uiHWIndex, ref uiHWChannel, uiBusType);
            ui64AccessMask |= _xlDriverTx.XL_GetChannelMask((int)uiHWType, (int)uiHWIndex, (int)uiHWChannel);

            ui64PermissionMask  = ui64AccessMask;
            _ui64TransmitMaskTx = ui64AccessMask;

            xlRet = _xlDriverTx.XL_OpenPort(ref _iPortHandle, "xlCANSimulator", ui64AccessMask, ref ui64PermissionMask, (uint)1024, uiBusType);
            if (XLClass.XLstatus.XL_SUCCESS != xlRet)
            {
                log("DRIVER-Open port failed");
            }
            else
            {
                log("DRIVER-Open port success");
            }

            xlRet = _xlDriverTx.XL_CanRequestChipState(_iPortHandle, ui64AccessMask);
            if (XLClass.XLstatus.XL_SUCCESS != xlRet)
            {
                log("DRIVER-Request chip state failed");
            }
            else
            {
                log("DRIVER-Request chip state success");
            }

            xlRet = _xlDriverTx.XL_ActivateChannel(_iPortHandle, ui64AccessMask, uiBusType, uiFlags);
            if (XLClass.XLstatus.XL_SUCCESS != xlRet)
            {
                log("DRIVER-Activate channel failed");
            }
            else
            {
                log("DRIVER-Activate channel success");
            }

            xlRet = _xlDriverTx.XL_SetNotification(_iPortHandle, ref _iEventHandle, 1);
            if (XLClass.XLstatus.XL_SUCCESS != xlRet)
            {
                log("DRIVER-Set notificaiton failed");
            }
            else
            {
                log("DRIVER-Set notificaiton success");
            }

            xlRet = _xlDriverTx.XL_ResetClock(_iPortHandle);
            if (XLClass.XLstatus.XL_SUCCESS != xlRet)
            {
                log("DRIVER-Reset clock failed");
            }
            else
            {
                log("DRIVER-Reset clock success");
            }
        }
Esempio n. 5
0
        public XLInterface()
        {
            MessageTypes = new Dictionary <int, string>();
            MessageTypes.Add(FULL_THROTTLE_ON, "Throttle On");
            MessageTypes.Add(FULL_THROTTLE_OFF, "Throttle Off");
            MessageTypes.Add(FULL_BRAKE_ON, "Brake On");
            MessageTypes.Add(FULL_BRAKE_OFF, "Brake Off");

            XLDefine.XL_Status status;
            driver       = new XLDriver();
            driverConfig = new XLClass.xl_driver_config();
            driver.XL_GetDriverConfig(ref driverConfig);


            // If the application name cannot be found in VCANCONF...
            if ((driver.XL_GetApplConfig(appName, 0, ref hwType, ref hwIndex, ref hwChannel, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN) != XLDefine.XL_Status.XL_SUCCESS))
            {
                //...create the item with two CAN channels
                status = driver.XL_SetApplConfig(appName, 0, XLDefine.XL_HardwareType.XL_HWTYPE_CANCASEXL, 0, 0, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
                Console.WriteLine(status);
            }


            // Read setting of CAN1
            driver.XL_GetApplConfig(appName, 0, ref hwType, ref hwIndex, ref hwChannel, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);

            // Notify user if no channel is assigned to this application
            if (hwType == XLDefine.XL_HardwareType.XL_HWTYPE_NONE)
            {
                PrintAssignError();
            }

            accessMask = driver.XL_GetChannelMask(hwType, (int)hwIndex, (int)hwChannel);
            txMask     = accessMask; // this channel is used for Tx
            PrintConfig();


            permissionMask = accessMask;

            // Open port
            status = driver.XL_OpenPort(ref portHandle, appName, accessMask, ref permissionMask, 1024, XLDefine.XL_InterfaceVersion.XL_INTERFACE_VERSION, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
            Console.WriteLine("\n\nOpen Port             : " + status);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }

            // Check port
            status = driver.XL_CanRequestChipState(portHandle, accessMask);
            Console.WriteLine("Can Request Chip State: " + status);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }

            // Activate channel
            status = driver.XL_ActivateChannel(portHandle, accessMask, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN, XLDefine.XL_AC_Flags.XL_ACTIVATE_NONE);
            Console.WriteLine("Activate Channel      : " + status);
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }

            // Reset time stamp clock
            status = driver.XL_ResetClock(portHandle);
            Console.WriteLine("Reset Clock           : " + status + "\n\n");
            if (status != XLDefine.XL_Status.XL_SUCCESS)
            {
                PrintFunctionError();
            }
        }
Esempio n. 6
0
        // -----------------------------------------------------------------------------------------------
        /// <summary>
        /// MAIN
        ///
        /// Sends and receives CAN messages using main methods of the "XLDriver" class.
        /// This demo requires two connected CAN channels (Vector network interface).
        /// The configuration is read from Vector Hardware Config (vcanconf.exe).
        /// </summary>
        // -----------------------------------------------------------------------------------------------
        //[STAThread]
        public String InitCANtransmitter()
        {
            // Open XL Driver
            status = CANDemo.XL_OpenDriver();
            //Console.WriteLine("Open Driver       : " + status);
            //if (status != XLDefine.XL_Status.XL_SUCCESS) PrintFunctionError();


            // Get XL Driver configuration
            status = CANDemo.XL_GetDriverConfig(ref driverConfig);
            //Console.WriteLine("Get Driver Config : " + status);
            //if (status != XLDefine.XL_Status.XL_SUCCESS) PrintFunctionError();

            // If the application name cannot be found in VCANCONF...
            if ((CANDemo.XL_GetApplConfig(appName, 0, ref hwType, ref hwIndex, ref hwChannel, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN) != XLDefine.XL_Status.XL_SUCCESS) ||
                (CANDemo.XL_GetApplConfig(appName, 1, ref hwType, ref hwIndex, ref hwChannel, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN) != XLDefine.XL_Status.XL_SUCCESS))
            {
                //...create the item with two CAN channels
                CANDemo.XL_SetApplConfig(appName, 0, XLDefine.XL_HardwareType.XL_HWTYPE_NONE, 0, 0, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
                CANDemo.XL_SetApplConfig(appName, 1, XLDefine.XL_HardwareType.XL_HWTYPE_NONE, 0, 0, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
                PrintAssignError();
            }

            else // else try to read channel assignments
            {
                string str;

                // Read setting of CAN1
                CANDemo.XL_GetApplConfig(appName, 0, ref hwType, ref hwIndex, ref hwChannel, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);

                // Notify user if no channel is assigned to this application
                if (hwType == XLDefine.XL_HardwareType.XL_HWTYPE_NONE)
                {
                    PrintAssignError();
                }

                accessMask = CANDemo.XL_GetChannelMask(hwType, (int)hwIndex, (int)hwChannel);
                txMask     = accessMask; // this channel is used for Tx

                /*
                 * // Read setting of CAN2
                 * CANDemo.XL_GetApplConfig(appName, 1, ref hwType, ref hwIndex, ref hwChannel, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
                 *
                 * // Notify user if no channel is assigned to this application
                 * if (hwType == XLDefine.XL_HardwareType.XL_HWTYPE_NONE) PrintAssignError();
                 *
                 * accessMask |= CANDemo.XL_GetChannelMask(hwType, (int)hwIndex, (int)hwChannel); // OR: access both channels for RX later
                 */
                permissionMask = accessMask;

                // Open port
                status = CANDemo.XL_OpenPort(ref portHandle, appName, accessMask, ref permissionMask, 1024, XLDefine.XL_InterfaceVersion.XL_INTERFACE_VERSION, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
                //Console.WriteLine("\n\nOpen Port             : " + status);
                //if (status != XLDefine.XL_Status.XL_SUCCESS) PrintFunctionError();

                // Check port
                status = CANDemo.XL_CanRequestChipState(portHandle, accessMask);
                //Console.WriteLine("Can Request Chip State: " + status);
                //if (status != XLDefine.XL_Status.XL_SUCCESS) PrintFunctionError();

                // Activate channel
                status = CANDemo.XL_ActivateChannel(portHandle, accessMask, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN, XLDefine.XL_AC_Flags.XL_ACTIVATE_NONE);
                //Console.WriteLine("Activate Channel      : " + status);
                //if (status != XLDefine.XL_Status.XL_SUCCESS) PrintFunctionError();

                // Get RX event handle
                status = CANDemo.XL_SetNotification(portHandle, ref eventHandle, 1);
                //Console.WriteLine("Set Notification      : " + status);
                //if (status != XLDefine.XL_Status.XL_SUCCESS) PrintFunctionError();

                // Reset time stamp clock
                CANDemo.XL_ResetClock(portHandle);
                //Console.WriteLine("Reset Clock           : " + status + "\n\n");
                //if (status != XLDefine.XL_Status.XL_SUCCESS) PrintFunctionError();
            }
            return(status.ToString());
        }
Esempio n. 7
0
        public void OpenPort(bool iscanfd, uint arbitSpeed, uint dataSpeed)
        {
            if (iscanfd)
            {
                // --------------------
                // Set CAN FD config
                // --------------------
                status = CANDriver.XL_OpenPort(ref portHandle, appName, accessMask, ref permissionMask, 16000, XLDefine.XL_InterfaceVersion.XL_INTERFACE_VERSION_V4, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
                info  += "\n\nOpen Port             : " + status;

                XLClass.XLcanFdConf canFdConf = new XLClass.XLcanFdConf();

                // arbitration bitrate
                canFdConf.arbitrationBitRate = arbitSpeed;
                canFdConf.tseg1Abr           = 8;
                canFdConf.tseg2Abr           = 7;
                canFdConf.sjwAbr             = 1;

                // data bitrate
                canFdConf.dataBitRate = dataSpeed;
                canFdConf.tseg1Dbr    = 4;
                canFdConf.tseg2Dbr    = 3;
                canFdConf.sjwDbr      = 1;

                if (canFdModeNoIso > 0)
                {
                    canFdConf.options = (byte)XLDefine.XL_CANFD_ConfigOptions.XL_CANFD_CONFOPT_NO_ISO;
                }
                else
                {
                    canFdConf.options = 0;
                }

                status = CANDriver.XL_CanFdSetConfiguration(portHandle, accessMask, canFdConf);
                info  += "\n\nSet CAN FD Config     : " + status;


                // Get RX event handle
                status = CANDriver.XL_SetNotification(portHandle, ref eventHandle, 1);
                info  += "Set Notification      : " + status;


                // Activate channel - with reset clock
                status = CANDriver.XL_ActivateChannel(portHandle, accessMask, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN, XLDefine.XL_AC_Flags.XL_ACTIVATE_RESET_CLOCK);
                info  += "Activate Channel      : " + status;


                // Get XL Driver configuration to get the actual setup parameter
                status = CANDriver.XL_GetDriverConfig(ref driverConfig);

                if (canFdModeNoIso > 0)
                {
                    info += "CAN FD mode           : NO ISO";
                }
                else
                {
                    info += "CAN FD mode           : ISO";
                }
                info += "TX Arb. BitRate       : " + driverConfig.channel[txCi].busParams.dataCanFd.arbitrationBitRate
                        + "Bd, Data Bitrate: " + driverConfig.channel[txCi].busParams.dataCanFd.dataBitRate + "Bd";
            }
            else
            {
                // --------------------
                // Set CAN config
                // --------------------
                status = CANDriver.XL_OpenPort(ref portHandle, appName, accessMask, ref permissionMask, 1024, XLDefine.XL_InterfaceVersion.XL_INTERFACE_VERSION, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN);
                info  += "\n\nOpen Port             : " + status;

                //check port
                status = CANDriver.XL_CanRequestChipState(portHandle, accessMask);
                info  += "\nCan Request Chip State: " + status;

                // Activate channel
                status = CANDriver.XL_ActivateChannel(portHandle, accessMask, XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN, XLDefine.XL_AC_Flags.XL_ACTIVATE_NONE);
                info  += "\nActivate Channel      : " + status;

                // Initialize EventWaitHandle object with RX event handle provided by DLL
                int tempInt = -1;
                status = CANDriver.XL_SetNotification(portHandle, ref tempInt, 1);
                xlEvWaitHandle.SafeWaitHandle = new SafeWaitHandle(new IntPtr(tempInt), true);

                info += "\nSet Notification      : " + status;

                // Reset time stamp clock
                status = CANDriver.XL_ResetClock(portHandle);
                info  += "\nReset Clock           : " + status;
            }
        }