cancel
Showing results for 
Search instead for 
Did you mean: 

LIN STM8 Package v.5.1 Demo with STM8A-Discovery - Slave pre configuration with sd_set_configuration

MKoza.2
Associate II

Here's the issue. I have built a LIN bus with a slave node and a master node using tow STM8AF/AL-Discovery boards. After flashing the boards with the demo of the STM8 LIN driver 5.1 as slave node and master node I can control either the LED or the bars in the LCD display with the user buttons. This works fine.

I have a project and the master knode also has no config schedule table, so I have to do the configuration in the slave node.

However, my idea is to pre-configure the slave node so that it does not need the "schTabConfig" schedule table in the LDF file. I have commented out the line in the "lin_basic_demo_master.c" -file and delete the "schTabConfig" in the LDF File.

Schedule_tables

{

 //

 // this schedule table will configure the slave node to

 // participate in LIN communication

 //

 schTabConfig

 {

    AssignNAD { slave1 } delay 20 ms ;

    SlaveResp delay 20 ms ;

    AssignFrameIdRange { slave1, 0 } delay 20 ms ;

    SlaveResp delay 20 ms ;

    AssignFrameIdRange { slave1, 4 } delay 20 ms ;

    SlaveResp delay 20 ms ;

    SaveConfiguration { slave1 }   delay 20 ms ;

    SlaveResp delay 20 ms ;

 }

void l_initTask(void)
    {
    /*
     * bring up LIN driver
     */
    l_sys_init();
    l_ifc_init(ifc_used);
#ifndef LIN_21
    l_ifc_connect(ifc_used);
#endif /* !LIN_21 */
   // l_sch_set(ifc_used, LIN_TAB_schTabConfig,0);
 // commented out the line above
    return ;
}

Now the communication does not work anymore, because the master node does not configure the slave node.

With the function ld_set_configuration() I can configure the slave node, if I understood it correctly.

The function is described in the file "lin_diag_slave.c" or in the LIN Api. The function has three parameters:

  1. param ifc handle of the interface
  2. param data structure containing the *** and all the n PIDs for the frames of the specified ***
  3.   param length length of data (1+n, ***+PIDs)

The first paramter is clear to me, but I just don't know how the "Data" paramter should look like in the demo example. I know, that data it is a array[n] but what values and data are in it?

Where do I get the parameters?

I have attached an example from the LIN Bus spec

I hope you can help me and thank you

Best Regards

Michael

0 REPLIES 0