I'm testing the lin_master_s32k116 example.
In this example, the temperature of the motor is read through LIN communication.
It also controls the motor speed according to the temperature.
How is g_lin_frame_data_buffer defined in lin_cfg created through this project?
I didn't quite understand.
And I changed the example and made the code as below.
void lin_master_task(void)
{
/* Initialize LIN network interface */
l_sys_init();
l_ifc_init(LI0);
/* Set Schedule table to Normal */
l_ifc_wake_up(LI0);
l_sch_set(LI0, LI0_Normal_Schedule, 0u);
/* Infinite loop */
for (;;) {
/* Check if information about the Motor1 Temp has been received */
if (l_flg_tst_LI0_MOTOR_byTemperature_flag()) {
/* Clear this flag... */
l_flg_clr_LI0_MOTOR_byTemperature_flag();
/* Store temperature data */
Motor1_Temp = l_u8_rd_LI0_MOTOR_byTemperature();
//debugConsolePrintf(Motor1_voltage);
}
/* Check node state */
if (LIN_NODE_STATE_SLEEP_MODE == lin_lld_get_state(LI0)) {
/* Turn off all LEDs */
l_ifc_wake_up(LI0);
l_sch_set(LI0, LI0_Normal_Schedule, 0u);
PINS_DRV_TogglePins(LED0_GPIO_PORT, PORT_LED0_INDEX);
}
}
}
When I debugged it,
LIN_NODE_STATE_IDLE,
LIN_NODE_STATE_SEND_BREAK_FIELD
LIN_NODE_STATE_RECV_DATA
It appears as these three states change, and the flag check of the if statement does not even pass. (if (l_flg_tst_LI0_MOTOR_byTemperature_flag()) )
The order of Lin communication is
1. flag check
2. flag clear
3. read data
Is this correct?
please check.
thank you.