<?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>Device hang in libuarte function when no debugger run</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71873/device-hang-in-libuarte-function-when-no-debugger-run</link><description>Hi, Our platform is NRF-52833 Our project use RS485 bus (nordic&amp;#39;s uart + a 485 chip) to communicate with other device. And we choose the libuarte to be the uart handler to tranxfer data. It works fine when device is in debugging run(segger, SWD). But</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 24 Feb 2021 14:02:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71873/device-hang-in-libuarte-function-when-no-debugger-run" /><item><title>RE: Device hang in libuarte function when no debugger run</title><link>https://devzone.nordicsemi.com/thread/296049?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 14:02:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a87f02c9-6143-4282-b635-85346f36d450</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="Jacob Lee"]Thanks for the reply.[/quote]
&lt;p&gt;No problem at all, I am happy to help!&lt;/p&gt;
[quote user="Jacob Lee"]I think I found the root cause.[/quote]
&lt;p&gt;I am glad to hear that you have found the root cause of the issue.&amp;nbsp;&lt;/p&gt;
[quote user="Jacob Lee"]&lt;p&gt;I comment the all fprintf to solve this issue.&lt;/p&gt;
&lt;p&gt;So, the fprintf will make device hang if it&amp;#39;s not in the debug mode.&lt;/p&gt;[/quote]
&lt;p&gt;Do you have RETARGET defined to 1 in your sdk_config?&lt;br /&gt;&lt;br /&gt;Did you also do as I recommended in my previous comment, and add error code checks to the returned error codes, and defined DEBUG in preprocessor defines?&lt;br /&gt;These two things will be very helpful during future development.&lt;br /&gt;&lt;br /&gt;If you issue is resolved, we may close this ticket. If so, please do not hesitate to open a new ticket if you should encounter any issues or question in the future! :)&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Device hang in libuarte function when no debugger run</title><link>https://devzone.nordicsemi.com/thread/295937?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 02:39:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44fa5771-e108-4735-bfe4-44a169f98ea3</guid><dc:creator>Jacob Lee</dc:creator><description>&lt;p&gt;Hi Karl,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for the reply.&lt;/p&gt;
&lt;p&gt;I think I found the root cause.&lt;/p&gt;
&lt;p&gt;I imported a library in out project and it use the fprintf(stdout..) to show message.&lt;/p&gt;
&lt;p&gt;I comment the all fprintf to solve this issue.&lt;/p&gt;
&lt;p&gt;So, the fprintf will make device hang if it&amp;#39;s not in the debug mode.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Maybe this issue can be related to this:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/34784/conflicting-types-for-_putchar/133776#133776"&gt;devzone.nordicsemi.com/.../133776&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Device hang in libuarte function when no debugger run</title><link>https://devzone.nordicsemi.com/thread/295782?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 10:14:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:613b6f30-8848-41c9-92eb-b360f611a8f2</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello Jacob Lee,&lt;/p&gt;
[quote user=""]But if running without debugging, device will hang after uart start to tranxfer data.&lt;br /&gt;(I create a timer to print log(RTT) periodically to check if device alive or not)[/quote]
&lt;p&gt;Could you make sure that you have DEBUG defined in your preprocessor defines, like shown in the included image?&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/7360.enabling_5F00_debug_5F00_SES.PNG" /&gt;&lt;br /&gt;I also notice that you do not check the returned error codes in your code, such as in your&amp;nbsp;rs485_byte_send function.&lt;br /&gt;You should always pass the returned error codes to an APP_ERROR_CHECK to see if the function call was successful. These checks are your only way of knowing whether a function call has failed (for whatever reason), or if your program can proceed as usual.&lt;br /&gt;If you have defined DEBUG as mentioned, any non NRF_SUCCESS returned error code will generate a detailed error message printed by your logger.&lt;br /&gt;&lt;br /&gt;Please add checks to all returned error codes and add the DEBUG define to preprocessor defines, and let me know if any error message is printed when you run the device without debugging.&lt;br /&gt;&lt;br /&gt;Looking forward to resolve this issue together!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Device hang in libuarte function when no debugger run</title><link>https://devzone.nordicsemi.com/thread/295501?ContentTypeID=1</link><pubDate>Mon, 22 Feb 2021 09:19:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1155939-ed1d-439e-be47-8721aa6f3f5a</guid><dc:creator>Jacob Lee</dc:creator><description>&lt;p&gt;The SDK version is 16.0.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>