This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Configuration UARTE with nrf52805 for ESB - Part 2


My previous ticket is closed. I would need, but still help with the configuration of the pins. I report my last post.

Hello,
I did some tests with the oscilloscope directly connected to pins 21 and 18 of the nrf52805.
The transmission on pin 18 by the Stm8l works perfectly. The problem I encounter now is that nrf52805 I have the pull up instruction on this pin

 nrf_gpio_cfg_input(PIN_RXD,GPIO_PIN_CNF_PULL_Pullup);

but nothing happens when oscilloscopes.
It could be that I get the pin definition wrong initially

 #define UARTE_BASE           0x40002000
  #define PORTA_UARTE          ((NRF_UARTE_Type *) UARTE_BASE )
  #define PIN_TXD            21
  #define PIN_RXD            18


or the pull up configuration of pin 18, set as input and pin 21 as output?

 nrf_gpio_cfg_input(PIN_RXD,GPIO_PIN_CNF_PULL_Pullup);
     nrf_gpio_cfg_output(PIN_TXD);
Parents
  • thanks for the answer, I edited the baudrate from 115200 to 2400 on both nrf52805 and STM8 but I still received the error, I have at this point enabled flow control with the code
    static void uart_init(void)
    {
        uint32_t                     err_code;
        app_uart_comm_params_t const comm_params =
        {
            .rx_pin_no    = PORTA_RXD,
            .tx_pin_no    = PORTA_TXD,
            
            .flow_control = APP_UART_FLOW_CONTROL_ENABLED,
            .use_parity   = false,
    #if defined (UART_PRESENT)
            .baud_rate    = NRF_UARTE_BAUDRATE_2400
    #else
            .baud_rate    = NRF_UARTE_BAUDRATE_115200
    #endif
        };
    
        APP_UART_FIFO_INIT(&comm_params,
                           UART_RX_BUF_SIZE,
                           UART_TX_BUF_SIZE,
                           uart_event_handle,
                           APP_IRQ_PRIORITY_LOWEST,
                           err_code);
        APP_ERROR_CHECK(err_code);
    }
    on nrf52805 but I continue to have the communication error, what am I wrong?
    the Handler function is:
    void uart_event_handle(app_uart_evt_t * p_event)
    {
       
        static uint8_t index = 0;
        uint32_t       err_code;
    
        switch (p_event->evt_type)
        {
            case APP_UART_DATA_READY:
                UNUSED_VARIABLE(app_uart_get(&tx_payload.data[index]));
                index++;
    
                if ((tx_payload.data[index - 1] == '\n') ||
                    (tx_payload.data[index - 1] == '\r') ||
                    (index >= 20))// valore massimo da poter invare su uart suggerimento preso dall'esempio del ble_uart
                {
                    if (index > 1)
                    {
                        NRF_LOG_DEBUG("Ready to send data over UARTE");
                        NRF_LOG_HEXDUMP_DEBUG(tx_payload.data, index);
                    }
    
                    index = 0;
                }
                break;
    
            case APP_UART_COMMUNICATION_ERROR:
                APP_ERROR_HANDLER(p_event->data.error_communication);
                break;
    
            case APP_UART_FIFO_ERROR:
                APP_ERROR_HANDLER(p_event->data.error_code);
                break;
    
            default:
                break;
        }
    }
Reply
  • thanks for the answer, I edited the baudrate from 115200 to 2400 on both nrf52805 and STM8 but I still received the error, I have at this point enabled flow control with the code
    static void uart_init(void)
    {
        uint32_t                     err_code;
        app_uart_comm_params_t const comm_params =
        {
            .rx_pin_no    = PORTA_RXD,
            .tx_pin_no    = PORTA_TXD,
            
            .flow_control = APP_UART_FLOW_CONTROL_ENABLED,
            .use_parity   = false,
    #if defined (UART_PRESENT)
            .baud_rate    = NRF_UARTE_BAUDRATE_2400
    #else
            .baud_rate    = NRF_UARTE_BAUDRATE_115200
    #endif
        };
    
        APP_UART_FIFO_INIT(&comm_params,
                           UART_RX_BUF_SIZE,
                           UART_TX_BUF_SIZE,
                           uart_event_handle,
                           APP_IRQ_PRIORITY_LOWEST,
                           err_code);
        APP_ERROR_CHECK(err_code);
    }
    on nrf52805 but I continue to have the communication error, what am I wrong?
    the Handler function is:
    void uart_event_handle(app_uart_evt_t * p_event)
    {
       
        static uint8_t index = 0;
        uint32_t       err_code;
    
        switch (p_event->evt_type)
        {
            case APP_UART_DATA_READY:
                UNUSED_VARIABLE(app_uart_get(&tx_payload.data[index]));
                index++;
    
                if ((tx_payload.data[index - 1] == '\n') ||
                    (tx_payload.data[index - 1] == '\r') ||
                    (index >= 20))// valore massimo da poter invare su uart suggerimento preso dall'esempio del ble_uart
                {
                    if (index > 1)
                    {
                        NRF_LOG_DEBUG("Ready to send data over UARTE");
                        NRF_LOG_HEXDUMP_DEBUG(tx_payload.data, index);
                    }
    
                    index = 0;
                }
                break;
    
            case APP_UART_COMMUNICATION_ERROR:
                APP_ERROR_HANDLER(p_event->data.error_communication);
                break;
    
            case APP_UART_FIFO_ERROR:
                APP_ERROR_HANDLER(p_event->data.error_code);
                break;
    
            default:
                break;
        }
    }
Children
No Data
Related