Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
AdRainty
rt-thread
提交
05afaa9f
R
rt-thread
项目概览
AdRainty
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
05afaa9f
编写于
9月 07, 2022
作者:
o777788
提交者:
GitHub
9月 06, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[imxrt1170]Fix flexcan driver (#6378)
fix flexcan driver for imxrt1170
上级
5967ce44
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
26 addition
and
4 deletion
+26
-4
bsp/imxrt/libraries/MIMXRT1170/MIMXRT1176/drivers/fsl_flexcan.c
...xrt/libraries/MIMXRT1170/MIMXRT1176/drivers/fsl_flexcan.c
+2
-3
bsp/imxrt/libraries/drivers/drv_can.c
bsp/imxrt/libraries/drivers/drv_can.c
+24
-1
未找到文件。
bsp/imxrt/libraries/MIMXRT1170/MIMXRT1176/drivers/fsl_flexcan.c
浏览文件 @
05afaa9f
...
...
@@ -3475,12 +3475,11 @@ void FLEXCAN_TransferCreateHandle(CAN_Type *base,
/* Get instance from peripheral base address. */
instance
=
(
uint8_t
)
FLEXCAN_GetInstance
(
base
);
/* Save the context in global variables to support the double weak mechanism. */
s_flexcanHandle
[
instance
]
=
handle
;
/* Register Callback function. */
handle
->
callback
=
callback
;
handle
->
userData
=
userData
;
/* Save the context in global variables to support the double weak mechanism. */
s_flexcanHandle
[
instance
]
=
handle
;
s_flexcanIsr
=
FLEXCAN_TransferHandleIRQ
;
...
...
bsp/imxrt/libraries/drivers/drv_can.c
浏览文件 @
05afaa9f
...
...
@@ -29,6 +29,10 @@
static
flexcan_frame_t
frame
[
RX_MB_COUNT
];
/* one frame buffer per RX MB */
static
rt_uint32_t
filter_mask
=
0
;
#ifdef SOC_IMXRT1170_SERIES
#define USE_IMPROVED_TIMING_CONFIG (1U)
#endif
enum
{
#ifdef BSP_USING_CAN1
...
...
@@ -102,13 +106,16 @@ uint32_t GetCanSrcFreq(CAN_Type *can_base)
return
freq
;
}
#ifdef SOC_IMXRT1170_SERIES
static
void
flexcan_callback
(
CAN_Type
*
base
,
flexcan_handle_t
*
handle
,
status_t
status
,
uint64_t
result
,
void
*
userData
)
#else
static
void
flexcan_callback
(
CAN_Type
*
base
,
flexcan_handle_t
*
handle
,
status_t
status
,
uint32_t
result
,
void
*
userData
)
#endif
{
struct
imxrt_can
*
can
;
flexcan_mb_transfer_t
rxXfer
;
can
=
(
struct
imxrt_can
*
)
userData
;
switch
(
status
)
{
case
kStatus_FLEXCAN_RxIdle
:
...
...
@@ -171,6 +178,22 @@ static rt_err_t can_cfg(struct rt_can_device *can_dev, struct can_configure *cfg
case
RT_CAN_MODE_LOOPBACKANLISTEN
:
break
;
}
#ifdef SOC_IMXRT1170_SERIES
flexcan_timing_config_t
timing_config
;
memset
(
&
timing_config
,
0
,
sizeof
(
flexcan_timing_config_t
));
if
(
FLEXCAN_CalculateImprovedTimingValues
(
can
->
base
,
config
.
baudRate
,
GetCanSrcFreq
(
can
->
base
),
&
timing_config
))
{
/* Update the improved timing configuration*/
memcpy
(
&
(
config
.
timingConfig
),
&
timing_config
,
sizeof
(
flexcan_timing_config_t
));
}
else
{
LOG_E
(
"No found Improved Timing Configuration. Just used default configuration
\n
"
);
}
#endif
FLEXCAN_Init
(
can
->
base
,
&
config
,
GetCanSrcFreq
(
can
->
base
));
FLEXCAN_TransferCreateHandle
(
can
->
base
,
&
can
->
handle
,
flexcan_callback
,
can
);
/* init RX_MB_COUNT RX MB to default status */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录