HI,
I am using eSCi interface of MPC5777C to connect to external device.
I am using GPIO 103, 104 pins as TX and RX respectively.
I have configured GPIO[103] as GPIO and OBE and GPIO[104] as GPIO and IBE
These are my transmit and recieve functions
void TransmitData(void)
{
uint8_t j;
for (j=0; j< sizeof (TransData); j++) { /* Loop for character string */
while (eSCI_A.IFSR1.B.TDRE == 0) {} /* Wait for transmit data reg empty = 1 */
eSCI_A.IFSR1.R = 0x8000; /* Clear TDRE flag */
Here instead of writing data to data register of esci, I am writing data to SIU GPDO output register
//eSCI_A.SDR.B.RDTD = TransData[j] << 24; /* Write byte*/
SIU_GPDO[103] = TransData[j] << 24; /* Write byte*/
}
}
void ReceiveData(void)
{
while (eSCI_A.IFSR1.B.RDRF == 0) {} /* Wait for receive data reg full = 1 */
eSCI_A.IFSR1.R = 0x2000; /* Clear RDRF flag */
Same here. Instead of reading data from data register of esci, I am reading data directly from SIU GPDI input register
//RecData = eSCI_A.SDR.B.RDTD; /* Read byte of Data*/
RecData = SIU_GPDI[104];
while (eSCI_A.IFSR1.B.TDRE == 0) {} /* Wait for transmit data reg empty = 1 */
eSCI_A.IFSR1.R = 0x8000; /* Clear TDRE flag */
}
Is this the correct way to use GPIO pins for esci interface?
Thanks
Vrushali
Hi Vrushali,
If you want to use the eSCI module then you need to configure pins for eSCI functionality.
No eSCI options are available for your selected pins. The eSCI_A is available e.g on GPIO89 and GPIO90.
The setting should be
SIU.PCR[89].R = 0x400; // Configure pad for primary func: TxDA
SIU.PCR[90].R = 0x400; // Configure pad for primary func: RxDA
And use the eSCI DR register for transmit and receive, not GPIO output/input registers.
You can refer to MPC5777C PinToggleStationery example (https://community.nxp.com/docs/DOC-328290) which configure the eSCI_A properly. See uart.c file for details.
BR, Petr