I am trying to initialize CAN0 on my LPC56416.
I am using functions from the fsl_mcan.c file that came with SDK_2.7.0_LPC54616J512.zip
I have this code.
---------------------------------
#include "LPC54616.h"
#include "fsl_mcan.h"
#define CAN_BAUD 500000
mcan_config_t *CAN0_config;
MCAN_GetDefaultConfig(CAN0_config);
MCAN_Init(CAN0, CAN0_config, CAN_BAUD);
---------------------------------
When MCAN_Init() calls MCAN_Reset(),
the INIT bit in CCCR never gets set and the program stays in the while loop FOREVER.
---------------------------------
static void MCAN_Reset(CAN_Type *base)
{
/* Set INIT bit. */
base->CCCR |= CAN_CCCR_INIT_MASK;
/* Confirm the value has been accepted. */
while (0U == (base->CCCR & CAN_CCCR_INIT_MASK))
{
}
/* Set CCE bit to have access to the protected configuration registers,
and clear some status registers. */
base->CCCR |= CAN_CCCR_CCE_MASK;
}
---------------------------------I tried adding an assignment within the while loop but this did not seem to help.
---------------------------------
while (0U == (base->CCCR & CAN_CCCR_INIT_MASK))
{
base->CCCR |= CAN_CCCR_INIT_MASK;
}---------------------------------
What am I doing wrong?ヽ(°〇°)ノ