Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

NI XNET : nxReadState returns the communication state as error positive(nxCANCommState_ErrorPassive) right after i initialize and create session

If I setup the same through Bus Monitor send/receive communication works without any error. But when I try to do the same from the above sample program I get bus-off error. There is nothing else on the bus. Also the ECU continues to transmit even though there is a bus error state. 

 

Either I am missing something in my code or some settings are off.

 

Attached is bus monitor log and  following are screen captures for the same.

 

Bus monitor- Monitor tab

 

Bus Monitor : Configuration screen

 

Bus Monitor : Transmit screen

Download All
0 Kudos
Message 11 of 13
(1,663 Views)

What version of XNET are you using? The UI for setting custom buad rates was introduced in 16.1 but resulting values will work with some older versions of the driver as well.

 

I did notice that the nxFrameType in your code is set to nxFrameType_CAN20_Data. We can try setting it to nxFrameType_CANFDBRS_Data, although, in my testing it didn't make a difference.

FrameType.PNG

 

We can also try moving the set point of the arbitration phase to 72.5%, but again, if bus monitor is working I would expect the application code to perform the same way with the same settings.

Jeff L
National Instruments
Message 12 of 13
(1,652 Views)

Thanks again Jeff L. Changing the arbitration phase value to 72.5% for "nxPropSession_IntfBaudRate64" resolved this issue. 

I am running the latest NI XNET software (16.1) and changing the frame type didn't help because I am writing a standard/classic CAN frame.

 

Also, this means that the standard baud rate wont work for me and converting it to custom by using these bit timing register values is my only option!

 

 

0 Kudos
Message 13 of 13
(1,643 Views)