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 / CAN1,2 and 3 configuration issue

Other Parts Discussed in Thread: HALCOGEN, TMS570LS0332

Hi,

We are using Halcogen v 3.6.0 to generate low level drivers for our project.

We are using CAN1,2 and 3 just to use the RX and TX pins as GPIO.

We found a strange behaviour: CAN1 and CAN2 work as expected, whereas CAN3 not so, as it turns out that the pins are in functional mode and not in GPIO mode.

I have found a root cause for the difference, but nothing with regard to any sensible explanation.

The difference between CAN3 and the others comes from the generated code.

At the end of the canInit() function, the following instruction is executed:

/** - Leave configuration and initialization mode */
canREG3->CTL &= ~(0x00000041U);

The same is not performed for CAN1 and CAN2.

So it begs the following questions:

-  why aren't CAN1 and CAN2 placed in normal mode ?

-  why placing CAN3 in normal mode cause its configuration to revert from GPIO to functional mode ?

Thanks,

  • Thanks for your findings.

    I believe it is a mistake of the HalCoGen.

    I will forward your request to the HalCoGen team.

    Thanks,

    Haixiao

  • Hi Zanzibar

    If you are using CAN as GIO ( i.e, Selected GIO in CANx Port Tab), you need not do all the things which are present in the HALCoGen version 3.06.00 canInit function. Only below two register in respective CAN modules has to be set as part of canInit. ( Note the values depend on the direction and Pull settings made in the GUI). Upcoming HALCoGen version wil have this implemented. I have placed a similar ticket link below.

        canREGx->TIOC = ((uint32)1U  << 18U )
                       | ((uint32)0U  << 17U )  
                       | ((uint32)0U  << 3U ) 
                       | ((uint32)1U  << 2U )   
                       | ((uint32)1U << 1U );
          
        canREGx->RIOC = ((uint32)1U  << 18U )   
                       | ((uint32)0U  << 17U )  
                       | ((uint32)0U  << 3U ) 
                       | ((uint32)0U  << 2U )
                       | ((uint32)0U << 1U ); 

    http://e2e.ti.com/support/microcontrollers/hercules/f/312/p/296043/1031940.aspx#1031940

     

  • Hi @all,

     

    i think the isue with HALCoGen is not compelte solved in Version 04.00.00. I tried to use CAN1 and CAN2 for general purpose IO in TMS570LS0332. But I had to Init die CAN Perfipherie first.( please see http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/306206.aspx)

     

    I think the INIT is Missing in HALCoGen? Or I'm doing something wrong?

     

  • Hi Frank,

    It has not been fixed in 4.00.00. It will be fixed in next release.
    Please have the Init Bit set to write to TIOC and TIOC register

    canREGx->CTL = 1;

    You could use the User code inside canInit() to add this line.. The issue is not in CANdriver but in the enableParity() in selftest.c, while Enabling Parity the Init bit is cleared.