Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI-CAN/XS2 Single wire configuration (cont)

I set CAN1 as a bus monitor looking for data from the Module,
I connected CAN0 to 9pinSubD pins 3,7,9
I connected Can1 to the same
I have +12V to pins 3-, 9+, to power the modul and SW CAN
 
I am seeing no activity
 
+++++++++++++++++++++++++++++++++++++++++start code
/*
Work in-progress. Attempting to see data on Can1/Bus Monitor.
*/
#include <cvirte.h>
#include <stdio.h>      // Include file for printf
#include <stdlib.h>     // Include file for strtol
#include <windows.h>    // Include file for Win32 time functions
#include <userint.h>
#include <string.h>
#include <utility.h>
#include "Gm-Can-Test.h"
#include "nican.h"      // Include file for NI-CAN functions and constants      
/* NI-CAN Status    */
NCTYPE_STATUS status=0;
/* NI-CAN handles */
NCTYPE_OBJH NetIntfObjhRx=0;
NCTYPE_OBJH NetIntfObjhTx=0;
int main (int argc, char *argv[])
{
 int RunStatus = 0;
 
 RunStatus = CanTest();
 return RunStatus;
}
int CanTest (void)
{
 char Interface1[6];
 char TxString[80];
 NCTYPE_UINT32   TransceiverMode;
 NCTYPE_UINT32   TransceiverType;
 int RunStatus = 0;
 
 NCTYPE_CAN_DATA   Transmit;
  // Handle for Network Interface Object (receiver)
 NCTYPE_OBJH  RxHandle = 0;
 // Handle for the CAN object (transmitter)
 NCTYPE_OBJH  TxHandle = 0;
 NCTYPE_ATTRID AttrIdList[8];
 NCTYPE_UINT32 AttrValueList[8];
 NCTYPE_UINT32 Baudrate;
  
 sprintf(Interface1,"CAN0");
 
  /* Configure the 1. CAN Network Interface Object */
  TransceiverMode = NC_TRANSCEIVER_TYPE_SW ;
 status = ncSetAttribute (NetIntfObjhTx, NC_ATTR_TRANSCEIVER_TYPE,
  sizeof(TransceiverMode), &TransceiverMode);
 
 
   AttrIdList[0] =         NC_ATTR_BAUD_RATE;  
   AttrValueList[0] =      33333;
   AttrIdList[1] =         NC_ATTR_START_ON_OPEN;
   AttrValueList[1] =      NC_TRUE;
   AttrIdList[2] =         NC_ATTR_READ_Q_LEN;
   AttrValueList[2] =      10;
   AttrIdList[3] =         NC_ATTR_WRITE_Q_LEN;
   AttrValueList[3] =      0;
   AttrIdList[4] =         NC_ATTR_CAN_COMP_STD;
   AttrValueList[4] =      0;
   AttrIdList[5] =         NC_ATTR_CAN_MASK_STD;
   AttrValueList[5] =      NC_CAN_MASK_STD_DONTCARE;
   AttrIdList[6] =         NC_ATTR_CAN_COMP_XTD;
   AttrValueList[6] =      0;
   AttrIdList[7] =         NC_ATTR_CAN_MASK_XTD;
   AttrValueList[7] =      NC_CAN_MASK_XTD_DONTCARE;
   
   status = ncConfig(Interface1, 8, AttrIdList, AttrValueList);
       
 TransceiverMode = NC_TRANSCEIVER_MODE_SW_WAKEUP;
  status = ncSetAttribute(NetIntfObjhTx, NC_ATTR_TRANSCEIVER_MODE,
   sizeof(TransceiverMode), &TransceiverMode);
 status = ncConfig(Interface1, 8, AttrIdList, AttrValueList);
  
 // Open Transmitting Objects
 status = ncOpenObject("CAN0::XTD0x100", &TxHandle);
   
 Transmit.Data[0] = 0x00;
 Transmit.Data[1] = 0x00;
 Transmit.Data[2] = 0x00;
 Transmit.Data[3] = 0x00;
 Transmit.Data[4] = 0x00;
 Transmit.Data[5] = 0x00;
 Transmit.Data[6] = 0x00;
 Transmit.Data[7] = 0x00;
 status = ncWrite (NetIntfObjhTx, sizeof(TxString), TxString);
 TransceiverMode = NC_TRANSCEIVER_MODE_NORMAL ;
  status = ncSetAttribute(NetIntfObjhTx, NC_ATTR_TRANSCEIVER_MODE,
   sizeof(TransceiverMode), &TransceiverMode);
    return RunStatus;
}
++++++++++++++++++++++++++++++++++++end code
0 Kudos
Message 1 of 10
(5,187 Views)

allready answered in this thread:

Link

DirkW

0 Kudos
Message 2 of 10
(5,176 Views)

The function is working but I have one more question

START OUTPUT

Transceiver Mode: SLEEP

Transceiver Mode: SLEEP

Transceiver Mode: SLEEP

02/02/2007 12:56:13.193  ArbId 100  00 00 00 00 00 00 00 00

02/02/2007 12:56:13.600  ArbId 101  fd 02 10 04 aa aa aa aa

02/02/2007 12:56:14.222  ArbId 25d  02 1a c2 00 00 00 00 00

END OUTPUT

I am looking for a response  65d xx xx xx xx xx xx xx xx

Will the Rx set to CAN0 pick this up or do I need to somehow configure the Rx to look for 0x65d ?

ThankYou

 

0 Kudos
Message 3 of 10
(5,167 Views)

I am still trying to trap a response from the module.

I hooked up an o-scope to monitor traffic.

My Wakeup should be at a higher amplitude to wakeup the bus.

The signal is at the same amplitude as all other communication.

What did I miss on the setup?

0 Kudos
Message 4 of 10
(5,162 Views)
With my other CAN communication tools the Wakeup is above 11V with normal communication at 5V nominal
With the NI card all transmitions (including the WakeUp) is below 4.5V.
I am using the same module and the same power source and the same cableing etc...
The main difference is the tool and the software.
I need to get a handle on the wakeup settings.
I have tried many things, but no luck yet.
 
0 Kudos
Message 5 of 10
(5,156 Views)

Hey Rich,

You would need to configure you Can device to what information you are looking at. I'm not sure if you had a chance to look at this start-up tutorial, but it explains the process of getting up and started with NI-Can.

Good luck!

Nick D.

0 Kudos
Message 6 of 10
(5,134 Views)

can you please check if this vi's works for you

Download All
0 Kudos
Message 7 of 10
(4,057 Views)

Hello Rgomez.

 

The last post was 2007...

I have had this working for many years...

But thank You for responding.

I do appriciate feedback.

 

0 Kudos
Message 8 of 10
(4,052 Views)

Can you share your code? I would like to use XNET and replace the CAN vi's

0 Kudos
Message 9 of 10
(4,050 Views)

 

I am sorry, the library is licensed to Aeroflex. You can look them up on the web. But it is developed for the test systems and uses a unique language called Marconi Test Language.

0 Kudos
Message 10 of 10
(4,044 Views)