Ryan Cusack
Ryan Cusack

Reputation: 11

UART transmission works but does not receive data through port pins?

I am using a S32K148 with a UART echo example as a base project. I have been trying to read in data through the port pins.

  while (1)
{
      LPUART_DRV_ReceiveData(INST_LPUART1, buffer, 1UL);
      while(LPUART_DRV_GetReceiveStatus(INST_LPUART1, &bytesRemaining) != STATUS_SUCCESS);

      LPUART_DRV_SendData(INST_LPUART1, buffer, 1UL);
      while(LPUART_DRV_GetTransmitStatus(INST_LPUART1, &bytesRemaining) != STATUS_SUCCESS);
    }

From the Quick Start Guide I have found that the LPUART1 RX/TX is connected to ports PTC6/PTC7 respectively.

I have connected a wire to the TX pin and used an FTDI uart serial to usb module to verify that I can transmit data from the S32.

In debug mode, I have been able to send data from PuTTY to the board when connecting directly to the S32 OpenSDA COM Port. So I know that RX works when data is sent through usb.

But the board does not receive data when I attempt to send data directly to the RX pin.

The RX pin has a voltage level of 5. It seems any signal I apply to the pin, a receive is never triggered. Except, when I briefly touch ground to the RX pin, a reception does trigger.

Maybe this has to do something with voltage levels. I am not sure. The FTDI module I am using to test sending characters to the board is set to 5V.

Heres the default configurations for the port pins:

    {
    .base          = PORTC,            //TX
    .pinPortIdx    = 7u,
    .pullConfig    = PORT_INTERNAL_PULL_NOT_ENABLED,
    .passiveFilter = false,
    .driveSelect   = PORT_LOW_DRIVE_STRENGTH,
    .mux           = PORT_MUX_ALT2,
    .pinLock       = false,
    .intConfig     = PORT_DMA_INT_DISABLED,
    .clearIntFlag  = false,
    .gpioBase      = NULL,
    .digitalFilter = false,
},
{
    .base          = PORTC,             //RX
    .pinPortIdx    = 6u,
    .pullConfig    = PORT_INTERNAL_PULL_NOT_ENABLED,
    .passiveFilter = false,
    .driveSelect   = PORT_LOW_DRIVE_STRENGTH,
    .mux           = PORT_MUX_ALT2,
    .pinLock       = false,
    .intConfig     = PORT_DMA_INT_DISABLED,
    .clearIntFlag  = false,
    .gpioBase      = NULL,
    .digitalFilter = false,
},

Upvotes: 1

Views: 1158

Answers (1)

Thomas Schnuerer
Thomas Schnuerer

Reputation: 1

that's because the OpenSDA Rx pin is shared with PTC6. I have same problem, when doing OpenSDA debugging and using LPUART1 together I can send data out but not receive because level on Rx pin is 5V and UART signal from my UART adapter is not getting to GND / driving too weak.

Thomas

Upvotes: 0

Related Questions