Automotive and Embedded Networks

取消
显示结果 
搜索替代 
您的意思是: 

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 项奖励
1 条消息(共 10 条)
6,068 次查看

allready answered in this thread:

Link

DirkW

0 项奖励
2 条消息(共 10 条)
6,057 次查看

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 项奖励
3 条消息(共 10 条)
6,048 次查看

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 项奖励
4 条消息(共 10 条)
6,043 次查看
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 项奖励
5 条消息(共 10 条)
6,037 次查看

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 项奖励
6 条消息(共 10 条)
6,015 次查看

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

0 项奖励
7 条消息(共 10 条)
4,938 次查看

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 项奖励
8 条消息(共 10 条)
4,933 次查看

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

0 项奖励
9 条消息(共 10 条)
4,931 次查看

 

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 项奖励
10 条消息(共 10 条)
4,925 次查看