LIN  assign frame ID range problem

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

LIN  assign frame ID range problem

6,473 Views
deepakchandra
Contributor III

Dear sir ,

Today I have trying to change the PID by using Assign frame ID range by sending the frame  as shown below from master ,but it is showing

Negative response please help me out in this problem.

Labels (1)
0 Kudos
Reply
10 Replies

3,991 Views
RadekS
NXP Employee
NXP Employee

Hi Deepak,

The Assign Frame ID range command example is in the attached project in the previous thread:

https://community.freescale.com/message/618725#comment-618725

Node ALIN_2 has only 2 configurable PID: 0x22, 0x1F as seen in LDF_example.ldf and in lin_cfg.c: l_u8 lin_configuration_RAM[LIN_SIZE_OF_CFG]= {0x00, 0x22, 0x1F, 0x3C, 0x3D ,0xFF};

If users want to change PID 0x22 to 0x27 for example, Master node should send command as follows:

0x09 (NAD) 0x06 (PCI) 0xB7 (SID) 0x00 (start index) 0x27 (PID index) 0x1F (PID index +1) 0xFF (do not care data) 0xFF (do not care data)

data[0] = 0xB7;

                                data[1] = 0x00; /* start index = 0 */

                                data[2] = 0x27; /*Change PID 0x22 to 0x27, for example*/

                                data[3] = 0x1F; /* Change 0x1F to other value if users want */

                                data[4] = 0xFF;

                                data[5] = 0xFF;

                                ld_send_message(LI0, 6, 0x09, data); //change 0x09 to 0x06 if NAD is 0x06

In case, the master sends wrong command as seen in our customer’s case, the slave will answer with negative response.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

3,991 Views
deepakchandra
Contributor III

dear sir ,

this will be very helpful to me ,thanks a lot

now i have to use some more feature in our diagnostic as required by customer as listed below .

reset , information ,  i have to change the use SID c6,c8 in our slave but i don't know how,please suggest .

2. for my slave i have using stop mode by using sleep command ,bus time out  i have used the code as below,sleep mode command is 3c 00 ff ff ff ff ff ff ff. it is not wake up from wake up command.

if(LIN_word_status != 0){

if((LIN_word_status>>3)&0x0001==0)

{

i++;

       if(i>5)

{

DisableInterrupts;

SCI0ACR1_RXEDGIE=1;  

  EnableInterrupts;

  Cpu_SetStopMode();

}

}

else

{

l_ifc_wake_up(LI0);

}

}

pastedImage_1.pngpastedImage_0.png

0 Kudos
Reply

3,991 Views
RadekS
NXP Employee
NXP Employee

Hi deepak,

About 2)

Did you enable wake-up feature in LIN PHY module by LPCR_LPWUE bit?

Please check whether SCI register access is already switched to alternative register map (SCISR2_AMAP=1) prior you execute command SCI0ACR1_RXEDGIE=1;

You should also disable this interrupt when MCU wake-up.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

3,991 Views
deepakchandra
Contributor III

dear sir ,

thanks i will work on sleep mode  and consider your point.

1.now i have to use some additional  feature in our diagnostic class 2  as required by customer as listed below .

reset , information , hw vesion sw version etc  i have to the use SID c6,c8 in our slave but i don't know how to do ,please suggest .

for example for reset .and information of ecu are listed below

pastedImage_1.png

pastedImage_0.png

0 Kudos
Reply

3,991 Views
RadekS
NXP Employee
NXP Employee

Hi deepak,

In this case, you want to use support_sid feature in diagnostic class 3. This feature was not supported in FSL_LIN_STACK v4.5.4. It is supported since version 4.5.6

Unfortunately version 4.5.6 was not published yet on our web pages (we working on that). Please download and use attached version 4.5.6.

In Version 4.5.6, for these requests, users should use Diagnostic Class 3 (since 0xC0, 0xC6 are user defined SID which are not supported in Diagnostic Class 2 according LIN Specification).

1)            IN NPF files:

Add support_sid for SID 0xC0 and 0xC6 using Eclipse GUI for example: user = 0xC0; user01 = 0xC6

2)            Then generate lin_cfg files. You can see that 2 flags are generated for SID user and user01. { DIAGSRV_USER_ORDER; DIAGSRV_USER01_ORDER }

3)            In Master’s application: Users can send request data similarly in the case of sending Read Data by Identifier or Assign Frame ID Range

4)            In Slave’s application: Users can detect whether slave has received Master request with SID user and user01: Do similar as in the case of processing Read Data by Identifier

  if(diag_get_flag( DIAGSRV_USER_ORDER)

{

  l_u16 req_len = 0;

  l_u8 req_data[10];

diag_clear_flag(DIAGSRV_USER_ORDER);

  /* Process data */

ld_receive_message(&req_len, req_data);

  req_data[0] += 0x40; // RSID = SID + 0x40

/* Put your code to perform necessary action here */

/* Send response */

  ld_send_message(10, req_data);

}


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

3,991 Views
deepakchandra
Contributor III

Dear sir ,

We are waiting ………….

Thanks for your support.

0 Kudos
Reply

3,991 Views
RadekS
NXP Employee
NXP Employee

Hi deepak,

We analyzed your files:

1)            In the NPF file: you have  11 SIDs , including SID:  partNo2                = 0xc6; and PartNumber              = 0xc7;

In lin_cfg.h 2 flags were generated for these 2 SID:

#define DIAGSRV_PARTNUMBER_ORDER    8

#define DIAGSRV_PARTNO2_ORDER    9

So, in Slave main app you should implement:

if(diag_get_flag(DIAGSRV_PARTNUMBER_ORDER  )

{

  l_u16 req_len = 0;

  l_u8 req_data[10];

diag_clear_flag(DIAGSRV_PARTNUMBER_ORDER);

  /* Receive data */

ld_receive_message(&req_len, req_data);

  req_data[0] += 0x40; // RSID = SID + 0x40

/* Put your code to perform necessary action here */

/* Send response */

  ld_send_message(10, req_data);

}

if(diag_get_flag(DIAGSRV_PARTNO2_ORDER )

{

  l_u16 req_len_1 = 0;

  l_u8 req_data_1[10];

diag_clear_flag(DIAGSRV_PARTNO2_ORDER );

  /* Receive data */

ld_receive_message(&req_len_1, req_data_1);

  req_data_1[0] += 0x40; // RSID = SID + 0x40

/* Put your code to perform necessary action here */

/* Send response */

  ld_send_message(10, req_data_1);

}

The current implementation in your Slave main app is wrong.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

3,991 Views
deepakchandra
Contributor III

Dear sir ,

I have download the new stack as per link and apply the same .

But we do not get { DIAGSRV_USER_ORDER; DIAGSRV_USER01_ORDER } in LIN cfg file as I am attaching the same and apply the same code on that

But we are not getting any response when I am sending 3c 06 06 c6 ff 00 ff ff from my LIN analyser tool microchip.

In this ihave attached my LDF ,NPF, Lin cfg file and main also , I don’t know how to get response because when I am sending the data to my slave there is no data is showing in data array on debugger.

Please suggest me.

Thanks and regards

deepak

0 Kudos
Reply

3,991 Views
deepakchandra
Contributor III

@dear sir, thanks for your support we will work on that ,and let u know ,

sir we are getting problem in sleep mode(stop mode),we are able to send the controller in sleep mode ,but during going to sleep

mode controller was reset ,

in first time it goes to stop mode without reset . but when we send LIN command it wake up

but in 2 time when we send the stop mode controller will reset .

LIN SLAVE.

            LIN_word_status = l_ifc_read_status(LI0);

           

          

           

           

    if(LIN_word_status != 0)

         {

                 /* Check if the LIN bus in the sleep mode */

                   if((LIN_word_status>>3)&0x01){

                  i++;

                   LIN_word_status=0;

                   if(i>5)

                   {                      //WDog1_Clear();   

                       //CPMUCOP_WCOP=1;                            

   SCI0ACR1_RXEDGIE=1;   

                        Cpu_SetStopMode();   

                   

                    }

                    lin_lld_tx_wake_up();

      

                   SCI0ACR1_RXEDGIE=0;

                   

                    }

          

            }

//               

0 Kudos
Reply

3,991 Views
RadekS
NXP Employee
NXP Employee

Hi deepak,

I see in your code some commented lines for watchdog configuration.

Is watchdog enabled?

Note: WCOP, CR2, CR1, CR0 bits could be written just once on normal mode.

Note: When starting up the external oscillator (either by programming OSCE bit to 1 or on exit from Full Stop Mode with OSCE bit already 1) the software must wait for a minimum time equivalent to the startup-time of the external oscillator tUPOSC before entering Pseudo Stop Mode.

Note: After wake-up from Full Stop Mode the Core Clock and Bus Clock are running on PLLCLK (PLLSEL=1). So, you have to disable PLLSEL bit again if your clock should be configured to PBE mode.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply