<?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>Timestamp Data in nRF5340</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84079/timestamp-data-in-nrf5340</link><description>Hi, 
 
 I wanted to time stamp data which is sent via Bluetooth connection. Is there any pre defined functions to do that. Also please suggest any modifictions to be done in proj.config file too. 
 Expected format: 
 Hours:minutes:seconds Data 
 
 Regards</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Jan 2022 09:19:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84079/timestamp-data-in-nrf5340" /><item><title>RE: Timestamp Data in nRF5340</title><link>https://devzone.nordicsemi.com/thread/349897?ContentTypeID=1</link><pubDate>Thu, 27 Jan 2022 09:19:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:203c9dec-2e86-4ac1-90be-c4e2c86cb5aa</guid><dc:creator>KarthikKumar</dc:creator><description>&lt;p&gt;Thank You Will Try with this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timestamp Data in nRF5340</title><link>https://devzone.nordicsemi.com/thread/349895?ContentTypeID=1</link><pubDate>Thu, 27 Jan 2022 09:15:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f070d03-6963-4aed-b84c-36d900c06866</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to do the time stamps on the peripheral, and send that as part of the BLE data, you will need to make it transmit the data as part of its advertising data, or part of a service if you&amp;#39;re in a connection. You can take a look at the Bluetooth:Peripheral CTS client that lets you print the current time for example. Even though you don&amp;#39;t want to use that service specifically, it should give you an idea of how to send the timestamp data over BLE.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timestamp Data in nRF5340</title><link>https://devzone.nordicsemi.com/thread/349746?ContentTypeID=1</link><pubDate>Wed, 26 Jan 2022 12:17:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00779c7e-9be7-41e1-82a2-925ccbaaa3e6</guid><dc:creator>KarthikKumar</dc:creator><description>&lt;p&gt;Hi Simonr,&lt;/p&gt;
&lt;p&gt;Thank you for the response.&lt;/p&gt;
&lt;p&gt;I followed the function you suggested me. But not able to print the time.&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; uint32_t time;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; time = &lt;/span&gt;&lt;span&gt;k_cycle_get_32&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;printk&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;%d&lt;/span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, time/&lt;/span&gt;&lt;span&gt;32768&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;I&amp;#39;m working with peripheral_uart and central_uart examples. Where data is sent from perpherial to central, I tried to time stamp data in central. Can you suggest me where exactly the change has to be made.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Regards&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Karthik Kumar&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timestamp Data in nRF5340</title><link>https://devzone.nordicsemi.com/thread/349738?ContentTypeID=1</link><pubDate>Wed, 26 Jan 2022 11:56:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e52fa9d-7d77-4c1c-a413-4e3e6d8823d4</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Karthik&lt;/p&gt;
&lt;p&gt;There&amp;#39;s a description of how to do something like that &lt;a href="https://docs.zephyrproject.org/1.9.0/kernel/timing/clocks.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Essentially you can use the &lt;a href="https://docs.zephyrproject.org/2.7.0/reference/kernel/timing/clocks.html?highlight=kernel%20timing#c.k_cycle_get_32"&gt;&lt;strong&gt;k_cycle_get_32&lt;/strong&gt;&lt;/a&gt;() to get an accurate timestamp from Zephyr, and if you divide this number by 32768 (the freq. of the LF clock) you will get the number of seconds passed. Then you need to implement this as part of the data you transmit over BLE. Likely in a service.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>