<?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>Zephyr GPIOTE + SPIM + BLE packet missing</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89361/zephyr-gpiote-spim-ble-packet-missing</link><description>Hello, 
 I&amp;#39;m currently working with ISP2053 which is the nRF5340-based module. 
 
 The system, as the specific GPIO pin detects a low-to-high event, gets data from another device via SPI (ISP becomes a master) and sends the SPI received data via BLE.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 30 Jun 2022 15:23:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89361/zephyr-gpiote-spim-ble-packet-missing" /><item><title>RE: Zephyr GPIOTE + SPIM + BLE packet missing</title><link>https://devzone.nordicsemi.com/thread/374958?ContentTypeID=1</link><pubDate>Thu, 30 Jun 2022 15:23:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d56121a-384d-4523-873d-875dd365a7bf</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>[quote user="DL_November"]&lt;p&gt;&amp;nbsp;I mean, in the case of my debugging setup, the SPI slave device gives &amp;quot;0123456789...&amp;quot; and &amp;quot;9876543210...&amp;quot; in turn for every SPI transaction (each message has 240 bytes long). The slave device is nRF52840-DK with SPIS example from the nRF5 SDK 17.0.2 loaded.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;If everything works well, the resultant Bluetooth message from the SPIM should be the same as the SPIS message but it irregularly becomes like&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;quot;0123456789&amp;quot; &amp;quot;9876543210&amp;quot;&amp;nbsp; &amp;quot;0123456789&amp;quot; (missing) &amp;quot;0123456789&amp;quot; &amp;quot;9876543210&amp;quot;&lt;/p&gt;[/quote]
&lt;p&gt;Have you checked the SPI lines with a logic analyzer, to see if the packets are being lost between the SPI devices, or when sending over BLE?&lt;/p&gt;
[quote user="DL_November"]&amp;nbsp;Also, as I trigger the SPI transaction every 6ms and the message is 240 bytes long, the data throughput should be 40 kB/s, but it takes more than 3 seconds to take 40 kB data via Bluetooth.[/quote]
&lt;p&gt;You should check the return code (ble_err_code) from your call to&amp;nbsp;bt_nus_send(). If you call the function more often than you are able to send over BLE, the function may return an error when the buffers are full. If the throughput on BLE is too low, you may have to change the connection interval, data length, ATT MTU, PHY, connection event extension, etc. to allow more data to be sent over BLE. Please have a look at the&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.0/nrf/samples/bluetooth/throughput/README.html"&gt;Bluetooth: Throughput&lt;/a&gt;&amp;nbsp;sample.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr GPIOTE + SPIM + BLE packet missing</title><link>https://devzone.nordicsemi.com/thread/374424?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 00:36:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:214111f5-a8e8-4929-a132-aded1954e07c</guid><dc:creator>DL_November</dc:creator><description>[quote userid="14926" url="~/f/nordic-q-a/89361/zephyr-gpiote-spim-ble-packet-missing/374358"]Where does the &amp;quot;is_ble_snd&amp;quot; flag set? Have you verified that your code enters this part of the loop, either by logging or debugging?[/quote]
&lt;p&gt;&amp;nbsp;Sorry for missing that part. When I send a certain Bluetooth message from another device, that flag becomes true. I verified the code above enters the loop via debugging.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="14926" url="~/f/nordic-q-a/89361/zephyr-gpiote-spim-ble-packet-missing/374358"]Can you provide some more details about what you mean by &amp;quot;&lt;span&gt;But I think the BLE parts malfunction and the data are missed.&amp;quot;?&lt;/span&gt;[/quote]
&lt;p&gt;&amp;nbsp;I mean, in the case of my debugging setup, the SPI slave device gives &amp;quot;0123456789...&amp;quot; and &amp;quot;9876543210...&amp;quot; in turn for every SPI transaction (each message has 240 bytes long). The slave device is nRF52840-DK with SPIS example from the nRF5 SDK 17.0.2 loaded.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;If everything works well, the resultant Bluetooth message from the SPIM should be the same as the SPIS message but it irregularly becomes like&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;quot;0123456789&amp;quot; &amp;quot;9876543210&amp;quot;&amp;nbsp; &amp;quot;0123456789&amp;quot; (missing) &amp;quot;0123456789&amp;quot; &amp;quot;9876543210&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Also, as I trigger the SPI transaction every 6ms and the message is 240 bytes long, the data throughput should be 40 kB/s, but it takes more than 3 seconds to take 40 kB data via Bluetooth.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr GPIOTE + SPIM + BLE packet missing</title><link>https://devzone.nordicsemi.com/thread/374358?ContentTypeID=1</link><pubDate>Mon, 27 Jun 2022 13:52:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2448187f-a84b-49c9-9d99-e3dd4b1be03a</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Where does the &amp;quot;is_ble_snd&amp;quot; flag set? Have you verified that your code enters this part of the loop, either by logging or debugging?&lt;/p&gt;
&lt;p&gt;Can you provide some more details about what you mean by &amp;quot;&lt;span&gt;But I think the BLE parts malfunction and the data are missed.&amp;quot;?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>