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.

RM48 CAN Pins as GIO

Other Parts Discussed in Thread: RM48L952, HALCOGEN

Hi,

Working on some unit testing and need clarification on the use of GIO pins for the 3 DCAN modules on RM48L952.

To set the IO direction of the Tx pin we use:

//clear init bit
canREGx->CTL &= (0x00000001U ^ 0xFFFFFFFF);

//set the Transmit Pin to Output
canREGx->TIOC = 1U << 2U;

However this has no effect and we can not toggle the output by physically setting or clearing the bit as per:

//set
canREGx->TIOC |= (1U << 1U);

//clear
canREGx->TIOC &= ((1U << 1U) ^ 0xFFFFFFFF);

We have referred to the HalCoGen generated code (note: We don't use HalCoGen in our projects) and we find:

/** - Setup control register
*     - Enter initialization mode
*/
canREG2->CTL = 0x00000001U;
	
/** - CAN2 Port output values */
canREG2->TIOC =  (uint32)((uint32)1U  << 18U )
               | (uint32)((uint32)0U  << 17U )
               | (uint32)((uint32)0U  << 16U )  
               | (uint32)((uint32)0U  << 3U )  
               | (uint32)((uint32)1U  << 2U )    
               | (uint32)((uint32)1U << 1U );

So it seems HalCogen is setting the Init Bit = 1 in the control register, despite the note on section 23.17.29 ("The values of the IO Control registers are only writable if Init bit of CAN Control Register is Cleared.")

Could someone please confirm what is the correct method to enable the GIO functionality of a CAN pin, including the correct Control Register setting?

Thanks

Stomp!.