Hi,
I am using the FSL_LIN_2.x_STACK_Package_4.5.9 in S12VR64 MCU.
I test the examples (\FSL_LIN_2.x_STACK_Package_4.5.9\Examples\VR64_MagniV), and I change the code as following:
***************************************************************************************************************
// these code could be found in the VR64_Master_LIN21 project
for(;;) {
// if (l_flg_tst_LI0_Motor1Temp_flag()){
// /* Clear this flag... */
// l_flg_clr_LI0_Motor1Temp_flag();
// /* Store temperature data */
// Motor1_temp = l_u8_rd_LI0_Motor1Temp();
// /* The application will change Motor selection in case
// the temperature is greater than maximum value to release motor power */
// if (MOTOR1_OVER_TEMP<Motor1_temp) {
// /* Request stop motor by power off */
// l_u8_wr_LI0_Motor1Selection(MOTOR_SELECTION_STOP);
// } else if ((MOTOR1_MAX_TEMP<Motor1_temp)&(MOTOR1_OVER_TEMP > Motor1_temp)){
// /* Request to reduce motor speed */
// l_u8_wr_LI0_Motor1Selection(MOTOR_SELECTION_DECREASE);
// } else {
// /* Request to increase motor speed if user request */
// l_u8_wr_LI0_Motor1Selection(MOTOR_SELECTION_INCREASE);
// }
//}
Motor1_temp = l_u8_rd_LI0_Motor1Temp();
if (Motor1_temp>MOTOR1_MAX_TEMP)
{
flag = 0;
}
else if (Motor1_temp<MOTOR1_MIN_TEMP)
{
flag = 1;
}
if(flag)
{
l_u8_wr_LI0_Motor1Selection(MOTOR_SELECTION_INCREASE);
}
else
{
l_u8_wr_LI0_Motor1Selection(MOTOR_SELECTION_DECREASE);
}
}
******************************************************************************************************************
//then, in the VR64_slave_LIN21 project, the "l_flg_tst_LI0_Motor1Selection_flag()" is always false.
for(;;) {
/* Check if temp signal is updated */
if (l_flg_tst_LI0_Motor1Selection_flag()){
/* Clear this flag... */
l_flg_clr_LI0_Motor1Selection_flag();
/* Store selection data */
Motor1_Selection = l_u8_rd_LI0_Motor1Selection();
/* The application will change Motor selection in case
the temperature is greater than maximum value to release motor power
This will be transfered by sporadic frame type in LIN bus */
l_u8_wr_LI0_Motor1Temp(Motor1_temp);
/* Check if power off motor due to high temperature */
if (Motor1_Selection == MOTOR_SELECTION_STOP) {
/*---------- add code here to stop motor ------------*/
}
}
**************************************************************************************************************************
I didn't change the configuration in projects
Hi,
I'm unable to debug your code right now.
If I were you I would modify the the code step by step and check LIN bus communication.
Regards,
Daniel