How to determin if LIN command from master is off by using S12ZVM LIN stack ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to determin if LIN command from master is off by using S12ZVM LIN stack ?

2,523 Views
NoahXu
Contributor III

hello, support 

 how can i detect if LIN command from LIN master is off by using S12ZVM LIN stack ?

 is there any flag i can use if the master stop sending out LIN command to slave?

i am now using the S12ZVM LIN stack .

thanks!

Tags (1)
0 Kudos
25 Replies

446 Views
NamLe
NXP Employee
NXP Employee

Hi NoahXu,

I've tried to have a call with PM of LIN Stack. There're 2 proposed next steps from him:

  1. Check if idle_timeout_cnt is being decremented while there is no bus activity.
    1. If this does not happen, it needs to be debugged why.
  2. Test with demo examples already provided in the LIN STACK
    1. Test that application is reaching SLEEP state

NamLe_0-1712305307021.png

From expectation, the idle_timeout_cnt will be decremented and the state should return SLEEP_MODE after few seconds when you disconnect LIN master (no bus activity)

After got the results of these, if unexpected results, i want to setup a debug call directly with you.

Please help me to try these two suggestions checking first.

Thank you,

Nam.

0 Kudos

2,187 Views
NamLe
NXP Employee
NXP Employee

Hi NoahXu,

I got informed that this below function will count the timeout

Namm_0-1705029289527.png

Once the function reaches the timeout, it'll call the Gotosleep function, then the flag of Gotosleep should be set and then if you call the get status function, it should return the set flag.

Please set a breakpoint at this line and observe the bit lin_goto_sleep_flg be set or not.

Namm_1-1705030931624.png

The state from IDLE will be changed to SLEEP_MODE if the timeout_cnt be counted down to 0.

After that, the lin_word_status.word will be updated through lin_update_word_status_lin

Namm_2-1705031121632.png

If you still can not run it, please share detail of your project and information that i ask before, so i will transfer to your team for directly checking.

Thank you,

Nam.

0 Kudos

2,150 Views
NoahXu
Contributor III

Hi, Namm

i attached the AN5201SW-LIN BLDC , you can use this demo for debug.

i checked this demo and still no value change. (i delete the changes i made for test, you can add variables as flags to indicate the value of “i_ifc_linstatus”)

 

 

0 Kudos

2,146 Views
NamLe
NXP Employee
NXP Employee

Hi NoahXu,

Thanks for your sharing.

Please share also your implement code for i_ifc_linstatus. We will check whether your code is working or not.

Please give me detail about devices setup (master-slave), name of chip/derivative and version of LIN Stack that you're using.

Thank you,

Nam.

0 Kudos

2,087 Views
NoahXu
Contributor III

Namm,

can you arrange your time for meetings to disscuss with your college? 

chip: S12ZVML64

LIN STATCK:  LIN_stack_S12_4_6_6_210629

setup: master to slave by vector cancase 

code:attached

0 Kudos

2,084 Views
NamLe
NXP Employee
NXP Employee
Hi,
Thanks for your sharing.
I'll send this to our team for investigation and feedback you asap.
Thank you,
Nam.
0 Kudos

1,296 Views
NoahXu
Contributor III

Hi,Namm

do we have some conclusion on the investigation  after you received my code?

0 Kudos

1,267 Views
NamLe
NXP Employee
NXP Employee

Hi NoahXu,

I've already transfered your project to my collegue but still on progress of checking.

Let me ask him check it asap and i will feedback to you when i have his investigation.

Thank you,

Nam.

0 Kudos

2,098 Views
NoahXu
Contributor III

Hello,Namm 

i am okay with that.

when are you available?   i think it is better to arrange a teams meeting to show you,it is more efficient.

are you okay?

0 Kudos

2,094 Views
NamLe
NXP Employee
NXP Employee

Hi NoahXu,

I'm actually not familiar with Lin Stack so maybe meeting will not work, but i will transfer your project to an expert developer for checking.

Basically, you just share your project here (the project that you run test of function i_ifc_linstatus and failed), information of mcu - linstack that you're using.

Thank you,

Nam. 

0 Kudos

2,124 Views
NoahXu
Contributor III

Namm,

can you add those flags by yourself? it is just like "flag1= i_ifc_linstatus()"

the project i shared is an original software package from the community which related to AN5201.

On this common base we can avoid any unnecessary changes made by myself.

 

About the setup, you can do it in any method you like, if you made it success then you can share with me , i will follow your setup. i just connect the lin line of the ECU to the CANcase of vector . it is common setup and the messages can be sent and received.

About the MCU version , you can flash the software to any LIN version S12Z demo board you have,  if you made it success then you can share with me , i will follow you.

About the version of  lin stack, i think it is LIN_stack_S12_4_6_6_210629 , but it doesnot matter .you can integrate any version you think is ok to demostrate the function you described before.  if you made it success then you can share with me , i will follow you.

 

any way ,thank you. i 'll wait for you meassge.

 

0 Kudos

2,120 Views
NamLe
NXP Employee
NXP Employee

Hi NoahXu,

Thanks for your response.

I also want you implement the function i_ifc_linstatus(), please spend a little time for it. Because we want to check your implementation and configuration basically.

I want to know your exact devices, mcu and lin stack. We will check depend on your side, not integrate or make it work with our side.

Please consider sharing your current status.

Sorry for any inconveniences causes to you.

Thank you,

Nam.

0 Kudos

2,119 Views
NamLe
NXP Employee
NXP Employee
Please be aware that we check with your project and your implementation, with your setup devices and tools.
Thank you,
Nam.
0 Kudos

2,340 Views
NamLe
NXP Employee
NXP Employee

Hi NoahXu,

In Lin stack specs, there's a note of this one when master bus was down or inactive atleast 4s to 10s.

Namm_0-1704447974902.png

This parameter can be configured here

Namm_1-1704447999558.png

So after this time, the go to sleep bit should set to 1.

Please help me to check and try again.

Thank you,

Nam.

0 Kudos

2,313 Views
NoahXu
Contributor III

Hi, Namm

 yes, it is a point we should consider.

i checked the "lin_Status " value after 10s and no change happened.

Do yo have some demo examples that can share with me?   or can you  just use the lin stack to write some simple code to demonstrate your idea on this topic? 

0 Kudos

2,264 Views
NamLe
NXP Employee
NXP Employee

Hi NoahXu,

I'm lacking of devices right now so it's hard to test a sample app for this. But i'll try to ask someone else.

Did you see any header frames send out from the master when you already turn off the "LIN scheduler on/off simulated by tools like Canoe"

Because in slave side, when there's no header frame request from master, the slave goes to sleep mode automatically. After that, the bit Go to sleep should be set.

Please make sure this points are checked:

- No request frame / header frame send to slave. This is beyond your application

- The i_ifc_readstatus(LI0) be called after the timeout amount.

Therefore, this api should work properly.

Thank you,

Nam.

0 Kudos

2,262 Views
NamLe
NXP Employee
NXP Employee

Please help me to take out the connection between master and slave. This bit should be set, due to this basic function be tested and should work.

I asked one developer of lin stack and got this information. I think the header frames from your simulator keep sending out to the slave. Please disconnect it for this bit.

Thank you,

Nam.

 

0 Kudos

2,217 Views
NoahXu
Contributor III

Hello, Namm

even i plug out the LIN lin, the value not change itself.

you can find the previous screenshot, if there is lin sent out from master , the SCISR register will change.

can you make a demo for me? consider you donot have a test board,  i can test it use my PCBA.

0 Kudos

2,201 Views
NamLe
NXP Employee
NXP Employee

Hi NoahXu,

You confirmed that you already disconnected LIN out of slave, and then after over 10 seconds you call the api lin_getstatus, but the result not change and all flags are still 0? (make sure your function be called after timeout amount)

Could you please share your project here? So i will transfer it to developer for checking directly.

About your hardware setup and debug, can you give me the details? So we will try to reproduce if we can.

Sorry for this inconvenience, the api should work probably but seems it doesn't so we need information to check more.

Thank you,

Nam.

0 Kudos

2,390 Views
NamLe
NXP Employee
NXP Employee

Hi NoahXu,

In the LIN API Specification document, you can find a chapter 7.2.5.8 of l_ifc_read_status

Namm_0-1704266765444.png

This api can be applied for both master and slave side, the return frame will be different

Namm_1-1704266880618.png

As the response when master stop sending out frames, there should be master in sleep mode. Please take a look at this chapter and these other's return values also.

Thank you,

Nam.

 

0 Kudos