I have a customized board using K60F120 MCU and MQX 4.02. In my board, CAN1_TX and CAN1_RX lines are connected to PTE24 and PTE25 respectively. I modified _mqx_int _bsp_flexcan_io_init() in init_gpio.c to follow these hardware changes.
/* Configure GPIO for FlexCAN 1 peripheral function */
//pctl = (PORT_MemMapPtr)PORTC_BASE_PTR;
//pctl->PCR = (PORT_PCR_MUX(2)|PORT_PCR_DSE_MASK); /* CAN1_TX.C17 */
//pctl->PCR = (PORT_PCR_MUX(2)|PORT_PCR_DSE_MASK); /* CAN1_RX.C16 */
pctl = (PORT_MemMapPtr)PORTE_BASE_PTR;
pctl->PCR = (PORT_PCR_MUX(2)|PORT_PCR_DSE_MASK); /*CAN1_TX.E24*/
pctl->PCR = (PORT_PCR_MUX(2)|PORT_PCR_DSE_MASK); /*CAN1_RX.E25*/
/* Enable clock gate to FlexCAN 1 module */
sim->SCGC3 |= SIM_SCGC3_FLEXCAN1_MASK;
/* Select the bus clock as CAN engine clock source */
can_reg_ptr = _bsp_get_flexcan_base_address(1);
can_reg_ptr->CTRL1 |= CAN_CTRL1_CLKSRC_MASK;
Since I use CAN1 I changed case (1) only.
Unfortunately evwen after these changes, I cannot get any data from CAN bus! I noticed that in twrk60f120m these pins are connected to a 12 MHz crystal which is Alt0. I assume the above changes in the init_gpio.c should overwrites the default configuration. right? Is there any other settings I need to consider? Any suggestion?