Académique Documents
Professionnel Documents
Culture Documents
By
Sasi Kumar C
Development Engineer
The eSCI allows asynchronous serial communications with peripheral devices and other
CPUs.
The eSCI has special features which allow the eSCI to operate as a LIN bus master,
complying with the LIN 2.0 specification.
NOTES
When transmitting in 9-bit data format and using 8-bit write instructions, write first to
ESCIx_DR[0–7], then ESCIx_DR[8–15]. For 9-bit transmissions, a single write may
also be used.
The ESCIx_SR indicates the current status. The status flags can be polled, and some
can also be used to generate interrupts. All bits in ESCIx_SR except for RAF are cleared
by writing 1 to them.
1. Initialization of eSCI
a. Enable the module of esCI
b. Initialize eSCI control.
c. Configure Pads
2. Transmit Data
a. Wait for Transmit Data Empty register Status Flag.
b. Clear Status Flag.
c. Load data to Data Register.
Hence,
MFD = ( 64MHz / 8MHz) – 4
= 4
Therefore,
MFD = 00100
RFD = 000
PREDIV = 000
FMPLL.SYNCR.R = 0x0200000;
while(FMPLL.SYNSR.B.LOCK != 1);
Module Disable
MDIS When 1 - Disable
0 - Enable
ESCI_A.CR2.R = 0x0000;
ESCI_A.CR1.R = 0x01A1800C;
3,4,5 - PA
SIU.PCR[90].R = 0x0400;
SIU.PCR[89].R = 0x0400;
TDRE When
0 - No byte transferred to transmit shift register
1 - Byte transferred to transmit shift register; transmit data register empty
while(ESCI_A.SR.B.TDRE == 0);
ESCI_A.SR.B.TDRE = 1;
ESCI_A.DR.B.D = txdata;
while(ESCI_A.SR.B.RDRF == 0);
c. Load Data from the data register eSCI Data Register (ESCIx_DR)
rxdata = ESCI_A.DR.B.D;
# include “MPC5554.h”
uint8_t recdata[10];
uint8_t j; ESCI_A.DR.B.D = txdata;
const uint8_t transdata[ ] = { “HELLO” };
void main(void)
{
FMPLL.SYNCR.R = 0x0200000;
while(FMPLL.SYNSR.B.LOCK != 1);
ESCI_A.CR2.R = 0x0000;
ESCI_A.CR1.R = 0x01A1800C;
SIU.PCR[90].R = 0x0400;
SIU.PCR[89].R = 0x0400;
while(1) {
for( j=0; j<size of(transdata); j++) {
while(ESCI_A.SR.B.TDRE == 0);
ESCI_A.SR.B.TDRE = 1;
ESCI_A.DR.B.D = txdata;
while(ESCI_A.SR.B.RDRF == 0);
ESCI_A.SR.B.RDRF = 1;
rxdata[j] = ESCI_A.DR.B.D;
}
}
}
1. Initialization of eSCI
a. Enable the module of esCI
b. Initialize eSCI control.
c. Configure Pads
2. Transmit Data
a. Wait for Transmit Data Empty register Status Flag.
b. Clear Status Flag.
c. Load data to Data Register.
Hence,
MFD = ( 64MHz / 8MHz) – 4
= 4
Therefore,
MFD = 00100
RFD = 000
PREDIV = 000
FMPLL.SYNCR.R = 0x0200000;
while(FMPLL.SYNSR.B.LOCK != 1);
Module Disable
MDIS When 1 - Disable
0 - Enable
ESCI_A.CR2.R = 0x0000;
ESCI_A.CR1.R = 0x01A1000C;
3,4,5 - PA
SIU.PCR[89].R = 0x0400;
TDRE When
0 - No byte transferred to transmit shift register
1 - Byte transferred to transmit shift register; transmit data register empty
ESCI_A.DR.B.D = txdata;
ESCI_A.DR.B.D = txdata;
# include “MPC5554.h”
uint8_t j;
const uint8_t transdata[ ] = { “HELLO” };
void main(void)
{
FMPLL.SYNCR.R = 0x0200000;
while(FMPLL.SYNSR.B.LOCK != 1);
ESCI_A.CR2.R = 0x0000;
ESCI_A.CR1.R = 0x01A1000C;
SIU.PCR[89].R = 0x0400;
while(1) {
for( j=0; j<size of(transdata); j++) {
while(ESCI_A.SR.B.TDRE == 0);
ESCI_A.SR.B.TDRE = 1;
ESCI_A.DR.B.D = txdata;
}
}
}
Hence,
MFD = ( 64MHz / 8MHz) – 4
= 4
Therefore,
MFD = 00100
RFD = 000
PREDIV = 000
FMPLL.SYNCR.R = 0x0200000;
while(FMPLL.SYNSR.B.LOCK != 1);
Module Disable
MDIS When 1 - Disable
0 - Enable
ESCI_A.CR2.R = 0x0000;
ESCI_A.CR1.R = 0x01A1000C;
3,4,5 - PA
SIU.PCR[90].R = 0x0400;
RDRF When
0 Data not available in eSCI data register
1 Received data available in eSCI data register
rxdata = ESCI_A.DR.B.D ;
ESCI_A.DR.B.D = txdata;
# include “MPC5554.h”
uint8_t recdata[10];
uint8_t j;
void main(void)
{
FMPLL.SYNCR.R = 0x0200000;
while(FMPLL.SYNSR.B.LOCK != 1);
ESCI_A.CR2.R = 0x0000;
ESCI_A.CR1.R = 0x01A1000C;
SIU.PCR[90].R = 0x0400;
while(1) {
for( j=0; j<10; j++) {
while(ESCI_A.SR.B.RDRF == 0);
ESCI_A.SR.B.RDRF = 1;
rxdata[j] = ESCI_A.DR.B.D;
}
}
}
• 24 unified channels
• Unified channels features
— 24-bit registers for captured/match values
— 24-bit internal counter
— Internal pre scalar
— Dedicated output pin for buffer direction control
— Selectable time base
— Can generate its own time base
• Four 24-bit wide counter buses
— Counter bus A can be driven by unified channel 23 or by the STAC bus.
— Counter bus B, C, and D are driven by unified channels 0, 8, and 16,
respectively.
— Counter bus A can be shared among all unified channels. UCs 0 to 7, 8 to 15,
and 16 to 23 can share counter buses B, C, and D, respectively.
• One global pre scalar
• Shared time bases through the counter buses
• Synchronization among internal and external time bases
• Shadow FLAG register
• DMA request capability for some channels
• Motor control capability
After leaving debug mode, all counters that were frozen upon debug mode entry will
resume at the point where they were frozen.
In debug mode, all clocks are running and all registers are accessible; thus, this mode is
not intended for power saving, but for use during software debugging.