<?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>Issues with writing my own project that communicates with a computer over USB.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59311/issues-with-writing-my-own-project-that-communicates-with-a-computer-over-usb</link><description>Hi, 
 
 I&amp;#39;ve been trying to combine the spi_slave and USB_CDC_ADM examples so that I can pipe data from a spi_master all the way to my host machine. In my cobbled together project, the SPI transactions are working, but the USB isn&amp;#39;t being properly sensed</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 26 Mar 2020 18:45:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59311/issues-with-writing-my-own-project-that-communicates-with-a-computer-over-usb" /><item><title>RE: Issues with writing my own project that communicates with a computer over USB.</title><link>https://devzone.nordicsemi.com/thread/241959?ContentTypeID=1</link><pubDate>Thu, 26 Mar 2020 18:45:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21de2f24-0856-45bd-9638-171c54298c2d</guid><dc:creator>ryerye120</dc:creator><description>&lt;p&gt;Yea, that gave me some other issues. Since I really only care about the bits, I&amp;#39;ve switched to calculating a 32 bit value from the rx_buff and outputting that. While this fixed some string related null character handling, I&amp;#39;m still outputting nothing over the LOG and the actual (expected) number over USB, so I wonder if there&amp;#39;s an order of operations issue. I&amp;#39;ll step through with the debugger.&lt;/p&gt;
&lt;p&gt;Thanks for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues with writing my own project that communicates with a computer over USB.</title><link>https://devzone.nordicsemi.com/thread/241333?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 10:51:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c427378-b242-4349-a089-e1bd357155c5</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I don&amp;#39;t think using the buffer as a string is a good idea here. A char array can be a string if the end of the array has a NULL character &amp;#39;/0&amp;#39; which you don&amp;#39;t have.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To copy from one array to another array you can use memcpy instead.&lt;/p&gt;
&lt;p&gt;What I can see is that your&amp;nbsp; rx buffer is only 4 bytes, I dont know how you can get &amp;quot;comes_from_spi_mastr&amp;quot; as in the log.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Please get familiar with debugging, try to put a break point and view the buffer to see what you have there.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues with writing my own project that communicates with a computer over USB.</title><link>https://devzone.nordicsemi.com/thread/241226?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2020 17:45:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5a01a6f-6736-42e7-8342-854e2b893593</guid><dc:creator>ryerye120</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve attached my main.c and sdkconfig.h. I&amp;#39;m using&amp;nbsp;nRF5 SDK v16.0.0.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As fare as how data is being passed from the SPI to the USB, I&amp;#39;m just taking the SPI_rx buffer and sprintf-ing it into the USB_tx buffer (corresponding lines copied below):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;        size_t size = sprintf(m_tx_buffer, &amp;quot;Hello USB CDC demo: %s\r\n&amp;quot;, (uint32_t)spi_rx_buf);
        app_usbd_cdc_acm_write(&amp;amp;m_app_cdc_acm, m_tx_buffer, size);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4532.main.c"&gt;devzone.nordicsemi.com/.../4532.main.c&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/6685.sdk_5F00_config.h"&gt;devzone.nordicsemi.com/.../6685.sdk_5F00_config.h&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues with writing my own project that communicates with a computer over USB.</title><link>https://devzone.nordicsemi.com/thread/241172?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2020 14:28:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8584291e-0afd-44a5-a265-bc517e08039b</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;br /&gt;Please post your code, and state which SDK you are using.&amp;nbsp;&lt;br /&gt;Please track down on how you pass the data from SPI to USB.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues with writing my own project that communicates with a computer over USB.</title><link>https://devzone.nordicsemi.com/thread/240956?ContentTypeID=1</link><pubDate>Fri, 20 Mar 2020 19:50:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab776ac4-8fca-4292-8ba4-3603d39aef35</guid><dc:creator>ryerye120</dc:creator><description>&lt;p&gt;Okay, the problem was that I wasn&amp;#39;t running&amp;nbsp;app_usbd_event_queue_process() to actually process any USB events. I must have accidentally forgotten to copy it over. I have a new issue though.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve set up two dev kits, a SPI master &amp;amp; a SPI slave. The Master sends a message &amp;quot;comes_from_spi_mstr&amp;quot; to the slave, which then pipes it to my desktop via USB.&amp;nbsp;What&amp;#39;s weird is that the message makes its way to my computer (I see &amp;quot;comes_from_spi_mstr&amp;quot; on computer from the USB&amp;#39;s COM port)... but when I print the SPI&amp;#39;s rx buffer through the logger it comes up empty.&lt;/p&gt;
&lt;p&gt;Here are photos to show what&amp;#39;s happening:&lt;/p&gt;
&lt;p&gt;SPI logger output:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1584733755684v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;USB output:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1584733776148v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Any idea why&amp;nbsp;it&amp;#39;s not coming up in the logger, despite being there (as shown by making its way all the way through the USB).&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Ryan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues with writing my own project that communicates with a computer over USB.</title><link>https://devzone.nordicsemi.com/thread/240949?ContentTypeID=1</link><pubDate>Fri, 20 Mar 2020 17:50:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65cd0cda-e3ad-4653-ada1-70252d0ed1f0</guid><dc:creator>ryerye120</dc:creator><description>&lt;p&gt;I think it has to do with something in my sdk_config.h. I&amp;#39;ve removed most of the SPI code now. Aside from defining the SPI handler and enabling the SPI in the SDK_config, the SPI isn&amp;#39;t doing anything (i.e. no SPI code in my main). I have the same issue.&lt;/p&gt;
&lt;p&gt;I took a look at the properties tab and there are two events. I&amp;#39;ve copied both below:&lt;/p&gt;
&lt;p&gt;The first one (Driver name is &amp;#39;null&amp;#39; which seems like a problem. The drivers should be installed!):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Device USB\VID_1915&amp;amp;PID_520C\000000000000 was configured.

Driver Name: null
Class Guid: {00000000-0000-0000-0000-000000000000}
Driver Date: 
Driver Version: 
Driver Provider: 
Driver Section: 
Driver Rank: 0x0
Matching Device Id: 
Outranked Drivers: 
Device Updated: false
Parent Device: USB\VID_045E&amp;amp;PID_0944\6&amp;amp;15ba3093&amp;amp;0&amp;amp;1
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The second one:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Device USB\VID_1915&amp;amp;PID_520C\000000000000 was not migrated due to partial or ambiguous match.

Last Device Instance Id: USB\VID_0403&amp;amp;PID_6010\003017A40B1B
Class Guid: {36fc9e60-c465-11cf-8056-444553540000}
Location Path: PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(1)#USB(1)#USB(2)
Migration Rank: 0xF000FFFFFFFF0123
Present: false
Status: 0xC0000719
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So it seems maybe I&amp;#39;m messing up some USB params in my sdk_config.h? I&amp;#39;ll take a more extensive look through it right now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issues with writing my own project that communicates with a computer over USB.</title><link>https://devzone.nordicsemi.com/thread/240885?ContentTypeID=1</link><pubDate>Fri, 20 Mar 2020 13:25:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9bde5f65-f86d-49ca-b688-7572a5ce5acc</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Rye,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you check what&amp;#39;s the issue with the nRF52 USB Product (right click and click properties)&lt;br /&gt;I would suggest to comment out the SPI functionality part by part until you see the USB work again, this way we can track down what caused the issue.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>