AnsweredAssumed Answered

LIN FSL_LIN_2.x_STACK_Package_4.5.9 Issue if signal is split in multiple bytes

Question asked by Salman Shaikh on Jun 12, 2018
Latest reply on Jun 21, 2018 by Daniel Martynek

I am using LIN FSL_LIN_2.x_STACK_Package_4.5.9 package to implement a master LIN node on J2602. I am using ldf file provided by client for which I am facing issue in reading and writing lin_pFrameBuf using l_u8_rd(X) and l_u8_wr(X) functions.

For Sample, I have updated 'Demo_Cluster1.ldf' and added Test_Signal_1(5 bit) and Test_Signal_2(5 bit) from Slave2 to Gateway1. In Cluster1Slave2Info frame, I have added test signals as follows:

 Cluster1Slave2Info : 0x7, Slave2 , 4 {
   Cluster1Potentiometer2, 0;
   Cluster1Slave2Error , 8;
   Test_Signal_1,16; //Added for Testing
   Test_Signal_2,21; //Added for Testing
}

I created cfg.h file using NCFTool, Test_Signal_2 is splitted between byte 16 and byte 17. But while reading and writing to this data, only byte 16 is used.

 

#define LIN_BYTE_OFFSET_LI1_Test_Signal_2 16
#define LIN_BIT_OFFSET_LI1_Test_Signal_2 5
#define LIN_SIGNAL_SIZE_LI1_Test_Signal_2 5
#define LIN_FLAG_BYTE_OFFSET_LI1_Test_Signal_2 6
#define LIN_FLAG_BIT_OFFSET_LI1_Test_Signal_2 3
#define LIN_FLAG_UPDATE_BYTE_OFFSET_LI1_Test_Signal_2 8

 

/* static access macros for signal LI1_Test_Signal_2 */

#define l_u8_rd_LI1_Test_Signal_2() \
((l_u8) ((lin_pFrameBuf[LIN_BYTE_OFFSET_LI1_Test_Signal_2] & \
(((1U << LIN_SIGNAL_SIZE_LI1_Test_Signal_2) - 1) \
<< LIN_BIT_OFFSET_LI1_Test_Signal_2 )) >> LIN_BIT_OFFSET_LI1_Test_Signal_2))
#define l_u8_wr_LI1_Test_Signal_2(A) \
{lin_pFrameBuf[LIN_BYTE_OFFSET_LI1_Test_Signal_2] = \
((l_u8) (((l_u8) (lin_pFrameBuf[LIN_BYTE_OFFSET_LI1_Test_Signal_2] & \
((l_u8) (~(((1U << LIN_SIGNAL_SIZE_LI1_Test_Signal_2) - 1) << LIN_BIT_OFFSET_LI1_Test_Signal_2))))) | \
((l_u8) ((((1U << LIN_SIGNAL_SIZE_LI1_Test_Signal_2) - 1) & (A)) << LIN_BIT_OFFSET_LI1_Test_Signal_2))));\
lin_frame_flag_tbl[LIN_FLAG_UPDATE_BYTE_OFFSET_LI1_Test_Signal_2] = 1;}

 

I have attached the file i had used.

Attachments

Outcomes