<?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>802.15.4 callback Issues</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83999/802-15-4-callback-issues</link><description>Hi, 
 We are developing a wireless protocol based upon 802.15.4 for nRF52840 and have some trouble with the MAC layer. To begin with, a mlme reset is requested and then an active scan. 
 The first issue is memory allocation, using sys_mm_alloc() to allocate</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Feb 2022 12:20:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83999/802-15-4-callback-issues" /><item><title>RE: 802.15.4 callback Issues</title><link>https://devzone.nordicsemi.com/thread/350870?ContentTypeID=1</link><pubDate>Wed, 02 Feb 2022 12:20:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22351112-84d1-429b-a2b6-8e9ef69bf5b8</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;nbsp;have been trying to look internally, but I cannot find anywhere stating why this function is&amp;nbsp;needed. However, I see that it is called at the beginning of main() in the 802.15.4 Wireless UART example as well. I suspect that it is necessary for RADIO IRQ to work and be handled correctly.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 802.15.4 callback Issues</title><link>https://devzone.nordicsemi.com/thread/350859?ContentTypeID=1</link><pubDate>Wed, 02 Feb 2022 11:55:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a687dc2-4758-4b84-accb-8e5e66d585f8</guid><dc:creator>Andreas3T</dc:creator><description>&lt;p&gt;I found the actual issue or at least what made active scan work.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Calling &lt;pre class="ui-code" data-mode="text"&gt;ral_irq_handlers_import()&lt;/pre&gt; was required for active scan to properly work. I have no way of telling why, I&amp;#39;m not using the RAL module at all and it isn&amp;#39;t mentioned in the documentation as an requirement. &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 802.15.4 callback Issues</title><link>https://devzone.nordicsemi.com/thread/350620?ContentTypeID=1</link><pubDate>Tue, 01 Feb 2022 10:33:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea4ea669-103a-41a8-909a-01fe6438a2d2</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi Andreas,&lt;/p&gt;
&lt;p&gt;Good to hear that the issue solved itself, even if you had to reinstall everything &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Thank you for sharing your code here for others to find, it is greatly appreciated!&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 802.15.4 callback Issues</title><link>https://devzone.nordicsemi.com/thread/350575?ContentTypeID=1</link><pubDate>Tue, 01 Feb 2022 08:38:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9856e4ba-bddf-4ec8-8a71-441bed6ed959</guid><dc:creator>Andreas3T</dc:creator><description>&lt;p&gt;Due to some OS issues noticed when installing wireshark I ended up reinstalling Ubuntu from scratch and the development environment as well of course. For some reason everything started working fine after this without any changes in the code.&lt;/p&gt;
&lt;p&gt;If I had to guess the reason for the issue it could have been the wrong compiler version or that the 802.15.4 binary was corrupt. If anyone else have similar issues I will leave the correct code for making an active scan below.&lt;/p&gt;
&lt;p&gt;Note that scan type and scan duration is hardcoded in the example.&lt;/p&gt;
&lt;p&gt;Thanks Marte for the help.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define CONFIRM_SCAN_SIZE 7
void mlme_scan_conf_cb(mlme_scan_conf_t * scan_report)
{
   NRF_LOG_INFO(&amp;quot;Status: %X&amp;quot;, scan_report-&amp;gt;status);
   if(scan_report-&amp;gt;status == MAC_SUCCESS)
   {
      if(scan_report-&amp;gt;result_list_size &amp;gt; CONFIRM_SCAN_SIZE )
      {
         NRF_LOG_INFO(&amp;quot;Number of results surpassed memory allocated in scan&amp;quot;);
      }

      NRF_LOG_INFO(&amp;quot;Received 802.15.4 scan report&amp;quot;);
      NRF_LOG_INFO(&amp;quot;Found %d PANs&amp;quot;, scan_report-&amp;gt;result_list_size);
      NRF_LOG_INFO(&amp;quot;unscanned channels: %X&amp;quot;, scan_report-&amp;gt;unscanned_channels);

      for(int i = 0; i &amp;lt; scan_report-&amp;gt;result_list_size; i++ )
      {
         NRF_LOG_INFO(&amp;quot;Found PAN with ID: %X&amp;quot;, scan_report-&amp;gt;pan_descriptor_list[i].coord_pan_id);
      }
   }

}

static mlme_scan_req_t *scan_request;
void scan()
{
   scan_request = (mlme_scan_req_t *)malloc(sizeof(mlme_scan_req_t));
   ASSERT(scan_request != NULL);

   scan_request-&amp;gt;pan_descriptors_buf = (mac_pan_descriptor_t *) malloc(sizeof(mac_pan_descriptor_t) *  CONFIRM_SCAN_SIZE);
   scan_request-&amp;gt;pan_descriptors_buf_size =  CONFIRM_SCAN_SIZE;
   scan_request-&amp;gt;energy_detect_buf = malloc(sizeof(uint8_t) *  CONFIRM_SCAN_SIZE);
   scan_request-&amp;gt;energy_detect_buf_size =  CONFIRM_SCAN_SIZE;

   ASSERT(scan_request-&amp;gt;energy_detect_buf != NULL);
   ASSERT(scan_request-&amp;gt;pan_descriptors_buf != NULL);

   uint32_t channelMask;
   channelMask = 0b00000111111111111111100000000000;
   scan_request-&amp;gt;scan_type = 1;
   scan_request-&amp;gt;scan_channels = channelMask;
   scan_request-&amp;gt;scan_duration = 4;

   mlme_scan_req(scan_request, mlme_scan_conf_cb);
   NRF_LOG_INFO(&amp;quot;Scanning&amp;quot;);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 802.15.4 callback Issues</title><link>https://devzone.nordicsemi.com/thread/350481?ContentTypeID=1</link><pubDate>Mon, 31 Jan 2022 15:03:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec3fd202-0558-4ce3-83ac-dfddd60fe3a8</guid><dc:creator>Andreas3T</dc:creator><description>&lt;p&gt;Hi Marte,&lt;/p&gt;
&lt;p&gt;Just got hands on a second nrf52840 to use as sniffer. Will come back with logs later today or possibly tomorrow.&lt;/p&gt;
&lt;p&gt;Thanks for the checkup.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 802.15.4 callback Issues</title><link>https://devzone.nordicsemi.com/thread/350474?ContentTypeID=1</link><pubDate>Mon, 31 Jan 2022 14:54:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7cf3a802-746e-4896-b9f1-a9a97d1dc3e1</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Andreas,&lt;/p&gt;
&lt;p&gt;Have you managed to get a sniffer log of the active scan?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 802.15.4 callback Issues</title><link>https://devzone.nordicsemi.com/thread/349730?ContentTypeID=1</link><pubDate>Wed, 26 Jan 2022 11:47:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0db209a6-6b5c-480c-9c59-0de1fa6f428f</guid><dc:creator>Andreas3T</dc:creator><description>&lt;p&gt;I have confirmed that macAutoRequest is set to true. What I find odd is that the confirm primitive is never called when an Active scan is requested regardless if there is a coordinator in the vicinity or not.&lt;/p&gt;
&lt;p&gt;Will come back with results from nRF sniffer, thanks.&lt;/p&gt;
&lt;p&gt;Best Regards, Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 802.15.4 callback Issues</title><link>https://devzone.nordicsemi.com/thread/349724?ContentTypeID=1</link><pubDate>Wed, 26 Jan 2022 11:08:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a2221cf-c611-4b8b-802b-48b069a2fbb7</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi Andreas,&lt;/p&gt;
&lt;p&gt;I am happy to hear that!&lt;/p&gt;
[quote user="Andreas3T"] passive scan returns MAC_NO_BEACON which might be correct[/quote]
&lt;p&gt;This sounds like the correct behavior. With passive scan the device can locate a coordinator transmitting beacon frames within its personal operating space (POS). The device does not, however, transmit a beacon requests during a passive scan.&lt;/p&gt;
[quote user="Andreas3T"]I&amp;#39;m not sure if a Zigbee coordinator requires some additional settings to periodically send a beacon signal.[/quote]
&lt;p&gt;To periodically send beacon frames the network must be a beacon-enabled PAN. In such a network you will have at least one device transmitting beacon frames at a regular interval. When this is not the case, the coordinator will only send beacons as a response to a beacon request.&lt;/p&gt;
[quote user="Andreas3T"]Does active scan have additoinal requirements than passive and ED scans?[/quote]
&lt;p&gt;The scans differ in how they work at least. With ED (energy detection) scan the device performs an energy detection measurement on the different channels, while during active scan the device transmits a beacon request and waits to receive a beacon. The Zigbee coordinator should have responded to the beacon request with a beacon frame.&lt;/p&gt;
&lt;p&gt;Do you know wheter&amp;nbsp;macAutoRequest is set to true or false? For active and passive scans, the MLME-SCAN.confirm primitive will only include a set of PAN descriptor values of the scan is successful and&amp;nbsp;macAutoRequest is set to TRUE. If not, it will contain a null set of PAN descriptor values.&lt;/p&gt;
&lt;p&gt;Do you have an additional nRF52840&amp;nbsp;Dongle or DK? If so, you can use it as a sniffer to capture packets using our&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/ug_sniffer_802154/UG/sniffer_802154/intro_802154.html"&gt;nRF Sniffer for 802.15.4&lt;/a&gt;. This might help in finding out where the issue is, as you will be able to see&amp;nbsp;if the device sends a beacon request during the active scan or not, and whether the Zigbee coordinator responds to the beacon. If you upload the sniffer log as a pcap file I can look at it to see if I find any issues with the network traffic.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 802.15.4 callback Issues</title><link>https://devzone.nordicsemi.com/thread/349691?ContentTypeID=1</link><pubDate>Wed, 26 Jan 2022 08:50:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29b420e3-fe63-450a-9501-0d69cf76c03e</guid><dc:creator>Andreas3T</dc:creator><description>&lt;p&gt;Thanks for the quick reply.&lt;/p&gt;
&lt;p&gt;I see then most of my issues seems to be resolved.&lt;/p&gt;
&lt;p&gt;After trying each type of scan except orphan scan, ED scan seems to work as intended, passive scan returns MAC_NO_BEACON which might be correct, a Zigbee Coordinator is setup close to the device as a test but I&amp;#39;m not sure if a Zigbee coordinator requires some additional settings to periodically send a beacon signal.&lt;/p&gt;
&lt;p&gt;However the Active scan never returns no matter what, according to the standard it should return after the scan duration with a confirm. Does active scan have additoinal requirements than passive and ED scans?&lt;/p&gt;
&lt;p&gt;Best Regards, Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 802.15.4 callback Issues</title><link>https://devzone.nordicsemi.com/thread/349564?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 14:02:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bad45a7c-26c4-447e-a476-61f426800ff9</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;From what I can find it seems like calling&amp;nbsp;sys_task_run() is required, but I will check with the developers to make sure.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It is not required to use sys_mm_alloc(). There are some other cases where using this to allocate memory leads to the scan request callback not being called:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/56163/nrf-802-15-4-stack-api-mlme_scan_req-does-not-call-the-callback-function"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/56163/nrf-802-15-4-stack-api-mlme_scan_req-does-not-call-the-callback-function&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/59282/802-15-4-mlme_scan_req-never-calls-it-s-callback-function-802-15-4-library-mlme_scan_request_primitive-is-not-according-to-802-15-4_2006-spezification"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/59282/802-15-4-mlme_scan_req-never-calls-it-s-callback-function-802-15-4-library-mlme_scan_request_primitive-is-not-according-to-802-15-4_2006-spezification&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I checked internally, and I cannot find cases of&amp;nbsp;sys_mm_alloc being used for the MLME-SCAN-request or MLME-RESET.request. It is used to allocate memory for packets, for example:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;span&gt;test_packet_t * packet_to_send = (test_packet_t *)&lt;/span&gt;&lt;em&gt;sys_mm_alloc&lt;/em&gt;&lt;span&gt;(sizeof(test_packet_t));&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;But scan and reset request are mostly done in the same way as in the comment of the first case I link to above:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static mlme_reset_req_t mlme_reset_req_container =
  {
    .set_default_pib = true
  };

  mlme_reset_req(&amp;amp;mlme_reset_req_container, SetupSeqResetMlmeCb);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Not that I am aware of, but I will check this out.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q4&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;No, the source code for the library is&amp;nbsp;&lt;span&gt;unfortunately&amp;nbsp;&lt;/span&gt;not publicly available.&lt;/p&gt;
&lt;p&gt;I will talk with the developers and see if they might have any ideas as to why the scan confirmation data is as it is.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>