<?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>The adc-uart sampling is only about 9k.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73613/the-adc-uart-sampling-is-only-about-9k</link><description>I am using the SAADC example to check the sampling rate between ADC and UART. 
 
 I am using an Arduino serial plotter and logic analyzer to check the correct data. 
 
 To check this, the following settings were made. 
 1 Hz, 3.3 Vp-p 
 0.nRF52832 Baud</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 07 Apr 2021 14:07:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73613/the-adc-uart-sampling-is-only-about-9k" /><item><title>RE: The adc-uart sampling is only about 9k.</title><link>https://devzone.nordicsemi.com/thread/303551?ContentTypeID=1</link><pubDate>Wed, 07 Apr 2021 14:07:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:019e3fb9-9a7f-447a-94f8-2f08a24066c3</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="odenwar"]How do you handle the above method?[/quote]
&lt;p&gt;Please keep in mind that I have no prior knowledge of the &amp;#39;Arduino optimized float&amp;#39; implementation you reference - but it sounds to me like it is just a regular float type (4 bytes) with 2 bytes tacked on at the end, to delimitate the float, is this correct?&lt;br /&gt;If so, you expect to send these two static bytes at the end of every float (every sample) you send. If you instead just do not send them, but add them at the receiver side (which might be an arduino?) instead, you save yourself the trouble of sending the two end characters over and over - since they always will be present.&lt;br /&gt;So, you just send the 4 meaningful float bytes, and every time the Arduino receives a new float (every 4 bytes), it adds the delimination characters to the end.&lt;br /&gt;I might have misunderstood you earlier, and I am unable to find any direct reference to &amp;#39;Arduino optimized float&amp;#39;, so my suggestion might not be applicable.&lt;br /&gt;Please let me know if I should elaborate on this, or if any part of my suggestion is unclear.&lt;/p&gt;
[quote user="odenwar"]I&amp;#39;ll check it out during business hours.[/quote]
&lt;p&gt;Great, I look forward to hearing how it goes!&lt;br /&gt;Please also see my earlier suggestion about increasing the sample buffer size.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The adc-uart sampling is only about 9k.</title><link>https://devzone.nordicsemi.com/thread/303265?ContentTypeID=1</link><pubDate>Tue, 06 Apr 2021 15:39:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c7b6cba-55c8-423c-957b-c30d8dc8d4be</guid><dc:creator>odenwar</dc:creator><description>[quote userid="87869" url="~/f/nordic-q-a/73613/the-adc-uart-sampling-is-only-about-9k/303257#303257"]If you wish to maximize the frequency of useful bytes you should instead just send the 4 meaningful float bytes, and then add the 2 arduino overhead bytes on the receiver side. This will increase your throughput of SAADC samples by 33%, so its quite the improvement.[/quote]
&lt;p&gt;How do you handle the above method?&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/73613/the-adc-uart-sampling-is-only-about-9k/303257#303257"]Could you also tell me whether you are using the deferred logging option or not, like I asked in my previous comment? This is set by the&amp;nbsp;NRF_LOG_DEFERRED define in your sdk_config.h file.&lt;br /&gt;If this is the case, your logger will only process the logs once NRF_LOG_PROCESS is called, which typically is only when the CPU has nothing else to do - right before going to SYSTEM ON sleep.[/quote]
&lt;p&gt;I&amp;#39;ll check it out during business hours.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The adc-uart sampling is only about 9k.</title><link>https://devzone.nordicsemi.com/thread/303257?ContentTypeID=1</link><pubDate>Tue, 06 Apr 2021 15:21:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c4c38ea-fef6-4311-a890-10f053260241</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="odenwar"]Thank you for responding to complex questions.[/quote]
&lt;p&gt;No problem at all, I am happy to help!&lt;/p&gt;
[quote user="odenwar"]The final goal of this question is I would like to use all the resources of UART for ADC data output.[/quote][quote user="odenwar"]The version you are using is 15.3.0.[/quote]
&lt;p&gt;Thank you for clarifying, this is very helpful for me to understand your issue and goal.&amp;nbsp;&lt;/p&gt;
[quote user="odenwar"]&lt;p&gt;1Hz,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1Hz Freq Sine wave.&lt;br /&gt;3.3 Ampl Vp-p&amp;nbsp;&lt;br /&gt;1.65V Offset&lt;/p&gt;[/quote]
&lt;p&gt;Aha, I not understand that you were referring to what is being sampled. Thank you for clarifying. I was not sure if this was the case, since exactly what is being measured does not matter for the frequency of the samples and their output through UART - but it is good to have mentioned never the less, thank you.&lt;/p&gt;
[quote user="odenwar"]1 Shipping data optimized for uart graph drawing is as follows.&lt;br /&gt;Data character [4 bytes] + (\r\n) [2 bytes]&lt;br /&gt;It is a total of 6 bytes.[/quote]
&lt;p&gt;If you wish to maximize the frequency of useful bytes you should instead just send the 4 meaningful float bytes, and then add the 2 arduino overhead bytes on the receiver side. This will increase your throughput of SAADC samples by 33%, so its quite the improvement.&lt;br /&gt;&lt;br /&gt;Furthermore, you could try to increase the sample buffer size, as mentioned in my previous comment.&lt;/p&gt;
[quote user="odenwar"]I want to capture the ADC data 70us after data transmission and send it to uart. (For 10us spare, the shorter the better, but if there is no problem, I want to send it immediately.)[/quote]
&lt;p&gt;If you want the sample to happen exactly 70us after the previous sample was successfully transmitted, you should setup a timer to start when you receive the TX success event. Are you currently using&amp;nbsp;NRF_LOG_RAW_INFO to send over the UART?&lt;br /&gt;If you would like to reduce the time between bytes sent, you should use the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/group__nrfx__uarte.html"&gt;UARTE driver&lt;/a&gt; directly.&lt;br /&gt;&lt;br /&gt;Could you also tell me whether you are using the deferred logging option or not, like I asked in my previous comment? This is set by the&amp;nbsp;NRF_LOG_DEFERRED define in your sdk_config.h file.&lt;br /&gt;If this is the case, your logger will only process the logs once NRF_LOG_PROCESS is called, which typically is only when the CPU has nothing else to do - right before going to SYSTEM ON sleep.&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: The adc-uart sampling is only about 9k.</title><link>https://devzone.nordicsemi.com/thread/303246?ContentTypeID=1</link><pubDate>Tue, 06 Apr 2021 15:04:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efee62ee-270c-4710-b660-2ddc0b6641a0</guid><dc:creator>odenwar</dc:creator><description>&lt;p&gt;The final goal of this question is I would like to use all the resources of UART for ADC data output.&lt;/p&gt;
&lt;p&gt;We will answer your questions on this basis.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/73613/the-adc-uart-sampling-is-only-about-9k/303220#303220"]but it fails in communication at 70us.[/quote]
&lt;p&gt;Please check the third image.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;60us about Data transmission,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I want to capture the ADC data 70us after data transmission and send it to uart. (For 10us spare, the shorter the better, but if there is no problem, I want to send it immediately.)&lt;/p&gt;
&lt;p&gt;The version you are using is 15.3.0.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/73613/the-adc-uart-sampling-is-only-about-9k/303220#303220"] I am not sure that I am seeing any 1 Hz configuration[/quote]
&lt;p&gt;1Hz,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1Hz Freq Sine wave.&lt;br /&gt;3.3 Ampl Vp-p&amp;nbsp;&lt;br /&gt;1.65V Offset&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1617720879441v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/73613/the-adc-uart-sampling-is-only-about-9k/303220#303220"]the optimized Arduino float output[/quote]
&lt;p&gt;This is the contents of using Arduino&amp;#39;s serial plotter program.&lt;/p&gt;
&lt;p&gt;1 Shipping data optimized for uart graph drawing is as follows.&lt;br /&gt;Data character [4 bytes] + (\r\n) [2 bytes]&lt;br /&gt;It is a total of 6 bytes.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When sending data continuously, is 20k correct as I calculated? &lt;br /&gt;What is the maximum number of samples for ADC between uart 1000000 baud rate at 12bit ADC?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you for responding to complex questions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The adc-uart sampling is only about 9k.</title><link>https://devzone.nordicsemi.com/thread/303220?ContentTypeID=1</link><pubDate>Tue, 06 Apr 2021 14:21:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:707f54d7-4d7d-4974-8147-8ef2c67cc091</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]but it fails in communication at 70us.[/quote]
&lt;p&gt;Please elaborate what you mean when you say that it fails at 70us. Do you mean that you are not seeing the sample output on UART every 70 us, or are you saying that a sample is not taken every 70us?&lt;br /&gt;Please also tell me if you are using the deferred logging option. This option will postpone log-processing until you reach your power management loop in the main context.&lt;br /&gt;&lt;br /&gt;I am also not exactly sure what you mean when you say &amp;quot;I want to make 110us-40us, 70us data transmission cycle&amp;quot;.&lt;br /&gt;Are you saying that you would like your current setup of a sample written to UART every 110us to instead write out the sample every 70us to UART?&lt;br /&gt;To reduce the time actively spent by the CPI in the SAADC interrupt handler you could increase your sample buffer size. A size of 1 means that you CPU has to intervene and go through the SAADC interrupt handler every time a sample is produced.&lt;br /&gt;Additionally, please be aware that you are using the default channel configuration which uses 10us acquisition time.&lt;br /&gt;&lt;br /&gt;Could you also tell me which SDK version you are using?&lt;/p&gt;
[quote user=""]&lt;p&gt;To check this, the following settings were made.&lt;/p&gt;
&lt;p&gt;1 Hz, 3.3 Vp-p&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;0.nRF52832&lt;br /&gt;&amp;nbsp; &amp;nbsp; Baud rate 1000000&lt;br /&gt;&amp;nbsp; &amp;nbsp; ADC Sampling bit 12bit&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;Modify the source code to check the optimized Arduino float output value (data [4byte] + newline character [2byte] = 6byte)&lt;/p&gt;[/quote]
&lt;p&gt;I understand that you are working with the SAADC peripheral example from the SDK, and that you have made some changes to it. Could you elaborate on these two changes you have detailed? I am not sure that I am seeing any 1 Hz configuration, and I am not sure how you have included / what you mean when saying &amp;#39;the optimized Arduino float output&amp;#39;. Please elaborate on this so I may understand your issue better.&lt;br /&gt;&lt;br /&gt;Looking forward to resolving 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></channel></rss>