here we were developing CAN2 rx, tx code in evk mimxrt1050, so we have query that what is use of CAN_STBY? how to configure?
here we configure FlexCAN2 pin and STB pin below:
static void CAN2_init(void) {
FLEXCAN_Init(CAN2_PERIPHERAL, &CAN2_config, CAN2_CLOCK_SOURCE);
/* Message buffer 9 initialization */
FLEXCAN_SetRxMbConfig(CAN2_PERIPHERAL, 9, &CAN2_rx_mb_config_0, true);
/* Message buffer 10 initialization */
FLEXCAN_SetTxMbConfig(CAN2_PERIPHERAL, 10, true);
FLEXCAN_SetRxIndividualMask(CAN2_PERIPHERAL, 9, FLEXCAN_RX_MB_STD_MASK(0x1AA, 0, 0));
}
also we set below parameter for CAN INIT anf MB configuration:
const flexcan_config_t CAN2_config = {
.wakeupSrc = kFLEXCAN_WakeupSrcUnfiltered,
.bitRate = 1000000UL,
.maxMbNum = 16U,
.enableLoopBack = false,
.enableTimerSync = true,
.enableSelfWakeup = false,
.enableIndividMask = false,
.disableSelfReception = false,
.enableListenOnlyMode = false,
.enableSupervisorMode = false,
.timingConfig = {
.preDivider = 2,
.propSeg = 1,
.phaseSeg1 = 3,
.phaseSeg2 = 2,
.rJumpwidth = 1
}
};
/* Message buffer 0 configuration structure */
const flexcan_rx_mb_config_t CAN2_rx_mb_config_0 = {
.id = FLEXCAN_ID_STD(0x1AA),
.format = kFLEXCAN_FrameFormatStandard,
.type = kFLEXCAN_FrameTypeData
};
also we use interrupt feature, code is below:
FLEXCAN_EnableMbInterrupts(CAN2_PERIPHERAL,9);
/* Enable interrupt CAN1_IRQn request in the NVIC. */
EnableIRQ(CAN2_IRQn);
also write a ISR function below:
Hello @Maheshkadam9922,
what is use of CAN_STBY? how to configure?
In IMXRT1050-EVKB's schematic the GPIO_AD_B0_05 goes to CAN_STBY, Flash_RST and BOOT_MODE[1].
[IMXRT1050-EVKB schematic p5]
CAN_STBY goes to TJA1057 High-speed CAN transceiver's pin S which is used to select the operating mode of the transceiver between Normal and Silent.
[IMXRT1050-EVKB schematic p8]
Nonetheless, if you look closely to the schematic, CAN_STBY is open due the absence of R92 (DNP - Do not populate). If you want to use this functionality you may want to place a resistor in your EVK, in other case, CAN will work in Normal mode as Pin S is set to Low.
[TJA1057 Product data sheet. Table 2. Boot mode pin settings]
For further information about the TJA1057 you could read the Product data sheet here.
issue that our TX ,RX function not receive
Could you please try your code without configuring CAN_STBY (GPIO_AD_B0_05)?
GPIO_AD_B0_05 in the EVK goes to BOOT_MODE[1] is necessary for the EVK to boot, because is used to select which boot mode will be used. Using the same pin in other way may cause conflict in the EVK.
[MIMXRT1050 EVK Board Hardware User's Guide. Table 2. Boot Mode pin settings]
Best regards, Raul.