<?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>How should the nRF 5340 CCM peripheral&amp;#39;s MODE.DATARATE field be set when using the peripheral in asynchronous mode (i.e. not encrypt/decrypt-on-the-fly)?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110324/how-should-the-nrf-5340-ccm-peripheral-s-mode-datarate-field-be-set-when-using-the-peripheral-in-asynchronous-mode-i-e-not-encrypt-decrypt-on-the-fly</link><description>Hello, 
 I a working on a project that uses the nRF5340 CCM peripheral (Network core) in an asynchronous mode. That is, I encrypt PDUs prior to scheduling them for transmission on the radio and I decrypt PDUs after having successfully received them from</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Jun 2024 13:01:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110324/how-should-the-nrf-5340-ccm-peripheral-s-mode-datarate-field-be-set-when-using-the-peripheral-in-asynchronous-mode-i-e-not-encrypt-decrypt-on-the-fly" /><item><title>RE: How should the nRF 5340 CCM peripheral's MODE.DATARATE field be set when using the peripheral in asynchronous mode (i.e. not encrypt/decrypt-on-the-fly)?</title><link>https://devzone.nordicsemi.com/thread/489758?ContentTypeID=1</link><pubDate>Thu, 20 Jun 2024 13:01:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12661880-6a3e-4bf8-8af2-985791784d07</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi Kevin,&lt;/p&gt;
&lt;p data-renderer-start-pos="51"&gt;Our IC team have done&amp;nbsp;simulations with the nRF5340. It confirms that the encryption is not influenced by the MODE.DATARATE setting. The timing values you provided are quite big. One issue could be that other masters are accessing the same RAM slave while CCM is active.&lt;/p&gt;
&lt;p data-renderer-start-pos="353"&gt;Questions:&lt;/p&gt;
&lt;ul class="ak-ul" data-indent-level="1"&gt;
&lt;li&gt;
&lt;p data-renderer-start-pos="384"&gt;Is there any master other than CCM accessing the RAM slave during this time?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p data-renderer-start-pos="464"&gt;Are the timings that are mentioned always the same or is there some bigger variation?&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-renderer-start-pos="871"&gt;The MIC mismatch dependency on DATARATE is also strange. Question:&lt;/p&gt;
&lt;ul class="ak-ul" data-indent-level="1"&gt;
&lt;li&gt;
&lt;p data-renderer-start-pos="957"&gt;is the ERROR event observed in any of these cases?&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br /&gt;To further investigate this, we would need to a&lt;span&gt;&amp;nbsp;small separate test code, that can run on the nRF53 DK, that reproduces this (write random data to RAM, run encryption, run decryption) and check if the timings are more reasonable then (measured either with internal TIMER or bring the relevant tasks/events out to GPIOs via PPI). Would you be able to provide some stripped down/ small sample that&amp;nbsp;reproduces the issue?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How should the nRF 5340 CCM peripheral's MODE.DATARATE field be set when using the peripheral in asynchronous mode (i.e. not encrypt/decrypt-on-the-fly)?</title><link>https://devzone.nordicsemi.com/thread/484745?ContentTypeID=1</link><pubDate>Thu, 16 May 2024 15:04:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:069d22f8-7ae8-492f-ae96-16cdbd9f6a6f</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi Kevin,&lt;/p&gt;
&lt;p&gt;Sorry for the delay on this.&amp;nbsp;I have asked our IC designers for input on this.&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Sigurd&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How should the nRF 5340 CCM peripheral's MODE.DATARATE field be set when using the peripheral in asynchronous mode (i.e. not encrypt/decrypt-on-the-fly)?</title><link>https://devzone.nordicsemi.com/thread/479759?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 14:50:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10b32753-0c95-416d-a8d6-3161990661a4</guid><dc:creator>Kevin Doss</dc:creator><description>&lt;p&gt;1) Sorry the typo is that I should have said &amp;quot;the encrypt operation takes significantly MORE time&amp;quot; not less time.&lt;/p&gt;
&lt;p&gt;2) The scratch area is 96 bytes (16 + MAXPACKETSIZE)&lt;/p&gt;
&lt;p&gt;3) MODE.LENGTH = Extended&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How should the nRF 5340 CCM peripheral's MODE.DATARATE field be set when using the peripheral in asynchronous mode (i.e. not encrypt/decrypt-on-the-fly)?</title><link>https://devzone.nordicsemi.com/thread/479677?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 11:12:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d09b655-1dcd-49e8-8e09-0d82a2afe201</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
[quote user="Kevin Doss"]For example, when I encrypt a 58-byte PDU with MODE.DATARATE = 1Mbps the keystream generation takes 19.5 usec (MAXPKTSIZE = 80) and the encrypt takes 37 usec. When I encrypt the same 58-byte packet with MODE.DATARATE = 2Mbps the keystream generation takes 13 usec and the encrypt takes 232.5 usec.[/quote]
&lt;p&gt;1) Is this a typo, or does&amp;nbsp;&lt;span&gt;encrypt&amp;nbsp;actually take longer time with&amp;nbsp;MODE.DATARATE = 2Mbps ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2) How big is your scratch area?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3) Are you using&amp;nbsp;MODE.LENGTH = Default or&amp;nbsp;MODE.LENGTH = Extended ?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How should the nRF 5340 CCM peripheral's MODE.DATARATE field be set when using the peripheral in asynchronous mode (i.e. not encrypt/decrypt-on-the-fly)?</title><link>https://devzone.nordicsemi.com/thread/479511?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2024 15:21:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:709b9e50-49d6-4208-bbd6-80b9ad8f18b3</guid><dc:creator>Kevin Doss</dc:creator><description>&lt;p&gt;A couple of other observations in case they may shed light on the issue:&lt;/p&gt;
&lt;p&gt;- When I perform an encryption operation with MODE.DATARATE = 2Mbps the duration of the encrypt operation take significantly less time than the 1Mbps case. For example, when I encrypt a 58-byte PDU with MODE.DATARATE = 1Mbps the keystream generation takes 19.5 usec (MAXPKTSIZE = 80) and the encrypt takes 37 usec. When I encrypt the same 58-byte packet with MODE.DATARATE = 2Mbps the keystream generation takes 13 usec and the encrypt takes 232.5 usec.&lt;/p&gt;
&lt;p&gt;- When I encrypt on the sending side with MODE.DATARATE = 1Mbps but attempt to decrypt on the receiving side with MODE.DATARATE = 2Mbps some decrypts are successful and some fail. For example, I encrypt and send a 64-byte PDU followed by a 9-byte PDU (MODE.DATARATE = 1Mbps). On the receiving side I decrypt using MODE.DATARATE = 2Mbps and the 64-byte PDU fails due to a MIC mismatch but the 9-byte PDU is successful. The failed 64-byte decrypt takes 13 usec for keystream generation and 22 usec for the decrypt operation. The successful 9-byte PDU takes 13.5 usec for keystream generation and 128.5 usec for the decrypt operation.&lt;/p&gt;
&lt;p&gt;- Code snippet for initialization of the CCM peripheral:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;NRF_CCM_NS&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;MAXPACKETSIZE&lt;/span&gt;&lt;span&gt; = SHU_MAX_PAYLOAD;&amp;nbsp; &amp;nbsp;// 80 bytes&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;NRF_CCM_NS&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;HEADERMASK&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;0xFF&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;NRF_CCM_NS&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;SCRATCHPTR&lt;/span&gt;&lt;span&gt; = (&lt;/span&gt;&lt;span&gt;uint32_t&lt;/span&gt;&lt;span&gt;)&amp;amp;&lt;/span&gt;&lt;span&gt;ccmScratchArea&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;NRF_CCM_NS&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;SHORTS&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;CCM_SHORTS_ENDKSGEN_CRYPT_Msk&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;NRF_CCM_NS&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;INTENSET&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;CCM_INTENSET_ENDCRYPT_Msk&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;span&gt;CCM_INTENSET_ERROR_Msk&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;NRF_CCM_NS&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;ENABLE&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;CCM_ENABLE_ENABLE_Enabled&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;-&amp;nbsp;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>