Dear E2E,
I have a problem with CAN module on Tiva C microcontroller, I’m using the following configuration:
1) Using TM4C123GH6PM microcontroller with both CAN0 and CAN1 connected to two CAN transceivers sn65hvd1050
2) Since I don’t have CAN cable I’m using 1 meter pair from a CAT6 cable and replaced the 120 ohm resistor with 100 ohm to match the cable
3) The board is based on my design however the CAN section of the board is based on the TM4C123G Kit from TI
4) I’m using the CAN example for the TM4C123G Kit after doing the required modifications to work with my processor TM4C123GH6PM
5) My target is to be able to send CAN messages from either modules (CAN0 and CAN1) to the other as a first step for further development
I used the following code to setup CAN0:
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY; // to unlock port PF0 HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= 0x01; HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = 0; GPIOPinConfigure(GPIO_PF0_CAN0RX); GPIOPinConfigure(GPIO_PF3_CAN0TX); GPIOPinTypeCAN(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_3); SysCtlPeripheralDisable(SYSCTL_PERIPH_CAN0); SysCtlPeripheralReset(SYSCTL_PERIPH_CAN0); SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN0); CANInit(CAN0_BASE); CANBitTimingSet(CAN0_BASE, &CANBitClk); //CANBitRateSet(CAN0_BASE, SysCtlClockGet(), 50000); CANIntEnable(CAN0_BASE, CAN_INT_MASTER | CAN_INT_ERROR | CAN_INT_STATUS); // Enable the CAN interrupt on the processor (NVIC). IntEnable(INT_CAN0); CANEnable(CAN0_BASE);
I used the following code to setup CAN1:
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); GPIOPinConfigure(GPIO_PA0_CAN1RX); GPIOPinConfigure(GPIO_PA1_CAN1TX); GPIOPinTypeCAN(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); SysCtlPeripheralDisable(SYSCTL_PERIPH_CAN1); SysCtlPeripheralReset(SYSCTL_PERIPH_CAN1); SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN1); CANInit(CAN1_BASE); CANBitTimingSet(CAN1_BASE, &CANBitClk); //CANBitRateSet(CAN1_BASE, SysCtlClockGet(), 50000); CANIntEnable(CAN1_BASE, CAN_INT_MASTER | CAN_INT_ERROR | CAN_INT_STATUS); // Enable the CAN interrupt on the processor (NVIC). IntEnable(INT_CAN1); CANEnable(CAN1_BASE);
My problem is:
I never got a correct communication I always get the error reg “ui32Status” with a value of 0x000000E5
I did several trials to solve this error but none of them worked, I don’t know what shall I do or how can I get a better understanding of the problem to solve it.
Any support is highly appreciated.
Mina.