Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

SDM-CAN endian problem


Joe_Can Mar 8, 2018 09:58 PM

I've got an application that needs to send 4 16-bit values per CAN message. The question here is they have to be send little -endian and so far I haven't come up with the solution.

I have tried these sample commands:

 

		' CAN 100 : msg T_W_1

		T_W_CC_A2 = &H11A2
		T_W_CC_A1 = &H22A1
		T_W_CC_E2 = &H33E2
		T_W_CC_E1 = &H44E1

		Send(1) = T_W_CC_A2
		Send(2) = T_W_CC_A1
		Send(3) = T_W_CC_E2
		Send(4) = T_W_CC_E1

		SDMCAN(Send,ADDR2,TQUANT,TSEG1,TSEG2, -&H100, CAN_Format, 1, 16, 4, 1.0, 0)
		

 

The results I get on a CAN monitor device is 44 E1 33 E2 22 A1 11 A2. All looks good here.

if I change CAN_Format from 21 to 22, I get message as 00 E1 44 E2 33 A1 22 A2. The nibbles are swapped, but data is also shifted 1 byte to the right. 

The data I want to get is E1 44 E2 33 A1 22 A2 11.

I'm going to try using the "Build Data Frame" command (section 3.3.5.2) , but the manual is extremely foggy on the location of the "8-byte buffer in memory". Is this specified by the user on the call? Is it internal to the function? And then when a call is made to transmit the buffer with option 25 (section 3.3.5.4), is this buffer passed in, or is it still a fixed buffer accessed within the function?

Thanks for your replies.


GTProdMgr Mar 13, 2018 09:08 PM

I think you could benefit from using the "SDM-CAN Helper" software:

https://www.campbellsci.com/canhelper

Since RTDAQ is required, you can download an RTDAQ trial version if needed, and then download and install the helper.

There are two buffers used on the SDM-CAN, and one of them shifts the bytes to save space. There is a feature of the SDM-CAN Helper called the "Single Signal Calculator" that helps to illustrate how that works. I recommend you call in for support after installing the software.

Log in or register to post/reply in the forum.