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/TMS570LS3137: Using Can2Rx and Can2Tx as GIO

Part Number: TMS570LS3137

Tool/software: Code Composer Studio

Hello everyone,

I set the setting for GIO and generate the code. I am really new to TMS570 family and my problem is how can i use this port as GIO. I mean normally, i can write gioSetBit ( hetPORT1 , 0 , 1); but for Can2 Port what can i write ?

  • Hello Sinan,

    The CAN_RX and CAN_TX pins of each DCAN module can be used as general purpose IO pins, if CAN functionality is not needed. This function is controlled by the CAN TX IO Control register and the CAN RX IO Control register.

    You can not use GIO APIs (like  gioSetBit()) for CAN module which is used as GIO.

  • hello Wang,

    firstly thanks for your reply. As i said, im really new to tms570 family yeah i know it was not a Gio pin so i cant use gioSetBit so how i can set output high or low for that pin. How can i call canrx io control register ?.Can you write me an example for this to understand the tms570 register structure ? . As you know, the family is very different from tms320 family.

  • As I mentioned, DCAN TIOC register and RXOC register are used to set/clear the CANTX pin and CANRX pin (GIO mode).

    The values of the IO Control registers are only writable if Init bit of CAN Control Register is set.

    canREG2->CTL |= 0x00000001;
    canREG2->TIOC = (uint32)((uint32)1U << 18U )   /* CAN_TX pin*/
                                 | (uint32)((uint32)0U << 17U )
                                 | (uint32)((uint32)0U << 16U )
                                 | (uint32)((uint32)0U << 3U )     /*GIO mode*/
                                 | (uint32)((uint32)1U << 2U )     /*output*/
                                 | (uint32)((uint32)ti << 1U );       /*high*/

    canREG2->CTL &= 0xFFFFFFFE;