CAN bus pin-out changes in BSP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CAN bus pin-out changes in BSP

507 Views
amleng
Contributor IV

Hello Community,

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.

        case 1:

            /* Configure GPIO for FlexCAN 1 peripheral function */

            //pctl = (PORT_MemMapPtr)PORTC_BASE_PTR;

            //pctl->PCR[17] = (PORT_PCR_MUX(2)|PORT_PCR_DSE_MASK);    /* CAN1_TX.C17  */

            //pctl->PCR[16] = (PORT_PCR_MUX(2)|PORT_PCR_DSE_MASK);    /* CAN1_RX.C16  */

          

/*fixme*/

            pctl = (PORT_MemMapPtr)PORTE_BASE_PTR;   

            pctl->PCR[24] = (PORT_PCR_MUX(2)|PORT_PCR_DSE_MASK);     /*CAN1_TX.E24*/

            pctl->PCR[25] = (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;

            break;

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?

Cheers!

Tags (5)
0 Kudos
1 Reply

262 Views
soledad
NXP Employee
NXP Employee

Hi amleng,

Have you solved your problem?

Regards

Sol

0 Kudos