Hi,
I'm working on tm4c123 and implementing the CAN protocol. Here i'm able to configure the gpio pins for CAN0 device. But when it is coming to initialization of CANCTL register, init bit is not getting set in the register. So controller is not moving to the next instruction. I'm using CCS 6.1.2, here is my code.
void CAN0_Init(void)
{
/* Setup the pins PB4 and PB5 of GPIO Port B for CAN0 Module */
/* PB5 = Tx, PB4 = Rx */
*SYSCTL_RCGC0 |= 0x01000000;
*SYSCTL_RCGC2 |= 0x00000002;
*GPIO_CR |= 0x30;
*GPIOB_AMSEL &= 0x00;
*GPIOB_DEN |= 0x30;
*GPIOB_DIR |= 0x20;
*GPIOB_AFSEL_PB |= 0x30;
*GPIOB_PCTL_PB = (*GPIOB_PCTL_PB & 0xFF00FFFF) + 0x00880000;
/* Initializa the CAN0 Module */
*CANCTL |= 0x01;
while(*CANIF1CRQ & 0x00008000);
/* Eanbling the loop back test mode */
*CANCTL |= 0x81; /* CAN controller is in Test Mode */
*CANTST |= 0x10;
/* Bit rate setting */
*CANCTL |= 0x40; /* Write access to the CANBIT register */
*CANBIT |= 0x0201;
/* No interrupts are used */
*CANCTL &= ~0x41; /* CAN controller is in test mode */
}
In the above code where i'm trying to write the CANCTL register, it is not getting write and moreover it is getting stuck to that point, i pointed by putting break point. Is anything wrong in the configuration of gpio pins for CAN0 module ???
I'm trying this code for loop back mode. Kindly resolve my issue
Thanks,
Venkatesh.