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
  • Hello,

    Yes, I've based my code off of the UART example in SDK 17.0.2: "examples/peripheral/uart."  I have experimented with various IRQ priorities and baud rates, but to no avail. Here is my pinout:

    #define UART_TX_PIN NRF_GPIO_PIN_MAP( PORT_1, 8 ) 

    #define UART_RX_PIN             NRF_GPIO_PIN_MAP( PORT_0, 7 ) 

    And in sdk_config.h:

    Here is what is have turned on:
    // </e>
    // <e> APP_UART_ENABLED - app_uart - UART driver
    //==========================================================
    #ifndef APP_UART_ENABLED
    #define APP_UART_ENABLED 1
    #endif
    // <o> APP_UART_DRIVER_INSTANCE  - UART instance used
     
    // <0=> 0 
    
    #ifndef APP_UART_DRIVER_INSTANCE
    #define APP_UART_DRIVER_INSTANCE 1
    #endif
    
    
    // <e> NRFX_UART_ENABLED - nrfx_uart - UART peripheral driver
    //==========================================================
    #ifndef NRFX_UART_ENABLED
    #define NRFX_UART_ENABLED 1
    #endif
    // <o> NRFX_UART0_ENABLED - Enable UART0 instance 
    #ifndef NRFX_UART0_ENABLED
    #define NRFX_UART0_ENABLED 0
    #endif
    
    // <o> NRFX_UART_DEFAULT_CONFIG_HWFC  - Hardware Flow Control
     
    // <0=> Disabled 
    // <1=> Enabled 
    
    #ifndef NRFX_UART_DEFAULT_CONFIG_HWFC
    #define NRFX_UART_DEFAULT_CONFIG_HWFC 0
    #endif
    
    // <o> NRFX_UART_DEFAULT_CONFIG_PARITY  - Parity
     
    // <0=> Excluded 
    // <14=> Included 
    
    #ifndef NRFX_UART_DEFAULT_CONFIG_PARITY
    #define NRFX_UART_DEFAULT_CONFIG_PARITY 0
    #endif
    
    // <o> NRFX_UART_DEFAULT_CONFIG_BAUDRATE  - Default Baudrate
     
    // <323584=> 1200 baud 
    // <643072=> 2400 baud 
    // <1290240=> 4800 baud 
    // <2576384=> 9600 baud 
    // <3866624=> 14400 baud 
    // <5152768=> 19200 baud 
    // <7729152=> 28800 baud 
    // <8388608=> 31250 baud 
    // <10309632=> 38400 baud 
    // <15007744=> 56000 baud 
    // <15462400=> 57600 baud 
    // <20615168=> 76800 baud 
    // <30924800=> 115200 baud 
    // <61845504=> 230400 baud 
    // <67108864=> 250000 baud 
    // <123695104=> 460800 baud 
    // <247386112=> 921600 baud 
    // <268435456=> 1000000 baud 
    
    #ifndef NRFX_UART_DEFAULT_CONFIG_BAUDRATE
    #define NRFX_UART_DEFAULT_CONFIG_BAUDRATE 30924800
    #endif
    
    // <o> NRFX_UART_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef NRFX_UART_DEFAULT_CONFIG_IRQ_PRIORITY
    #define NRFX_UART_DEFAULT_CONFIG_IRQ_PRIORITY 6
    #endif
    
    
    
    // <e> NRFX_UARTE_ENABLED - nrfx_uarte - UARTE peripheral driver
    //==========================================================
    #ifndef NRFX_UARTE_ENABLED
    #define NRFX_UARTE_ENABLED 1
    #endif
    // <o> NRFX_UARTE0_ENABLED - Enable UARTE0 instance 
    #ifndef NRFX_UARTE0_ENABLED
    #define NRFX_UARTE0_ENABLED 0
    #endif
    
    // <o> NRFX_UARTE1_ENABLED - Enable UARTE1 instance 
    #ifndef NRFX_UARTE1_ENABLED
    #define NRFX_UARTE1_ENABLED 0
    #endif
    
    

    Not sure if there is a configuration issue in sdk_config.h or not. But the fact that RX pin is correctly receiving and TX pin is not is quite confusing. 

    I am using SES v5.68

Reply
  • Hello,

    Yes, I've based my code off of the UART example in SDK 17.0.2: "examples/peripheral/uart."  I have experimented with various IRQ priorities and baud rates, but to no avail. Here is my pinout:

    #define UART_TX_PIN NRF_GPIO_PIN_MAP( PORT_1, 8 ) 

    #define UART_RX_PIN             NRF_GPIO_PIN_MAP( PORT_0, 7 ) 

    And in sdk_config.h:

    Here is what is have turned on:
    // </e>
    // <e> APP_UART_ENABLED - app_uart - UART driver
    //==========================================================
    #ifndef APP_UART_ENABLED
    #define APP_UART_ENABLED 1
    #endif
    // <o> APP_UART_DRIVER_INSTANCE  - UART instance used
     
    // <0=> 0 
    
    #ifndef APP_UART_DRIVER_INSTANCE
    #define APP_UART_DRIVER_INSTANCE 1
    #endif
    
    
    // <e> NRFX_UART_ENABLED - nrfx_uart - UART peripheral driver
    //==========================================================
    #ifndef NRFX_UART_ENABLED
    #define NRFX_UART_ENABLED 1
    #endif
    // <o> NRFX_UART0_ENABLED - Enable UART0 instance 
    #ifndef NRFX_UART0_ENABLED
    #define NRFX_UART0_ENABLED 0
    #endif
    
    // <o> NRFX_UART_DEFAULT_CONFIG_HWFC  - Hardware Flow Control
     
    // <0=> Disabled 
    // <1=> Enabled 
    
    #ifndef NRFX_UART_DEFAULT_CONFIG_HWFC
    #define NRFX_UART_DEFAULT_CONFIG_HWFC 0
    #endif
    
    // <o> NRFX_UART_DEFAULT_CONFIG_PARITY  - Parity
     
    // <0=> Excluded 
    // <14=> Included 
    
    #ifndef NRFX_UART_DEFAULT_CONFIG_PARITY
    #define NRFX_UART_DEFAULT_CONFIG_PARITY 0
    #endif
    
    // <o> NRFX_UART_DEFAULT_CONFIG_BAUDRATE  - Default Baudrate
     
    // <323584=> 1200 baud 
    // <643072=> 2400 baud 
    // <1290240=> 4800 baud 
    // <2576384=> 9600 baud 
    // <3866624=> 14400 baud 
    // <5152768=> 19200 baud 
    // <7729152=> 28800 baud 
    // <8388608=> 31250 baud 
    // <10309632=> 38400 baud 
    // <15007744=> 56000 baud 
    // <15462400=> 57600 baud 
    // <20615168=> 76800 baud 
    // <30924800=> 115200 baud 
    // <61845504=> 230400 baud 
    // <67108864=> 250000 baud 
    // <123695104=> 460800 baud 
    // <247386112=> 921600 baud 
    // <268435456=> 1000000 baud 
    
    #ifndef NRFX_UART_DEFAULT_CONFIG_BAUDRATE
    #define NRFX_UART_DEFAULT_CONFIG_BAUDRATE 30924800
    #endif
    
    // <o> NRFX_UART_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef NRFX_UART_DEFAULT_CONFIG_IRQ_PRIORITY
    #define NRFX_UART_DEFAULT_CONFIG_IRQ_PRIORITY 6
    #endif
    
    
    
    // <e> NRFX_UARTE_ENABLED - nrfx_uarte - UARTE peripheral driver
    //==========================================================
    #ifndef NRFX_UARTE_ENABLED
    #define NRFX_UARTE_ENABLED 1
    #endif
    // <o> NRFX_UARTE0_ENABLED - Enable UARTE0 instance 
    #ifndef NRFX_UARTE0_ENABLED
    #define NRFX_UARTE0_ENABLED 0
    #endif
    
    // <o> NRFX_UARTE1_ENABLED - Enable UARTE1 instance 
    #ifndef NRFX_UARTE1_ENABLED
    #define NRFX_UARTE1_ENABLED 0
    #endif
    
    

    Not sure if there is a configuration issue in sdk_config.h or not. But the fact that RX pin is correctly receiving and TX pin is not is quite confusing. 

    I am using SES v5.68

Children
No Data
Related