Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

nxReadFrame does not read

I am new to XNET and  i have to check a CAN port on a D.U.T. I have to send 8 bytes with a identifier and recieve the same 8 byte with a identifier+1. I monitor the data that i send and receive with PCAN-View. There i can see that i send the identifier + the 8 bytes and that the D.U.T response correctly. Problem now is that nxReadFrame recieves 0 byte and i don't know why. Has it something to do with the 2 deferent identifiers ?

Download All
0 Kudos
Message 1 of 5
(1,966 Views)

Well it looks like you are using the correct session types.  XNet has a few session types, and the easiest to understand is the Frame In/Out Stream.  Queued is the session type that will only read or write to the frame ID specified, and I could see that being an issue had you used it.  I have a blog post here on the different session types.

 

It sounds like it is already working from a setup perspective.  But one thing you can do to test this is run the XNet Bus Monitor.  This should be in your start menu, or launched from within MAX.  From here you can read and write frames easily from an application.  If it doesn't work there then it won't work in your application either.

 

Still it could be baud rate in compatibilities, or other setup issues like needing terminations.  For that you need two 120 ohm resistors, on on each end of the bus, between the CAN high and low wires.  I mention this in part 1 of my blog too.

 

Unfortunately I'm more of a 2 dimensional programmer, and can't say if there are any obvious issues with your code.

0 Kudos
Message 2 of 5
(1,937 Views)

Hello

 

Thanks for your quick response

I have managed to receive the answer back from the DUT but after creating the input and output sessions i have to send the data 2 times before i get the frame with the correct identifier. This happens only the first time after creating the sessions. All other successive writeFrames respond with the correct identifier immediately. Do you know what that can be ?

I have added nxFlush() for the input and output session but that didn't do the job

 

0 Kudos
Message 3 of 5
(1,921 Views)

Nope that sounds pretty strange to me.  Again I'm very familiar with XNet, but I've never implemented it with any text based language.  Sorry I can't be more helpful.

0 Kudos
Message 4 of 5
(1,917 Views)

Oke

Thanks for you assistance

0 Kudos
Message 5 of 5
(1,911 Views)