AnsweredAssumed Answered

How to get LIN demo using DMA for MPC55xx/MPC56xx

Question asked by wang heng on Sep 15, 2015
Latest reply on Sep 23, 2015 by Petr Stancik

Hi ,

 

I am learning the MPC5634M Microcontroller Reference Manual.

I have tried the following example. It contains communication on LIN bus between two MPC5604B EVBs.

Example MPC5604B LINFlex LIN Master-Slave communication demo

But how to get LIN demo fully contains Tx and Rx functions using DMA for MPC55xx/MPC56xx ?

 

And, I have another question about how to write LIN transmit register (SCI_LTR).

26.4.2.6LIN transmit register (SCI_LTR) in MPC563XMRM.pdf, described as follows:

       0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15

     |-------|-----------------------|-------------------------------|

     |Parity |           ID          |               LEN             |

     |-------|-----------------------|-------------------------------|

Reset| 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0 |

 

      16   17  18  19  20  21  22  23  24  25  26  27  28  29  30  31

     |---|---|---|---|---------------|-------------------------------|

     |CSM|CSE|CRC|TD |       TO      |               DATA            |

     |---|---|---|---|---------------|-------------------------------|

Reset| 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0 |

 

26.5.6.3.1 Application controlled LIN TX frame generation in MPC563XMRM.pdf, described as follows:

The first byte written to the SCI_LTR contains the Identifier and Identifier Parity fields. The second byte written defines the number of data bytes to be transmitted. The third write access defines the CRC and checksum generation. The TD bit has to set to 1 to invoke the TX frame generation. The TO field bits must be set to 0.

 

For example, I want to set :

ID = 0x35;     LEN = 8;     CSM = 1;     CSE = 1;     TD = 1;

all other fields of register SCI_LTR are 0.

 

Here we don't consider the TXRDY flag in the SR register (SCI_SR).

I want to know how to write the LIN transmit register (SCI_LTR) ???

First method:

ESCI_A.LTR.R = ((0x00000035<<24) | (0x00000008<<16) | (0x000000D0<<8));

Or, second method:

ESCI_A.LTR.R = 0x35;   //1st byte Write

ESCI_A.LTR.R = 0x05;   //2st byte Write

ESCI_A.LTR.R = 0xD0;  //3st byte Write

I want to know what kind of method is correct for writing LIN transmit register (SCI_LTR).

tks!!!

Outcomes