Compact Com C40 8/16 bit SPI communication

Hello.
Until now I have worked succesfully with compact com Via SPI communication and using “generic host driver with 8 bit configuration” (ABCC_SYS_16_BIT_CHAR not defined)
Now since I have a 16 bit micro (DSPIC33F - Microchip) I would like to try with ABCC_SYS_16_BIT_CHAR → TRUE.
After some test I have found that I’m not able to communicate with the Device because I got error in CRC calculation. Why? What is the difference?

Hi @paolo,

Typically for the embedded questions we ask that you create a ticket at mysupport.hms.se if you’re not located in the U.S. just because of the time to investigate these along with the time difference between us.

But if you want to continue on the forum, what is the actual CRC error that you’re getting for the error?

-Tim

Many thank’s for reply, Tim.

After many attempts I have seen that, for correctly CRC32 working, I had to modify the instruction below

// HMS (abcc_sw_port.h)

#define ABCC_PORT_MemCpy( pbDest, pbSource, iNbrOfOctets )
memcpy( pbDest, pbSource, ( (iNbrOfOctets) + 1 ) >> 1 );

//brovind (abcc_sw_port.h)
#define ABCC_PORT_MemCpy2( pbDest, pbSource, iNbrOfOctets )
memcpy( pbDest, pbSource, ( (iNbrOfOctets<<1) + 1 ) >> 1 );

Now the CRC32 is OK, but the module is not initialized (the led MS and NS are always OFF): on my DSPIC emulator (MPLAB ICD 4) I see that the Anybus State Machine reaches the “RUNNING STATE” but actually NOT working (neither PING, for example).

Hi @paolo,

Can you confirm that your microcontroller is actually a 16-bit char platform or if it’s a 16-bit databus?

The first sentence says: “The dsPIC33F/PIC24H data width is 16 bits.” which just indicates that the MCU has a databus width of 16 bits, but this by itself does not specify if the MCU supports addressing an 8-bit character or not (on even and odd addresses).

Section 3.4.4 makes me think it is byte addressable. So if this is the case, then I don’t think you want to enable 16-bit char. But I did not look too long at it.

… mmm I am sure that is a 16 bit microcontroller. I use it from many years. :sunglasses:

Hi @paolo,

Even if it’s a 16 bit microcontroller, do you know if it supports 16-bit chars?

-Tim

I honestly don’t know, but what can it do?
Paolo

Hi @paolo,

The compactcom is able to do this, but I’m not sure if your device is able to do this. Could you confirm with the manufacturer of the device?

-Tim

I will check!

Paolo

I have found this


and

Hi @paolo,

Tareq just informed me that he’s going to be taking over this case with you over on our support console.

-Tim

Yes, it’s true, but I have also write on this forum to know if anyone had this issue and, at the same time, to help other users who find themselves in the same problem.

Paolo