This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

HALCoGen v03.05.02 -- Wrong code generated for TMS570LS20216 ??

Other Parts Discussed in Thread: TMS570LS20216, HALCOGEN


Hello all,

I have an (old?) TMS570LS20216 USB stick and HALCoGen V03.05.02 and CCS v5.4.0.

I have been testing several basic features using and extending the provided examples.

For CAN, the example configures one CAN message for TX and sends it once with "HERCULES" as data. On the other end I am using a PC with a proven USB-CAN interface.

I tried to extend this example as follows:

  • Send the message (message 0x101, TX, DLC=8) several times with updated values
  • Define more CAN messages for TX and send all of them

Well, unfortunately I stumbled upon a lot of issues that (imho) suggest that HALCoGen is not generating the correct code for the TMS570LS20216:

Issue#1 I have configured DCAN1 (not DCAN2) in HALCoGen and canInit() in can.c initializes both DCAN1 and DCAN3 !!. This is strange since the TMS570LS20216 has no DCAN3.

Issue#2 The resulting configuration produces spurious messages. For the single message case: DCAN1 enabled, message id:1, DLC=8, data "HERCULES". My main() code is basically:

    canInit();

    my_delay(ONE_MSEC * 100);
    canTransmit(canREG1, canMESSAGE_BOX1, ( uint8 *) tx_101);

and the result is (as captured by the CAN analyzer):


I have verified with the debugger that the first of the two spurious messages is sent by canInit() itself ?!?

If I try to send the same message several times with different values:

// Send the original message once and then 8 more times
// overwriting one letter at a time with  0xFF
canTransmit(canREG1, canMESSAGE_BOX1, (uint8 *) tx_1);
for (i = 0; i < 8; i++) {
   tx_1[i] = 0xFF;
   my_delay(ONE_MSEC * 100);
   canTransmit(canREG1, canMESSAGE_BOX1, ( uint8 *) tx_1);
}

I get :

Again you can see for each intended message there is a previous spurious message with old data.


Issue#3 When defining several messages the configuration somehow overwrites some of them.

For this case I have configured 3 TX messages for DCAN1:

#1 / DLC 8 bytes / Tx ---> send "HERCULES"
#2 / DLC 6 bytes / Tx ---> send "123456"
#3 / DLC 4 bytes / Tx ---> send "abcd"

Code:
canInit();

my_delay(ONE_MSEC * 100);
canTransmit(canREG1, canMESSAGE_BOX1, ( uint8 *) tx_1);

my_delay(ONE_MSEC * 100);
canTransmit(canREG1, canMESSAGE_BOX2, ( uint8 *) tx_2);

my_delay(ONE_MSEC * 100);
canTransmit(canREG1, canMESSAGE_BOX3, ( uint8 *) tx_3);
I get :
this shows (in addition to the spurious messages) that message #1 is incorrectly identified and formatted as #3 (although the data is "HERCULES" it is cut 4 bytes long as #3 requests).
Could all these problems relate to the last version of HALCoGen producing incorrect configuration for the TMS570LS20216 device ?
Best regards,