Call to app_uart_put() not putting anything on the TX Line

Hello,

I've been trying to get my call to app_uart_put() to actually place bytes on the TX pin. Interestingly enough, my call to app_uart_get() works fine and is able to receive all the commands on the RX pin. I am using SDK v17.0.2. 

My code that initializes the UART is fairly boilerplate:

   if (!uart_instance_activated)
    {
        uart_instance_activated = true;
        uint32_t err_code = NRF_SUCCESS;
        const app_uart_comm_params_t comm_params =
        {
            UART_RX_PIN,
            UART_TX_PIN,
            UART_RTS_PIN_NUMBER,
            UART_CTS_PIN_NUMBER,
            UART_HWFC,
            false,
            NRF_UART_BAUDRATE_115200
        };

        APP_UART_FIFO_INIT(&comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                      uart_error_handle,
                APP_IRQ_PRIORITY_LOWEST,
                              err_code);

        APP_ERROR_CHECK(err_code); 
    }

My code that calls app_uart_put()

uint8_t transportSend( const uint16_t bufferSize, uint8_t *pBuffer )
{
    if ( pBuffer == NULL )
    {
        NRF_LOG_INFO("NULL?");
        return TRANSPORT_ERROR;
    }

    uint32_t status = NRF_SUCCESS;

    while (app_uart_put(START_BYTE) != NRF_SUCCESS);
    nrf_delay_ms(10);

    for ( uint16_t i = 0; i < bufferSize; i++ )
    {
        //NRF_LOG_INFO("pBuffer[%d] = %d", i, pBuffer[i]);
        // UART is spaming 0xFF so it has to be escaped
        if ( ( pBuffer[i] == START_BYTE ) ||
             ( pBuffer[i] == STOP_BYTE ) ||
             ( pBuffer[i] == ESCAPE_BYTE ) ||
             ( pBuffer[i] == 0xFF ) )
        {
            //status = app_uart_put( ESCAPE_BYTE );
            while (app_uart_put(ESCAPE_BYTE) != NRF_SUCCESS);
            nrf_delay_ms(10);

            while (app_uart_put(escapeByte( pBuffer[i] )) != NRF_SUCCESS);
            nrf_delay_ms(10);
        }
        else
        {
            while (app_uart_put(pBuffer[i]) != NRF_SUCCESS);
            nrf_delay_ms(10);
        }
    } // end of for-loop

    while (app_uart_put(STOP_BYTE) != NRF_SUCCESS);
    nrf_delay_ms(10);
  
    return TRANSPORT_SUCCESS;
}

and Like I said, my code that calls app_uart_get() works just fine:

static int cala_getChar()
{
    uint8_t input = 0;
    app_uart_get(&input);
    return input;
}

Is app_uart_put() not being called correctly? Doubled checked sdk_config.h and NRFX_UART_ENABLED is 1

Parents
  • Hi

    Have you checked if P1.08 is used for anything else in your project? I don't think it should be, but please double check. It was also an issue long ago where there were issues using PORT 1 pins with some peripherals. Can you try setting the TX pin to one of the Port 0 pins to see if that changes anything? This should have been fixed quite some time ago though.

    Best regards,

    Simon

Reply
  • Hi

    Have you checked if P1.08 is used for anything else in your project? I don't think it should be, but please double check. It was also an issue long ago where there were issues using PORT 1 pins with some peripherals. Can you try setting the TX pin to one of the Port 0 pins to see if that changes anything? This should have been fixed quite some time ago though.

    Best regards,

    Simon

Children
No Data
Related