<?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>USBD write</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73375/usbd-write</link><description>Hi, 
 I read data from FDS and output it to nRF USB. The output is implemented by 
 app_usbd_cdc_acm_write (&amp;amp;m_app_cdc_acm, m_tx_buffer, (sizeof(m_tx_buffer)); 
 But I only see the last item on the output. Please, what is the problem so that I can see</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 06 Apr 2021 10:11:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73375/usbd-write" /><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/303086?ContentTypeID=1</link><pubDate>Tue, 06 Apr 2021 10:11:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d94a421a-dca6-4cef-8b0b-3134efbdfc43</guid><dc:creator>Regio</dc:creator><description>&lt;p&gt;Hi Dmitry,&lt;/p&gt;
&lt;p&gt;Thak you for your interest for my problem.&lt;/p&gt;
&lt;p&gt;The problem was interrupts.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Regio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/302990?ContentTypeID=1</link><pubDate>Mon, 05 Apr 2021 21:40:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f902fdc1-7004-4955-ae75-0b8dad6e2aee</guid><dc:creator>Regio</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;I am grateful for your time.&lt;/p&gt;
&lt;p&gt;The problem i solved was in iterruptions.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Regio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/302827?ContentTypeID=1</link><pubDate>Thu, 01 Apr 2021 02:27:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3832ce1-1b8c-461c-9904-e100ae5ce942</guid><dc:creator>Regio</dc:creator><description>&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;Hi Dmitry, thanks for the reply,&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;Yes you are right in the given code ret is missing, but in the app it is. I apologize. lost in rewriting.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;Yes of course I check&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; ret.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;ret = 0 when making a write, &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;ret = 17 when busy, loading data from FDS &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;ret = 8 when PuTTy terminal is not available ... .&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;The logic of the code is simple after pressing the button the FDS output is activated. &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;My code is in draft. contains more alternatives. I&amp;#39;ll make a simple version and send. &lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/302826?ContentTypeID=1</link><pubDate>Thu, 01 Apr 2021 02:20:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72b538c8-6cc5-4b8e-8297-f3d829444dd4</guid><dc:creator>Regio</dc:creator><description>&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;Hi Edvin, thanks for the reply,&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;Edvin&amp;#39;s side: &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;what is sizeof(read_data) ini this case? Try printing it to the log. Is it the length that you expect it to be? What do you expect it to be, and what was it?&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;Yes it is exactly the length i expect.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;Edvin side:&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;Also, you may want to look into the sprintf() call. Try debugging and see if m_tx_buffer[] is what you expect it to be after line 21 is executed (set a breakpoint on line 23).&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;Yes in m_tx_buffer [] is the expected value.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;In another part of the code, I continuously read the values via BLE, app_usbd_cdc_acm_write works OK. Lists all values. &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-bottom:0cm;"&gt;&lt;span lang="en"&gt;For FDS, only the last value. NRF_ERROR_BUSY reports when reading data from FDS. &lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/302800?ContentTypeID=1</link><pubDate>Wed, 31 Mar 2021 16:41:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d69645a2-9ba9-4ef8-86ee-279e33138aec</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;I mean, if you&amp;#39;re going to check the result of&amp;nbsp;app_usbd_cdc_acm_write(), there should be an assignment:&lt;/p&gt;
&lt;p&gt;ret = app_usbd_cdc_acm_write(...)&lt;/p&gt;
&lt;p&gt;Also it&amp;#39;s hard to understand the complete logic of your code by these snippets, please post&amp;nbsp;the whole code&amp;nbsp;relevant to USB handling (cut out any app logic if there&amp;#39;s something confidential).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/302767?ContentTypeID=1</link><pubDate>Wed, 31 Mar 2021 13:37:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f99bd97-3184-4893-b040-8ab675d59b6b</guid><dc:creator>Regio</dc:creator><description>&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;ret assigns 0&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/302760?ContentTypeID=1</link><pubDate>Wed, 31 Mar 2021 13:25:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b6eb44e-2eac-4b6e-9e05-3e2772e9352e</guid><dc:creator>Regio</dc:creator><description>&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;This is what I expect&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;app_usbd_cdc_acm_write(&amp;amp;m_app_cdc_acm,
                          m_tx_buffer,      
                              (12)+2); &lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/302740?ContentTypeID=1</link><pubDate>Wed, 31 Mar 2021 12:59:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:352b9a72-91fb-4d9b-b33e-f04a5d13ae1a</guid><dc:creator>Dmitry</dc:creator><description>&lt;pre&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;if(ret == NRF_ERROR_BUSY)&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;where does your &lt;strong&gt;ret&lt;/strong&gt; assigns something?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/302737?ContentTypeID=1</link><pubDate>Wed, 31 Mar 2021 12:54:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d92b3150-14d4-4f8e-8c58-70a15f4ea23d</guid><dc:creator>Regio</dc:creator><description>&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;Hi Dmitry,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;thank you for your response.&lt;pre class="ui-code" data-mode="text"&gt;if(new_usb_packet &amp;gt; 0 &amp;amp;&amp;amp; usb_busy == false)
	   {
		   sprintf(&amp;amp;m_tx_buffer[12], &amp;quot;\r\n&amp;quot;);
          
       app_usbd_cdc_acm_write(&amp;amp;m_app_cdc_acm,
                                 m_tx_buffer,      
                    (sizeof(read_data)*2)+2);      
 					
		      if(ret == NRF_ERROR_BUSY)
		      {
		      NRF_LOG_INFO(&amp;quot;usb_busy = true&amp;quot;);
		      usb_busy = true;
		      }
		      else if(ret != NRF_SUCCESS)
		      {
		      NRF_LOG_INFO(&amp;quot;USB ret != NRF_SUCCESS&amp;quot;);
		      }
		      else
		      {
		      new_usb_packet--;
          }
      }&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;I&amp;#39;ve already done that and it didn&amp;#39;t help to see the code&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/302734?ContentTypeID=1</link><pubDate>Wed, 31 Mar 2021 12:38:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07c62ee5-a185-4d8a-83a6-b287dea55066</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;          app_usbd_cdc_acm_write(&amp;amp;m_app_cdc_acm,
                                    m_tx_buffer,      
                       (sizeof(read_data)*2)+2);  &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;what is sizeof(read_data) ini this case? Try printing it to the log. Is it the length that you expect it to be? What do you expect it to be, and what was it?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, you may want to look into the sprintf() call. Try debugging and see if m_tx_buffer[] is what you expect it to be &lt;strong&gt;after&lt;/strong&gt; line 21 is executed (set a breakpoint on line 23).&lt;/p&gt;
&lt;p&gt;&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><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/302725?ContentTypeID=1</link><pubDate>Wed, 31 Mar 2021 12:14:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a75f7ef-78b2-4473-811b-5d63f3658b93</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;app_usbd_cdc_acm_write() has no internal buffering, you should wait for APP_USBD_CDC_ACM_USER_EVT_TX_DONE event after sending an item.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/302716?ContentTypeID=1</link><pubDate>Wed, 31 Mar 2021 11:48:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76b5e613-08c3-4986-8cae-12fac429740e</guid><dc:creator>Regio</dc:creator><description>&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;Hi&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;app_usbd_cdc_acm_write from the sent code lists only the last item in the list.&lt;/span&gt;&lt;/span&gt;&lt;span class="JLqJ4b"&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;How to edit the code to list all items from the list?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/302625?ContentTypeID=1</link><pubDate>Tue, 30 Mar 2021 14:46:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ecfdca6-31df-4c0e-9fc3-2362ab77a577</guid><dc:creator>Regio</dc:creator><description>&lt;p&gt;HI Edvin,&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;Thank you for your response&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;The data in the FDS is read and displayed correctly.&lt;pre class="ui-code" data-mode="c_cpp"&gt;NRF_LOG_INFO(&amp;quot;Start searching... \r\n&amp;quot;);
	
	while (fds_record_find(read_file_id, relevant_record_key, &amp;amp;record_desc, &amp;amp;ftok) == NRF_SUCCESS)
	{
		err_code = fds_record_open(&amp;amp;record_desc, &amp;amp;flash_record);
		if ( err_code != NRF_SUCCESS)
		{
			return err_code;		
		}
	
	  memcpy(read_data, flash_record.p_data, flash_record.p_header-&amp;gt;length_words * sizeof(uint32_t));
	  NRF_LOG_HEXDUMP_INFO(read_data, sizeof(read_data));	

               for (int i = 0; i &amp;lt; 6 ; i++)       
               {
         
                sprintf(&amp;amp;m_tx_buffer[i*2], &amp;quot;%02x&amp;quot;, read_data[i]);
        
               }

          sprintf(&amp;amp;m_tx_buffer[12], &amp;quot;\r\n&amp;quot;);   

          app_usbd_cdc_acm_write(&amp;amp;m_app_cdc_acm,
                                    m_tx_buffer,      
                       (sizeof(read_data)*2)+2);     
            
      	  err_code = fds_record_close(&amp;amp;record_desc);
	      if (err_code != NRF_SUCCESS)
	      {
		return err_code;	
	      }
	}&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD write</title><link>https://devzone.nordicsemi.com/thread/302606?ContentTypeID=1</link><pubDate>Tue, 30 Mar 2021 13:41:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27af0393-abee-4d9c-863a-5518c96519f3</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;It is a bit difficult to say without knowing anything about your implementation of the fds or the usb. Perhaps you can share something?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Typical pitfalls:&lt;/p&gt;
&lt;p&gt;FDS not done reading/writing before you use it. Wait for the callbacks.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;How do you pass it to the usb?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>