Hot!Question about MCC Lin driver liabrary V2.3

Author
Jianxin.Pang
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2018/01/09 00:12:45
  • Location: 0
  • Status: offline
2018/06/07 01:11:48 (permalink)
0

Question about MCC Lin driver liabrary V2.3

 MCC Lin  liabrary V2.3 fixed the break field detection failure in  Version 2.2 
I tested the Lin driver V2.3 ON PIC 16F1718  under win10 professional &  MPLAB X V4.15    xc8 1.45  MCC 3.45.1 
At master controller side :
I set two flames : 
   1.  SPEED  PID :Ox8B  ;   TYPE :Transmit ;   Length :4   ;  Timeout: 5 ms   ; Period: 10ms
   2.  FEEDBACK  PID : 0x25  TYPE :RECEIVE;   Length :2   ;  Timeout: 5 ms   ; Period: 10ms
after code generated , It can send message to slave node  correctly(View data wave with Osciloscope)
but  Master could not receive the response from slave though slave has responed correctly( View data wave with Osciloscope)   
  

void main(void)
{
    // initialize the device
    SYSTEM_Initialize();
    // When using interrupts, you need to set the Global and Peripheral Interrupt Enable bits
    // Use the following macros to:
    // Enable the Global Interrupts
       INTERRUPT_GlobalInterruptEnable();
    // Enable the Peripheral Interrupts
       INTERRUPT_PeripheralInterruptEnable();
    // Disable the Global Interrupts
    //INTERRUPT_GlobalInterruptDisable();
    // Disable the Peripheral Interrupts
    //INTERRUPT_PeripheralInterruptDisable();
    while (1)
    {
        // Add your application code
        LIN_handler();
       
        if (SW2_PORT==0)
        {
         SPEED_Data[0]=0x60;
           
        } else SPEED_Data[0]=0x45;  //send nominal speed value
     
    }
}
/**
 
void processLIN(void){
    uint8_t tempRxData[8];
    uint8_t cmd;
    uint8_t Actual_Value[2];   

    cmd = LIN_getPacket(tempRxData);
    switch(cmd){
        case SPEED:
                                    //set the nominal speed value here is invalid,only in main loop is available 
            break;
        case FEEDBACK:
        Actual_Value[0] = FEEDBACK_Data[0];  //get the  actual speed data from slave ,but failed 
            break;
        default:
            break;
    }
}
Vice versa , At slave side :
I set two flames : 
   1. SPEED  PID :Ox8B  ;   TYPE :RECEIVE ;   Length :4   ;  Timeout: 5 ms   ; Period: 10ms
   2  FEEDBACK  PID : 0x25  TYPE :Transmit;   Length :2   ;  Timeout: 5 ms   ; Period: 10ms
slave can recognize Master request PID 0x25(sending from master) , and respones correctly (View data wave with Osciloscope)
 
void processLIN(void){
    uint8_t tempRxData[8];
    uint8_t cmd;
    uint8_t Nominal_SPEED[4];
    
    cmd = LIN_getPacket(tempRxData);
    switch(cmd){
        case SPEED:                                                    /CMD  is always 0x25
                 Nominal_SPEED[0] =SPEED_Data[0];      //  data can not be transfered
            break;
        case FEEDBACK:
         FEEDBACK_Data[0]=0x50;  // slave response data, can be send to master correctly
            break;
        default:
            break;
    }
}
 
but it could not recognize flame 0x8B sending from master ,and could not get the nominal speed data from master
 
That means the LIN driver LIN2.3 can not recognize Receive PID both master and slave sides 
 
I wonder wether i have the wrong setting in MCC , or there is still some problem in Lin driver V2.3
 
Hope get the support fro Forum , thanks in advance !
 
 
 
post edited by Jianxin.Pang - 2018/06/07 01:32:44
#1

3 Replies Related Threads

    baileyb
    Starting Member
    • Total Posts : 19
    • Reward points : 0
    • Joined: 2015/10/19 09:41:51
    • Location: 0
    • Status: offline
    Re: Question about MCC Lin driver liabrary V2.3 2018/06/11 23:08:00 (permalink)
    0
    Hello. I think I know what your problem is.
    The predefined data arrays (FEEDBACK_Data, and SPEED_Data) are only for data transmission. Meaning that you give those values for the data that is to be sent out. The received data comes from the tempRxData buffer.
    Your code should look like this:
    Actual_Value[0] = tempRxData[0]; (master)
    and 
    Nominal_SPEED[0] =tempRxData[0]; (slave)
     
    This isn't the first time that there has been confusion here. I will see what I can do about getting this changed so that the Data[] arrays are used for receive data as well.
     
    Let me know if this helps,
    Brian
    post edited by baileyb - 2018/06/12 18:17:10
    #2
    Jianxin.Pang
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/01/09 00:12:45
    • Location: 0
    • Status: offline
    Re: Question about MCC Lin driver liabrary V2.3 2018/06/13 01:41:58 (permalink)
    0
    Thank you very much for your help ! You are right , and now the problem has been solved 
    By the way ,I Confused the PID field and ID[0..5] , afetr changed the PID 0x8B  to 0xB ,everything is OK 
    maybe in MCC , the symbol "PID" should be changed to ID[0..5] to avoid the misunderstanding
    #3
    baileyb
    Starting Member
    • Total Posts : 19
    • Reward points : 0
    • Joined: 2015/10/19 09:41:51
    • Location: 0
    • Status: offline
    Re: Question about MCC Lin driver liabrary V2.3 2018/06/13 19:10:11 (permalink)
    0
    I'm glad that solved your problem. The PID naming issue has also been noted and will be fixed in the next release.
    #4
    Jump to:
    © 2018 APG vNext Commercial Version 4.5