<?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>BUS fault/kerel panic on NUS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95099/bus-fault-kerel-panic-on-nus</link><description>Hello Nordic team, 
 Our team deveopment a BLE NUS project, we use nrf5340 as BLE peripheral and nrf52840 dongle as BLE central. (NCS v1.8.0) 
 We use nrf52840 dongle transfer CMD data to nrf5340 by NUS. 
 If transfer data continously, it will make a</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 23 Dec 2022 01:53:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95099/bus-fault-kerel-panic-on-nus" /><item><title>RE: BUS fault/kerel panic on NUS</title><link>https://devzone.nordicsemi.com/thread/402023?ContentTypeID=1</link><pubDate>Fri, 23 Dec 2022 01:53:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:199793c7-9c66-489b-ac13-5e86645a2351</guid><dc:creator>allenboon</dc:creator><description>&lt;p&gt;Hello Edvin,&lt;/p&gt;
&lt;p&gt;I have solved this issue yesterday, it seems a buffer overflow issue. But, the function still have strange condition.&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;color:#333333;"&gt;&lt;strong&gt;Are you actually receiving your data from a uart input? (I am asking since you are using a dongle, which doesn&amp;#39;t have anything connected to the UART pins by default.)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;color:#333333;"&gt;Yes, because I do not have enough time to add usb function to central uart code. So, I connect another UART converter(a CP210x UART brigge) to dongle UART pins. It can works transfer &amp;amp; read data.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="background-color:#ffffff;color:#333333;"&gt;How long are the packets that you are trying to send? Is it always less than 20 bytes?&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;color:#333333;"&gt;My function only need transfer 8 - 9 bytes (include C/R character). &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;color:#333333;"&gt;I tried use some log. Then, I found issue like if host uart send 9 bytes. central_uart uart_cb function only recieved 8 bytes.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;color:#333333;"&gt;Because FW cannot detect C/R character, so it do not send data to peripheral (I mean below source code in uart_cb function)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;color:#333333;"&gt;&lt;pre class="ui-code" data-mode="text"&gt;	case UART_RX_RDY:
		//LOG_INF(&amp;quot;UART_RX_RDY&amp;quot;);
		buf = CONTAINER_OF(evt-&amp;gt;data.rx.buf, struct uart_data_t, data);
		buf-&amp;gt;len += evt-&amp;gt;data.rx.len;
		buf_release = false;
		LOG_HEXDUMP_INF(buf-&amp;gt;data, buf-&amp;gt;len, &amp;quot;uart rx&amp;quot;);
		if (buf-&amp;gt;len == UART_BUF_SIZE) {
			k_fifo_put(&amp;amp;fifo_uart_rx_data, buf);
		} else if ((evt-&amp;gt;data.rx.buf[buf-&amp;gt;len - 1] == &amp;#39;\n&amp;#39;) ||
			  (evt-&amp;gt;data.rx.buf[buf-&amp;gt;len - 1] == &amp;#39;\r&amp;#39;)) {
			k_fifo_put(&amp;amp;fifo_uart_rx_data, buf);
			current_buf = evt-&amp;gt;data.rx.buf;
			buf_release = true;
			uart_rx_disable(uart);
		}

		break;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;color:#333333;"&gt;So, my host do not know data loss condition and host have retry &lt;span&gt;mechanism&lt;/span&gt;. The uart_cb rx fifo will increase more and more. At the end, the fifo will overflow, more than the prj setting&amp;nbsp;&lt;/span&gt;CONFIG_UART_0_NRF_TX_BUFFER_SIZE value.&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;color:#333333;"&gt;Then I tried to set&amp;nbsp;&lt;span&gt;CONFIG_UART_0_NRF_TX_BUFFER_SIZE&amp;nbsp;is multiple of transfer data bytes. It still have loss data condition, but the retry&amp;nbsp;mechanism works. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="background-color:#ffffff;color:#333333;"&gt;In the meanwhile. Do I need anything other to reproduce your issue?&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;color:#333333;"&gt;&lt;span&gt;I have solved this issue, I think you do not need to reproduce issue.&amp;nbsp; But,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="background-color:#ffffff;color:#333333;"&gt;&lt;span&gt;I do not know why uart_cb&amp;nbsp; will have loss data issue. if you any other suggestions, please feel free to provide them.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Finally, thanks your reply. Have a nice Holiday Season!!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Allen.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BUS fault/kerel panic on NUS</title><link>https://devzone.nordicsemi.com/thread/401920?ContentTypeID=1</link><pubDate>Thu, 22 Dec 2022 12:37:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aecec88b-acf9-47aa-baf0-12954d125f17</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Allen,&lt;/p&gt;
&lt;p&gt;What, in particular makes you think it is related to the issue in your link? And did you try applying the fix that was proposed in that ticket?&lt;/p&gt;
&lt;p&gt;Are you actually receiving your data from a uart input? (I am asking since you are using a dongle, which doesn&amp;#39;t have anything connected to the UART pins by default.)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;How long are the packets that you are trying to send? Is it always less than 20 bytes? Or did you increase the MTU size? Sorry, your project probably holds answer to most of my questions, but I am on my way out of the office, and we are really short staffed because of Holiday Season. I am sorry for the inconvenience, but we will be back to normal operation in January.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the meanwhile. Do I need anything other to reproduce your issue? Did you try this using two DKs instead of a Dongle and a DK? The reason I ask is that we don&amp;#39;t have any dongles with debuggers, so it is a bit more difficult to debug on those.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>