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.

CCS/TMS570LS0714: CAN as GIO input

Part Number: TMS570LS0714
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Hello, I am trying to use CAN pins as GIO. I found the code and understood how to use CAN_3 of TMS570LS as GIO output, but I don't know how to use the value of the register set as an input on my code. I have set my CAN3 register as output using this function code:

int SOC(int value){
    if (value==1){
    canREG3->TIOC =  (uint32)((uint32)1U  << 18U )
                   | (uint32)((uint32)1U  << 17U )
                   | (uint32)((uint32)0U  << 16U )
                   | (uint32)((uint32)0U  << 3U )
                   | (uint32)((uint32)1U  << 2U )
                   | (uint32)((uint32)1U << 1U );
    SOCbit=1;
    }
    else if (value==0){
    canREG3->TIOC =  (uint32)((uint32)1U  << 18U )
                   | (uint32)((uint32)1U  << 17U )
                   | (uint32)((uint32)0U  << 16U )
                   | (uint32)((uint32)0U  << 3U )
                   | (uint32)((uint32)1U  << 2U )
                   | (uint32)((uint32)0U << 1U );
    SOCbit=0;
    }
    return SOCbit;
}

With halogen and checking the TRM section 24.17.31 I set the CAN3_RX as a GIO input:

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

My question is, how can I see if in the electronics I have a 0 or a 1? Reading the TMR section 24.27.31, I suppose I have to use bit 0 of register canREG3, but how can I check that bit in the code?

I can't write: 

canREG3->RIOC (uint32)((uint32)  << 0U ) 
  • Hi Andrea,

    HALCoGen includes some useful functions specific to the CAN driver amongst which is:

    uint32 canIoRxGetBit(canBASE_t *node)
    {
    return (node->RIOC & 1U);

    }

    Where node is equal to canREG1 to 3. 

    You can try returning: "canREG3->RIOC &1U" to get the current value of the RX pin of that CAN port. 

    Please let me know if that helped answer your question.

    Best regards,

    Andrei