<?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>Tips on making a UART sensor driver for nRF9160</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73146/tips-on-making-a-uart-sensor-driver-for-nrf9160</link><description>Hi. 
 I&amp;#39;m developing a sensor driver for the Spec Sensors DGS-O3 968-042 UART gas sensor for the nRF9160 (Thingy:91 to be precise) 
 The general gist of it is that I need to send a character command to the sensor, and get a sensor value in return with</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 06 Apr 2021 09:31:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73146/tips-on-making-a-uart-sensor-driver-for-nrf9160" /><item><title>RE: Tips on making a UART sensor driver for nRF9160</title><link>https://devzone.nordicsemi.com/thread/303056?ContentTypeID=1</link><pubDate>Tue, 06 Apr 2021 09:31:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06e81391-ef82-459e-bc46-87e2159362e0</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi, Patric!&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thanks for reaching out!&lt;br /&gt;1.&amp;nbsp;Power consumption is mostly tied to CPU activity, so whether you use threading or callbacks should not matter as long as you are well aware of what happens in your thread/callback. However, note that the standard serial implementation of Zephyr use an average of about&amp;nbsp;600uA. If that&amp;#39;s to&amp;nbsp;high I suggest using the Low-Power UART implementation.&amp;nbsp;&lt;br /&gt;2. They are very similar, but from what I know the asynchronous API is newer and more straightforward to use compared to the interrupt driven UART.&amp;nbsp;&lt;br /&gt;3. In Zephyr peripheral settings, like baudrate and TX/RX pins for UART, are configured before compilation. This is done through Device Tree overlay files, like the ones you can find in the &lt;a href="https://github.com/nrfconnect/sdk-nrf/tree/master/samples/peripheral/lpuart/boards"&gt;board folder&lt;/a&gt; of the Low Power UART sample.&lt;br /&gt;&lt;br /&gt;I hope this answers some of your questions! For more examples of using UART in context you can also check out the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/central_uart/README.html"&gt;central_uart&lt;/a&gt; and &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/peripheral_uart/README.html"&gt;peripheral_uart&lt;/a&gt; bluetooth samples. While they aren&amp;#39;t made for the nRF9160 I believe they give a good demonstration of how the UART can be used.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Apologies for the delayed answer and thank you for your patience!&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>