AnsweredAssumed Answered

Route LIN to SCI for s12zvl

Question asked by Charudatta Ingale on Mar 19, 2016
Latest reply on Mar 22, 2016 by Radek Sestak

Dear Team,

want to use Lin pin of s12zvl as a SCI, not getting expected result code given bellow,

is there need to match baud rate of LIN  to SCI ?

is there need to set SCI as single wire mode ?

2A Diagnostic service  is not supported by LIN protocol,to get this service I need to use SCI

Is it possible to transmit  SCI frame  through LIN Pin ? I don't want to change H/w Pin Connection for one service

Is it LIN physical layer permit this type of implementation ?

 

LP0CR = LP0CR_LPPUE_MASK + LP0CR_LPWUE_MASK + LP0CR_LPE_MASK; /* LIN enable, LIN wakeup enable, LIN pull-up enable */

  MODRR0 = 0x00; /* LIN phy routed to SCI */

SCI0BD = 0x0D05;  //  SCI Baud Rate Register

SCI0CR1 = 0x00;

SCI0CR2 = 0x2C;

getting received interrupt but SCI buffer is empty.

 

interrupt VectorNumber_Vsci0 void SCI0_Isr(void)

{

 

     unsigned char scisr1;

     scisr1 = SCI0SR1;                          // save status register actual status

  

 

    //if receiver interrupt is enabled and corresponding interrupt flag is set

     if((SCI0CR2 & SCI0CR2_RIE_MASK) && ((scisr1 & (SCI0SR1_OR_MASK | SCI0SR1_RDRF_MASK))))

      {

        if(scisr1 & SCI0SR1_OR_MASK)            // if overrun error do nothing/something

          {

            (void)SCI0DRL;                            // clear interrupt flag

         

          }

        else

          {

            //Read data

    

            sc0_data_in = SCI0DRL;             // read received character + clear interrupt flag

            //---------------

            //Simple echo.

            while(!SCI0SR1_TDRE){};            //wait for transmit data register empty flag

            SCI0DRL = sc0_data_in;             //Echo

            //---------------

            //Receive data and store it into buffer

            buffer[pointer_to_buffer] = sc0_data_in;

            pointer_to_buffer++;

            if (pointer_to_buffer >= SIZE_OF_PACKETrx)

            {

                pointer_to_buffer = 0;

              

                //do something with data in buffer

                //or set flag and do something in main program

                //buffer_full = 1;  //flag for main program

            }

}

 

Thanks & Regards,

Charudatta

Outcomes