This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62: PRU - UART error

Part Number: SK-AM62
Other Parts Discussed in Thread: AM625

Hello! I am creating a serial communication code with the PRU of the AM625, however, despite the flags signaling the reception and transmission of content, because the whiles break, I cannot see the value that I transmit in tx in rx.

I'm using code composer studio and the functions below are just HAL abstractions for the register set:

Can you help me identify the problem?

#include <stdint.h>
#include <pru_uart.c>
#include <pru_gpio.c>
#include <string.h>

#define TX_PIN_ADDRESS ( *( volatile uint32_t * )( 0x000F41DC ) )
#define RX_PIN_ADDRESS ( *( volatile uint32_t * )( 0x000F41D8 ) )

int main(void)
{

    char *hostBuffer = "ABC";

    volatile uint16_t error = 0;

    volatile uint8_t tx = 0;
    volatile uint8_t rx = 0;
    volatile uint8_t cnt = 0;

    TX_PIN_ADDRESS &=~ 0b111;
    TX_PIN_ADDRESS |= 0b110;

    RX_PIN_ADDRESS &=~ 0b111;
    RX_PIN_ADDRESS |= 0b110;

    int status_baud = PRU_UART_baudConfig(OVERSAMPLE_16, BAUD_115200);
    uint32_t LSB = REG_UART_DIVLSB;
    uint32_t MSB = REG_UART_DIVMSB;

    int status_lenght = PRU_UART_lenghtConfig(LENGHT_8BITS);

    int status_parity = PRU_UART_parityConfig(NO_PARITY);

    int status_stop = PRU_UART_stopBitConfig(STOP_BIT);
    uint32_t LCR = REG_UART_LCTR;

    int status_interrupt_0 = PRU_UART_setInterrupt(TRANSMITTER_HOLDING_EMPTY, UART_INT_ABLE);
    int status_interrupt_1 = PRU_UART_setInterrupt(RECIEVER_DATA, UART_INT_DISABLE);
    int status_interrupt_2 = PRU_UART_setInterrupt(RECEIVER_LINE_STATUS, UART_INT_DISABLE);
    uint32_t inter = REG_UART_INT_EN;

    int status_clock_tx = PRU_UART_activateClock(UART_TX, UART_CLK_ABLE);

    int status_clock_rx = PRU_UART_activateClock(UART_RX, UART_CLK_ABLE);

    int status_fifo = PRU_UART_fifoConfig(UART_FIFO_ABLE);
    uint32_t fifo = REG_UART_INT_FIFO;

   UART->MCTR_BIT.LOOP = 1;

   UART->INT_FIFO_BIT.FCR_RXCLR = 1;
   UART->INT_FIFO_BIT.FCR_TXCLR = 1;

    while (1)
    {

        cnt = 0;

        while(1)
        {

            error = PRU_UART_errorCheck( );

            if ((tx = hostBuffer[cnt]) == '\0') break;

            cnt++;

            while ( !UART->LSR1_BIT.TEMT );

            UART->RBR_TBR_BIT.TBR_DATA = tx;

            error = PRU_UART_errorCheck( );

            while ( !UART->LSR1_BIT.DR );

            rx = UART->RBR_TBR_BIT.RBR_DATA;

            error = PRU_UART_errorCheck( );


        }


    }

}