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/TM4C123GH6PZ: USB module and Can module question;

Part Number: TM4C123GH6PZ

Tool/software: Code Composer Studio

Hi TI:

1. usb

I put the USB module  of TM4C123GH6PZ into device mode using USB_EP_1 and USB_EP_2 both IN and OUT; 

what is the endpoint num for host to indentify these endpoints?

is (USB_EP_1*2 + 0) for TX and (USB_EP_1*2 + 1) for rx ?

2. I open the two can interfaces of TM4C123GH6PZ,to initialize them i use the following code:

   Is this code correct?

   can0 and can1 has the pin definition as GPIO_PE4_CAN0RX, GPIO_PE5_CAN0TX, GPIO_PB4_CAN0RX, GPIO_PB5_CAN0TX, does this definition refer to can0 and can1?

void
CANInit(uint8_t CanIndex)
{
if(0x0 == CanIndex){
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);

GPIOPinConfigure(GPIO_PE4_CAN0RX);
GPIOPinConfigure(GPIO_PE5_CAN0TX);

GPIOPinTypeCAN(GPIO_PORTE_BASE, GPIO_PIN_4 | GPIO_PIN_5);

SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN0);

CANInit(CAN0_BASE);
}else if(0x1 == CanIndex){
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

GPIOPinConfigure(GPIO_PB4_CAN0RX);
GPIOPinConfigure(GPIO_PB5_CAN0TX);

GPIOPinTypeCAN(GPIO_PORTE_BASE, GPIO_PIN_4 | GPIO_PIN_5);

SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN1);

CANInit(CAN1_BASE);
}

.......
}

Thanks 

  • Hi,

      

    Yao Aili said:

    is (USB_EP_1*2 + 0) for TX and (USB_EP_1*2 + 1) for rx ?

     Please see below description. Basically, there is a endpoint X for IN and a endpoint X for OUT pipe.  For example, you can configure endpoint 7 OUT pipe for bulk transfer while endpoint 7 IN pipe for interrupt transfer.

    Yao Aili said:
     can0 and can1 has the pin definition as GPIO_PE4_CAN0RX, GPIO_PE5_CAN0TX, GPIO_PB4_CAN0RX, GPIO_PB5_CAN0TX, does this definition refer to can0 and can1?

      Please refer to the below signal mapping for CAN0 and CAN1. I don't see you configure the CAN1 pins in your code. You cannot use PB4/4 for CAN1.