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.

TMS570LS1224: Using CAN Tx and Rx pins as GPIO in HALCoGen / CCS (TMS570LS1224)

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN

Tool/software:

Hello,

I need to use the CAN Tx and CAN Rx lines as GPIOs. I can configure them in HALCoGen, but I can't find the corresponding functions in CCS to use them, like I do with gioSetBit(hetPORT1, 18, 0) or gioSetBit(linPORT, 1, 0).
I found the functions canIoTxGetBit() and canIoRxGetBit(), but as far as I understand, they are intended for checking the state of CAN pins during transmission tests.

Could someone please help me with this?
Thank you very much!

Ariel

  • Hi Ariel,

    The CAN port is not given because,

    If you verify other peripherals like I2C, SPI etc, there we have different pin registers for Pin direction, Input status register, output register, SET register, clear register etc like as shown below:

    If we have these registers, then we can simply type cast the starting address of these registers with "gioPORT_t" like as shown below:

    So, once we did type cast then we can call gioSetDirection, gioSetBit etc API's with casted structure example "i2cPORT1".

    For CAN we don't have these registers, instead of we have only two CAN registers to control IO functionality. One register to control CAN TX pin and other for CAN RX pin.

    So here, it is not possible to type cast the registers into "gioPORT_t", and we can't use GIO API's that mentioned above.

    Instead of you can create your own API's:

    As you can see here, we have bits for all the IO functionalities, you can configure direction, you have bit for to SET or CLR the GIO and you have bit to read the input status etc. So, you can just use these bits to implement GIO functionality.

    --
    Thanks & regards,
    Jagadish.

  • Hello Jagadish

    Thanks again for your valuable input. I now understand the logic behind implementing the CAN ports as GPIO. I really appreciate your help!