<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>UART connection&amp;#39;s Rx error when BT enabled</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/86538/uart-connection-s-rx-error-when-bt-enabled</link><description>Hi, 
 I have been using an UART connection for serial communication but it stops working when I enable the Bluetooth module and initialize it. The error I receive is the same as if I connected the UART&amp;#39;s Rx pin to GND. 
 UART overlay definition, also</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 06 Apr 2022 18:39:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/86538/uart-connection-s-rx-error-when-bt-enabled" /><item><title>RE: UART connection's Rx error when BT enabled</title><link>https://devzone.nordicsemi.com/thread/362172?ContentTypeID=1</link><pubDate>Wed, 06 Apr 2022 18:39:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:065ed3fc-71f1-482d-8960-b270f877a473</guid><dc:creator>Erasmo</dc:creator><description>&lt;p&gt;Hi, &lt;/p&gt;
&lt;p&gt;I changed the pins&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;uart1 {
	status = &amp;quot;okay&amp;quot;;
	tx-pin = &amp;lt;36&amp;gt;;
	rx-pin = &amp;lt;37&amp;gt;;
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and the UART connection stays active.&lt;/p&gt;
&lt;p&gt;The problem was that the pin was used by the Network core when the Bluetooth is active.&lt;/p&gt;
&lt;p&gt;Thanks for the help.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Erasmo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART connection's Rx error when BT enabled</title><link>https://devzone.nordicsemi.com/thread/362082?ContentTypeID=1</link><pubDate>Wed, 06 Apr 2022 12:33:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d56f699-672b-453b-b23f-6d73dedc482d</guid><dc:creator>Jared</dc:creator><description>[quote user="Erasmo"]It seems that the RX pin is managed by the Network MCU, should I change the pin&amp;#39;s selected MCU? or does is recommendable not to change it and use another pin?[/quote]
&lt;p&gt;Interesting, this means that the pins are used by the fw that is flashed on the network core. I would suggest that you use other pins then these for your uart on the app core. Can you try to change pins and see if it still asserts?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART connection's Rx error when BT enabled</title><link>https://devzone.nordicsemi.com/thread/361914?ContentTypeID=1</link><pubDate>Tue, 05 Apr 2022 16:53:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4854597d-39d4-4a6e-adf8-7c2e2e504488</guid><dc:creator>Erasmo</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I executed this code before and after the UART is enabled to get the values you asked for (in both cases the result is the same).&lt;br /&gt;&lt;br /&gt;Code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t pin_33 = 33; // rx pin
uint32_t pin_34 = 34; // tx pin
uint32_t pin_35 = 35;
NRF_GPIO_Type *reg;

reg = nrf_gpio_pin_port_decode(&amp;amp;pin_33); // pin number is reduced by 32, modified to be the index of the array

LOG_INF(&amp;quot;Pin [%d], CNF value [%d], G field value [%d]&amp;quot;, pin_33 + 32,
        reg-&amp;gt;PIN_CNF[pin_33], (uint32_t)((reg-&amp;gt;PIN_CNF[pin_33] &amp;amp; GPIO_PIN_CNF_MCUSEL_Msk) &amp;gt;&amp;gt; GPIO_PIN_CNF_MCUSEL_Pos));

reg = nrf_gpio_pin_port_decode(&amp;amp;pin_34); // pin number is reduced by 32, modified to be the index of the array

LOG_INF(&amp;quot;Pin [%d], CNF value [%d], G field value [%d]&amp;quot;, pin_34 + 32,
        reg-&amp;gt;PIN_CNF[pin_34], (uint32_t)((reg-&amp;gt;PIN_CNF[pin_34] &amp;amp; GPIO_PIN_CNF_MCUSEL_Msk) &amp;gt;&amp;gt; GPIO_PIN_CNF_MCUSEL_Pos));

reg = nrf_gpio_pin_port_decode(&amp;amp;pin_35); // pin number is reduced by 32, modified to be the index of the array

LOG_INF(&amp;quot;Pin [%d], CNF value [%d], G field value [%d]&amp;quot;, pin_35 + 32,
        reg-&amp;gt;PIN_CNF[pin_35], (uint32_t)((reg-&amp;gt;PIN_CNF[pin_35] &amp;amp; GPIO_PIN_CNF_MCUSEL_Msk) &amp;gt;&amp;gt; GPIO_PIN_CNF_MCUSEL_Pos));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Result:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;PIN [33], CNF value [268435456], G field value [1]
PIN [34], CNF value [3], G field value [0]
PIN [35], CNF value [2], G field value [0]&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It seems that the RX pin is managed by the Network MCU, should I change the pin&amp;#39;s selected MCU? or does is recommendable not to change it and use another pin?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Erasmo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART connection's Rx error when BT enabled</title><link>https://devzone.nordicsemi.com/thread/361837?ContentTypeID=1</link><pubDate>Tue, 05 Apr 2022 12:29:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82f9edd0-9eba-473b-9566-799149e18948</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Error 8 and 4 is framing and break errors, and is usually due to floating RX pins. Could you check what core that is assigned to pin 34 and 35 by reading out &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/gpio.html?cp=3_0_0_6_12_4_10#register.PIN_CNF"&gt;the G field of CNF register&lt;/a&gt; for pin 34 and 35?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;regards&lt;br /&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART connection's Rx error when BT enabled</title><link>https://devzone.nordicsemi.com/thread/361618?ContentTypeID=1</link><pubDate>Mon, 04 Apr 2022 18:40:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18f3551f-dfae-4117-981e-1d41416ed641</guid><dc:creator>Erasmo</dc:creator><description>&lt;div&gt;
&lt;div&gt;Hi,&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;Besides the UART_1 I only initialize some buttons and leds, also the log console (UART_0) is enabled.&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;Code for the UART initialization:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define UART_BUF_SIZE (uint8_t)128
#define UART_RX_MSG_QUEUE_SIZE (uint8_t)16
#define UART_RX_TIMEOUT_MS (uint16_t)1000

static uint8_t uart_double_buffer[2][UART_BUF_SIZE];
static uint8_t *uart_buf_next = uart_double_buffer[1];

static void uart_async_callback(const struct device *uart_dev, struct uart_event *evt, void *user_data)
{
    static struct uart_msg_queue_item_t new_message;
    int rc;

    LOG_DBG(&amp;quot;New Uart Event %d&amp;quot;, evt-&amp;gt;type);

    switch (evt-&amp;gt;type)
    {
    case UART_TX_DONE:
        // Free up the written bytes in the TX FIFO
        ring_buf_get_finish(&amp;amp;app_tx_fifo, bytes_claimed);

        // If there is more data in the TX fifo, start the transmission
        if (uart_tx_get_from_queue() == ReturnCode_ok)
        {
            // Or release the semaphore if the TX fifo is empty
            k_sem_give(&amp;amp;tx_done);
        }
        break;

    case UART_RX_RDY:
        memcpy(new_message.bytes, evt-&amp;gt;data.rx.buf + evt-&amp;gt;data.rx.offset, evt-&amp;gt;data.rx.len);
        new_message.length = evt-&amp;gt;data.rx.len;

        if (k_msgq_put(&amp;amp;uart_rx_msgq, &amp;amp;new_message, K_NO_WAIT) != 0)
        {
            LOG_ERR(&amp;quot;Error: Uart RX message queue full!&amp;quot;);
        }

        break;

    case UART_RX_BUF_REQUEST:
        rc = uart_rx_buf_rsp(gDev_uart, uart_buf_next, UART_BUF_SIZE);
        if (rc != 0)
        {
            LOG_ERR(&amp;quot;Failed UART rx, error=%d&amp;quot;, rc);
            return;
        }
        break;

    case UART_RX_BUF_RELEASED:
        uart_buf_next = evt-&amp;gt;data.rx_buf.buf;
        break;

    case UART_RX_DISABLED:
        break;
    case UART_RX_STOPPED:
        // ERROR RECEIVED HERE
        LOG_ERR(&amp;quot;UART rx stopped, reason: %d&amp;quot;, evt-&amp;gt;data.rx_stop.reason);
        break;
    default:
        break;
    }
}

int uart_init()
{
    // Get device reference
    gDev_uart = device_get_binding(&amp;quot;UART_1&amp;quot;);
    if (gDev_uart == NULL)
    {
        LOG_ERR(&amp;quot;Failed to get UART binding&amp;quot;);
        return -1;
    }

    // Configure the UART device
    struct uart_config uart_config = {.baudrate = 115200, .parity = UART_CFG_PARITY_NONE, .stop_bits = UART_CFG_STOP_BITS_1, .data_bits = UART_CFG_DATA_BITS_8, .flow_ctrl = UART_CFG_FLOW_CTRL_NONE};
    int rc = uart_configure(gDev_uart, &amp;amp;uart_config);
    if (rc != 0)
    {
        LOG_ERR(&amp;quot;Failed to set UART configuration, error=%d&amp;quot;, rc);
        return rc;
    }

    rc = uart_callback_set(gDev_uart, uart_async_callback, NULL);
    if (rc != 0)
    {
        LOG_ERR(&amp;quot;Failed to set UART callback, error=%d&amp;quot;, rc);
        return rc;
    }

    return 0;
}

int uart_enable()
{
    int rc = uart_rx_enable(gDev_uart, uart_double_buffer[0], UART_BUF_SIZE, UART_RX_TIMEOUT_MS);
    if (rc != 0)
    {
        LOG_ERR(&amp;quot;Failed to enable UART rx, error=%d&amp;quot;, rc);
        return rc;
    }

    LOG_INF(&amp;quot;The UART connection has been enabled&amp;quot;);

    return 0;
}&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;Code for the bluetooth:&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int bt_init()
{
    int rc = bt_enable(NULL);
    if (rc)
    {
        LOG_ERR(&amp;quot;BT init failed (err %d)\n&amp;quot;, rc);
        return rc;
    }

    LOG_DBG(&amp;quot;Bluetooth initialized&amp;quot;);

    bt_conn_cb_register(&amp;amp;conn_callbacks);

    rc = bt_conn_auth_cb_register(&amp;amp;conn_auth_callbacks);
    if (rc)
    {
        LOG_ERR(&amp;quot;Failed to register authorization callbacks\n&amp;quot;);
        return rc;
    }

    return 0;
}

int bt_adv_start()
{
    int rc = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
    if (rc)
    {
        LOG_ERR(&amp;quot;Advertising failed to start (err %d)\n&amp;quot;, rc);
        return rc;
    }

    LOG_DBG(&amp;quot;Advertising successfully started\n&amp;quot;);

    return 0;
}&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;The execution order of the methods above in the main function is bt_init, bt_adv_start, uart_init and uart_enable. The Error is received in the UART callback almost immediately.&lt;/div&gt;
&lt;div&gt;I am using the SDK 1.8.0.&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;regards&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;Erasmo&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART connection's Rx error when BT enabled</title><link>https://devzone.nordicsemi.com/thread/361487?ContentTypeID=1</link><pubDate>Mon, 04 Apr 2022 11:35:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:442e432b-25e5-4111-b498-3b4868dbb89a</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;What other peripherals do you initialize in your project? Could you share more of your code which shows where the UART functions are called.&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>