CAN中断接收问题

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

CAN中断接收问题

4,893 Views
liqing
Contributor II

CAN中断中;
CAN配置为const flexcan_user_config_t canCom1_InitConfig1 = {
.fd_enable = false,//启用/禁用灵活数据速率功能
.pe_clock = FLEXCAN_CLK_SOURCE_SOSCDIV2,//CAN时钟源
.max_num_mb = 16,//消息缓冲区的最大数目
.num_id_filters = FLEXCAN_RX_FIFO_ID_FILTERS_8,//需要的RX FIFO ID过滤器的数目 
.is_rx_fifo_needed = false,//1启用; 0停用。这可以控制Rx FIFO功能是否启用
.flexcanMode = FLEXCAN_NORMAL_MODE,//用户可配置的FlexCAN操作模式, FLEXCAN_NORMAL_MODE;正常模式或用户模式;FLEXCAN_LISTEN_ONLY_MODE:只听模式;
                                     //FLEXCAN_LOOPBACK_MODE: 环回模式; FLEXCAN_FREEZE_MODE睡眠)冻结模式;FLEXCAN_DISABLE_MODE 模块禁用模式
.payload = FLEXCAN_PAYLOAD_SIZE_8,//指定的邮箱的有效载荷字节大小
.bitrate = {           //用于标准帧的比特率或FD帧的仲裁阶段
.propSeg = 7,//传播段 
.phaseSeg1 = 4,//相位段1
.phaseSeg2 = 1,//相位段2
.preDivider = 0,//时钟分频器分因子 
.rJumpwidth = 1 //同步跳转宽度
},
.bitrate_cbt = { //用于FD帧的数据阶段的比特率
.propSeg = 7,//传播段
.phaseSeg1 = 4,//相位段1
.phaseSeg2 = 1,//相位段2
.preDivider = 0,//时钟分频器分因子 
.rJumpwidth = 1//同步跳转宽度
},

采用16通道接收,  FLEXCAN_DRV_ConfigRxMb(0,16, &dataInfo, 0x1800FCF4);//配置接收FlexCAN0(Rx)消息缓冲区
中断配置为:          INT_SYS_EnableIRQ(CAN0_ORed_16_31_MB_IRQn);//为给定的IRQ号码启用中断 
                    INT_SYS_SetPriority(CAN0_ORed_16_31_MB_IRQn,0U);//设置中断优先级。
采用17通道发送:FLEXCAN_DRV_ConfigTxMb(0,17,&tx_info,0x12);//FlexCAN发送消息缓冲区配置。
                       FLEXCAN_DRV_Send(0U,17U,&tx_info,0x18f0000f,mb_data );//FlexCAN0发送消息

为什么接收没有进入void CAN0_ORed_16_31_MB_IRQHandler(void)
{
    FLEXCAN_IRQHandler(0U);
           
}

发送却时进入了:void CAN0_ORed_16_31_MB_IRQHandler(void)
{
    FLEXCAN_IRQHandler(0U);
           
}

3 Replies

4,324 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

seems you enable only first 16 message buffers (MB0-MB15), but use MB16 and MB17 for RX and TX operation.

This will not work. What is the status driver functions return?

Try to use MB with number between 0-15 or increase anount of MB used for communication, defined by "max_num_mb". 

BR, Petr

4,324 Views
liqing
Contributor II

I've solved it. Thank you!

0 Kudos
Reply

2,930 Views
huaqingren
Contributor I

hello,

A issue is reproduced. Would share  the mitigation how to fix the issue, thank you.

0 Kudos
Reply
An error has occurred when reading existing sub-variable "Language_PG_Configuration"; see cause exception! The type of the containing value was: extended_hash+string (lithium.coreapi.webui.template.models.NamedValueByNameTemplateModel wrapped into f.e.b.StringModel) ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign redirect_lingo_page_url = web... [in template "language_macro_header.ftl" at line 173, column 1] - Reached through: #include "language_macro_header.ftl" [in template "Language_translator_Dashboard" at line 3, column 1] ----