Hello,
I am using the TM4C129X development board with the TM4C129XNZAD ARM processor. I have some project working on the board and now I am busy with the CAN bus but I have some problems.
first my setup:
I could send a message with CAN controller 1 but I can't receive any data on CAN controller 1.So when I transmit data over CAN controller 1 the signal on the CAN bus looks like this on the scope:
This is code I used:
tCANBitClkParms CANBitClk;
tCANMsgObject sMsgObjectRx;
tCANMsgObject sMsgObjectTx;
uint8_t pui8BufferIn[8];
uint8_t pui8BufferOut[8];
//enable port T
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOT);
			
//Configure the GPIO pin muxing to select CAN0/1 functions for these pins.
GPIOPinConfigure(GPIO_PT0_CAN0RX);
GPIOPinConfigure(GPIO_PT1_CAN0TX);
GPIOPinConfigure(GPIO_PT2_CAN1RX);
GPIOPinConfigure(GPIO_PT3_CAN1TX);
//enable the alternate function on the GPIO pins.
GPIOPinTypeCAN(GPIO_PORTT_BASE, GPIO_PIN_0);
GPIOPinTypeCAN(GPIO_PORTT_BASE, GPIO_PIN_1);
GPIOPinTypeCAN(GPIO_PORTT_BASE, GPIO_PIN_2);
GPIOPinTypeCAN(GPIO_PORTT_BASE, GPIO_PIN_3);
		
//The GPIO port and pins have been set up for CAN. The can peripheral must be enabled.
SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN1);
	
//
// Reset the state of all the message objects and the state of the CAN
// module to a known state.
//
CANInit(CAN0_BASE);
CANInit(CAN1_BASE);
//
// Configure the controller for 1 Mbit operation.
//
CANBitTimingSet(CAN0_BASE, &CANBitClk);
CANBitTimingSet(CAN1_BASE, &CANBitClk);
//CANBitRateSet(CAN0_BASE, SysCtlClockGet(), 500000);//when used this one, nothing happens on CANbus
//CANBitRateSet(CAN1_BASE, SysCtlClockGet(), 500000);
//
// Take the CAN0 device out of INIT state.
//
CANEnable(CAN0_BASE);
CANEnable(CAN1_BASE);
//
// Configure transmit message object.
//
sMsgObjectTx.ui32MsgID = 0x400;//33;//0x400;
sMsgObjectTx.ui32Flags = MSG_OBJ_NO_FLAGS;
sMsgObjectTx.ui32MsgLen = sizeof(pui8BufferOut);
sMsgObjectTx.pui8MsgData = pui8BufferOut;
	
//
// Configure a receive object.
//
sMsgObjectRx.ui32MsgID = 0x400;
sMsgObjectRx.ui32Flags = MSG_OBJ_NO_FLAGS;
		
while (1){
	CANMessageSet(CAN0_BASE, 1, &sMsgObjectTx, MSG_OBJ_TYPE_TX);
	
	//
	// Wait for new data to become available.
	//
	while((CANStatusGet(CAN1_BASE, CAN_STS_NEWDAT) & 1) == 0)
	{
		//
		// Read the message out of the message object.
		//
		CANMessageGet(CAN1_BASE, 1, &sMsgObjectRx, true);
		UARTprintf("Msg Obj=%u ID=0x%05X len=%u data=0x%d\n", 1,
				sMsgObjectRx.ui32MsgID, sMsgObjectRx.ui32MsgLen, sMsgObjectRx.pui8MsgData);
		}
	}
}
So is there anyone who has ideas what it could be or what I am doing wrong?
Thank you in advance!
Edwin