Hello
I have a question, I generate LIN code using s32ds in s32k118
why it doesn't have date protection, like disable interruption, enable interruption
Solved! Go to Solution.
Hi liuxing_hu,
From my point of view, maybe this signal has been updated by other one.
Anyway, I tried on my site with the same that you are working. It seem it is working normally. I would like to share with you some information as below:
I also share my ldf file that I using to test(Attachment).
So, please recheck on your site. And if the problem is still not resolved, let share your project or *ldf file. Maybe I will try to test on my site.
Thanks,
Diep
May I know if there are any reference documents or APIs available for using an LDF file in S32 Design Studio? Thank you!
Hi liuxing_hu,
As far as I know, this is the definition that is used to write the signal to the data buffer.
The data transferred on the bus is old data or new data depending on when the data was written.
Please refer to chapter 2.2 of LIN_Specification_Package_2.2A.pdf for more details.
The driver code has implemented this feature. So we don't need to protect data here.
Thanks,
Diep
Hello Diep_TrinhXuan
Thanks for you response, Could you give me the link of LIN_Specification_Package_2.2A.pdf ?
and is there any API in LIN stack that can be used by Application to know whether slave node had received msg from master node ? because application will add 1 to RollingCounter signal when received msg from master node.
Hi @liuxing_hu,
I would like to share with you the link of LIN_Specification_Package_2.2A.pdf.
You can use the definition that is signal flag APIs in the lin_stack_cfg.h to check when the signal is updated.
Thanks,
Diep
Hello Diep_TrinhXuan
thanks for you response.
do you mean these API? what do the return value of l_flg_tst_LI0_RollingCounter_0x10_flag and l_flg_clr_LI0_RollingCounter_0x10_flag stand for ? I don't know how to use, is there an example ?
Hi @liuxing_hu ,
I would like to share with you an example about how to check when the signal is updated as below:
/* Infinite loop */
for (;;)
{
/* Check if information about the signal has been received */
if (l_flg_tst_LI0_RollingCounter_0x10_flag())
{
/* Clear this flag... */
l_flg_clr_LI0_RollingCounter_0x10_flag();
/* Do something */
}
}
Thanks,
Diep
Hello Diep_TrinhXuan
thanks for you response.
I will try your example.
from the example, when l_flg_tst_LI0_RollingCounter_0x10_flag() return TRUE, means slave node has received msg from master node, and application can write the signal to the data buffer ?
Hi liuxing_hu,
from the example, when l_flg_tst_LI0_RollingCounter_0x10_flag() return TRUE, means slave node has received msg from master node, and application can write the signal to the data buffer ?
[Diep] That is mean the slave node received the msg from master node. And then the RollingCounter_0x10 signal was updated into data buffer with the value that it received in frame.
For example:
The message that ID is 0x30 there is a signal of The Motor1Selection. The message is transmitted by master node(SeatECU) and received by slave node(Motor1). After slave node received the message form master node, l_flg_tst_LI0_Motor1Selection_flag() will return True and the Motor1Slelection signal will be updated with a value of 1.
For more detail about signal management, please refer to chapter 2.2 of Lin Specification.
Thanks,
Diep
Hello Diep_TrinhXuan
thanks for your detailed information, I will see the LIN spec when I have time, now we have a urgent problem, so it probably more direct to ask you. I am sorry to trouble you.
my case is a litter different with your example
signal RollingCounter is transmitted by slave node(SWSL_send), RollingCounter add 1 every time when slave node received msg from master, so I need this RollingCounter signal flag to decide when to add, and it works well,
but I see another flag l_flg_tst_LI0_SWSL_send_flag(), what's the difference between l_flg_tst_LI0_SWSL_send_flag() and l_flg_tst_LI0_RollingCounter_0x10_flag ?
Hi liuxing_hu,
Based on your information, I would like to share with you my answer as follows:
signal RollingCounter is transmitted by slave node(SWSL_send), RollingCounter add 1 every time when slave node received msg from master, so I need this RollingCounter signal flag to decide when to add, and it works well,
[Diep] For your example, I think you need to check the frame flag or signal flag of the frame that slave node received from master instead of RollingCounter signal flag.
Please note that we should clear the flag after checking to wait for the next frame.
but I see another flag l_flg_tst_LI0_SWSL_send_flag(), what's the difference between l_flg_tst_LI0_SWSL_send_flag() and l_flg_tst_LI0_RollingCounter_0x10_flag ?
[Diep] l_flg_tst_LI0_SWSL_send_flag() is the flag of frame. The flag of frame is set when the frame is transmitted/received.
l_flg_tst_LI0_RollingCounter_0x10_flag() is the flag of the signal. The flag of the signal is set when transmitted/received and it is cleared when set by the application.
Thanks,
Diep
Hello Diep_TrinhXuan
thanks for your information, I have a problem when using master flag, I want to make RollingCounter add 1 when receive master flag, so code is below
keep mater node send msg, I power off the slave node, then I power on the slave node, the RollingCounter sent by slave have the following problem in the first/second frame
the correct RollingCounter shall be 0, 1, 2, 3,4, not 0, 0, 1, 2, 3
I guess it is a sequential problem, slave node have respond the msg after receiving master msg before application detect the flag is 1, so it's late to write the RollingCounter signal to the data buffer.
so do you have any suggestions?
Hi liuxing_hu,
A key property of the LIN protocol is the use of schedule tables. That is mean all frames in the table will be transmitted sequentially.
So in my view it is possible that LIN_Slave_SWSL_send was sent before. And then RollingCounter signal is sent with value init(value = 0).
If your problem is not resolved, please share me a image that contain all the frames that transmitted and received on bus.
Thanks,
Diep
Hello Diep
here is the a image that contain all the frames that transmitted and received on bus,
the responseError in the first msg id 0x10 is 1
the responseError in the second msg id 0x10 is 0
Hi liuxing_hu,
As far as I know, responseError(response_error ) is a special signal and it is also handled by LIN driver code.
The response_error signal shall be set whenever a frame (except for event triggered frame responses) that is transmitted or received by the slave node contains an error in the frame response.
The response_error signal shall be cleared when the unconditional frame containing the response_error signal is successfully transmitted.
Please refer to chapter 2.7.3 of LIN_Specification_Package_2.2A.pdf for more details.
Thanks,
Diep
Hello Diep
the response error is only a referred information given for RollingCounter, means the status of slave node is not ok.
do you know why the RollingCounter is 0 in the first/second frame message from the image ? or because the response error is 1 in the first frame, so the RollingCounter vaule in the first frame is unreliable ?
Hi liuxing_hu,
From my point of view, maybe this signal has been updated by other one.
Anyway, I tried on my site with the same that you are working. It seem it is working normally. I would like to share with you some information as below:
I also share my ldf file that I using to test(Attachment).
So, please recheck on your site. And if the problem is still not resolved, let share your project or *ldf file. Maybe I will try to test on my site.
Thanks,
Diep