MPC5748G Flexcan Initialisation Probelm

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MPC5748G Flexcan Initialisation Probelm

跳至解决方案
2,060 次查看
Bobkat
Contributor II

Hi,

Have a board with a MPC5748G mcu and am having problems in initialising two of three FLEXCAN modules (CAN0, CAN1 and CAN7). The configuration is identical for all three modules, but can only initialise CAN0 successfully. The config for CAN0 is shown below:

const flexcan_user_config_t canCom1_InitConfig0 = {
.fd_enable = false,
.pe_clock = FLEXCAN_CLK_SOURCE_PERIPH,
.max_num_mb = 16,
.num_id_filters = FLEXCAN_RX_FIFO_ID_FILTERS_8,
.is_rx_fifo_needed = false,
.flexcanMode = FLEXCAN_NORMAL_MODE,
.payload = FLEXCAN_PAYLOAD_SIZE_8,
.bitrate = {
.propSeg = 7,
.phaseSeg1 = 4,
.phaseSeg2 = 1,
.preDivider = 4,
.rJumpwidth = 1
},
.bitrate_cbt = {
.propSeg = 7,
.phaseSeg1 = 4,
.phaseSeg2 = 1,
.preDivider = 4,
.rJumpwidth = 1
},
.transfer_type = FLEXCAN_RXFIFO_USING_INTERRUPTS,
.rxFifoDMAChannel = 0U
};

I'm using the peripheral clock as the clock source as there was a problem initialising the system clock when FXOSC was enabled.

I've checked the reference manual and while the clock source for CAN0 is slightly different to the other CAN modules, all frequencies seem to be correct, i.e. FS80, F40 etc.

I'm current using S32 SDK 3.0.0 (PA11) although this behaviour was also prevalent in S32 SDK 3.0.3 (PA15).

With regard to CAN1 and CAN7, the module initialisation gets stuck in the while loop in the  FLEXCAN_Enable() routine...

void FLEXCAN_Enable(CAN_Type * base)

{

    /* Check for low power mode */

    if(((base->MCR & CAN_MCR_LPMACK_MASK) >> CAN_MCR_LPMACK_SHIFT) == 1U)

    {

        /* Enable clock */

        base->MCR = (base->MCR & ~CAN_MCR_MDIS_MASK) | CAN_MCR_MDIS(0U);

        base->MCR = (base->MCR & ~CAN_MCR_FRZ_MASK) | CAN_MCR_FRZ(0U);

        base->MCR = (base->MCR & ~CAN_MCR_HALT_MASK) | CAN_MCR_HALT(0U);

        /* Wait until enabled */

        while (((base->MCR & CAN_MCR_NOTRDY_MASK) >> CAN_MCR_NOTRDY_SHIFT) != 0U) {}

    }

}

From what I can tell, it look like the NOTRDY flag is never cleared.

I would be most grateful for any help with this.

Best regards

Rob

0 项奖励
回复
1 解答
2,039 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Rob,

not sure if I can understand your description regarding the clocks but are you aware of this erratum? It sounds like possible root cause:

lukaszadrapa_0-1636355793222.pnglukaszadrapa_0-1636355793222.png

Regards,

Lukas

在原帖中查看解决方案

2 回复数
2,040 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Rob,

not sure if I can understand your description regarding the clocks but are you aware of this erratum? It sounds like possible root cause:

lukaszadrapa_0-1636355793222.pnglukaszadrapa_0-1636355793222.png

Regards,

Lukas

2,024 次查看
Bobkat
Contributor II

Hi Lukas,

Thanks for the information.

Yep. Sounds like what we were experiencing.

Couldn't try the workaround. Ended up replacing the 40Mhz crystal to get everything working.

Many thanks

 

Rob

0 项奖励
回复