在线时间0 小时
UID220641
注册时间2010-9-18
NXP金币0
该用户从未签到
新手上路

- 积分
- 122
- 最后登录
- 1970-1-1
|

楼主 |
发表于 2014-7-11 12:58:42
|
显示全部楼层
RE:有谁用Freescale提供的LIN 驱动开发LIN总线成功的?
用Freescale提供的插件配置LDF和NDF文件,用NCFGui中产生lin_cfg.c,lin_cfg.h,lin_hw_cfg.h时,
/* Number of schedule tables */
#define LIN_NUM_OF_SCHD_TBL 8
/* List of schedules */
typedef enum {
/* Interface_name = LI0 */
LI0_LIN_NULL_SCHEDULE
,LI0_GOTO_SLEEP_SCHEDULE
,LI0_MasterReqTable
,LI0_SlaveRespTable
,LI0_LIN_InitTable
,LI0_LIN_Comm
,LI0_LIN_Normal
,LI0_LIN_Error
}l_schedule_handle;
但是,在ling_cfg.c中
/********************* Schedule table structure Initialization ***************/
const lin_schedule_struct lin_schedule_tbl[LIN_NUM_OF_SCHD_TBL] ={
/*interface_name = LI0 */
{0, LIN_SCH_TBL_NULL ,(lin_schedule_data*)0 }
,{1, LIN_SCH_TBL_GOTO , &LI0_lin_gotosleep_data[0] }
,{7, LIN_SCH_TBL_NORM , &LI0_LIN_InitTable_data[0] }
,{3, LIN_SCH_TBL_NORM , &LI0_LIN_Comm_data[0] }
,{5, LIN_SCH_TBL_NORM , &LI0_LIN_Normal_data[0] }
,{2, LIN_SCH_TBL_COLL , &LI0_LIN_Error_data[0] }
};
这又是6, 为什么?为什么为自动产生下面两个表?
,LI0_MasterReqTable
,LI0_SlaveRespTable
应该是Freescale 的插件产生了错误!
l_u8 lin_schedule_start_entry[LIN_NUM_OF_SCHD_TBL] = {0, 0, 0, 0, 0, 0};
/****************************LIN interface configuration ****************************/
const lin_configuration lin_ifc_configuration[LIN_NUM_OF_IFCS] = {
/* Interface_name = LI0 */
{
LIN_PROTOCOL_21, /*lin_protocol_version */
LIN_PROTOCOL_21, /*lin_language_version */
9600, /* baud_rate */
_MASTER_, /* function _SLAVE_ | _MASTER_*/
0, /* node attribute is only used for slave node*/
/* LIN data pointer */
&lin_lld_response_buffer[LI0][0], /* *response_buffer */
&lin_successful_transfer[LI0], /* *lin_successful_transfer */
&lin_error_in_response[LI0], /* *lin_error_in_response */
&lin_goto_sleep_flg[LI0], /* *goto_sleep_flg */
&lin_current_pid[LI0], /* *current_pid */
&lin_word_status[LI0], /* *word_status */
/* Protocol */
20, /* 2*timebase */
&lin_diag_signal_tbl[LI0][0], /* *diag_signal_tbl */
13, /* num_of_frames */
0, /* frame_start */
&lin_frame_tbl[0], /* frame_tbl */
&lin_frame_flag_tbl[0], /* *frame_flg */
6, /* num_of_schedules */
0, /* schedule_start */
&lin_schedule_tbl[0], /* schedule_tbl */
&lin_schedule_start_entry[0], /* schedule_start_entry */
&lin_next_transmit[LI0], /* next_transmit_tick */
&lin_active_schedule_id[LI0], /* active_schedule_id */
&lin_previous_schedule_id[LI0], /* previous_schedule_id */
&lin_diag_frame_to_send[LI0], /* *diagnostic_frame_to_send */
DIAG_NONE, /* diagnostic_mode */
&LI0_lin_configuration_RAM[0], /* *configuration_RAM */
&LI0_lin_configuration_ROM[0], /* *configuration_ROM */
&lin_tl_desc[LI0]
}
};
改正方法
把上面的所列的调度表数目改为6之后(统一是6),LIN通讯正常。 |
|