<?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>NRF5340 - PRE KERNEL1 timer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118988/nrf5340---pre-kernel1-timer</link><description>Hi, 
 I&amp;#39;m trying to implement a PRE_KERNEL1 timer (with top priority 0 ) to toggle an LED. 
 I’m able to control the LED using registers, and now I want to add a timer layer. 
 I&amp;#39;ve tried using both registers and NRFX for this task. Both solutions compiled</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Feb 2025 15:06:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118988/nrf5340---pre-kernel1-timer" /><item><title>RE: NRF5340 - PRE KERNEL1 timer</title><link>https://devzone.nordicsemi.com/thread/523558?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2025 15:06:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21e26dfe-1e4a-40b0-99e0-09240fe4f4c2</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;It would have been a good idea to mention mcuboot in your first post...&lt;/p&gt;
&lt;p&gt;PRE_KERNEL means running &lt;em&gt;after&lt;/em&gt; MCUBOOT, which is its own little project that runs&amp;nbsp;&lt;em&gt;before&lt;/em&gt;&lt;em&gt; everything&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;If you wanted to do something at mcuboot time, you needed to modify this project. Not recommended unless you know what you are doing - it took me a while to get my custom MCUBOOT project running properly with an application (I wanted SD card support for the bootloader).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 - PRE KERNEL1 timer</title><link>https://devzone.nordicsemi.com/thread/523433?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2025 09:09:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:155c208c-1080-4a7c-a10a-cd42c4052d24</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Yo,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;MCUBoot taking 1s sounds a bit strange. Could you check if you see the same issue with a simple sample in the SDK ?&amp;nbsp;&lt;br /&gt;How large is your application ? Boot validation can take a long time on a larger application.&amp;nbsp;&lt;br /&gt;You can try to turn off&amp;nbsp;CONFIG_BOOT_VALIDATE_SLOT0=n to see if the boot time is reduced. See here:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/103379/boot-up-time-of-ncs-application"&gt;Boot up time of NCS application&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Another option is to have something running before MCUBoot. Check here:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/88643/modify-the-mcuboot-s-booting-process/371736"&gt;RE: Modify the MCUboot&amp;#39;s booting process&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 - PRE KERNEL1 timer</title><link>https://devzone.nordicsemi.com/thread/523357?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2025 18:41:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5623631d-950a-407f-8f16-817196d3bdc8</guid><dc:creator>Yog!</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The registers took from nrf5340 datasheet, and the gpio works, so it should be fine.&lt;/p&gt;
&lt;p&gt;I saw there is a macro to register &amp;quot;&lt;span&gt;TIMER1_IRQHandler&amp;quot; as a week function, so it looks like it just need to be implemented, anyways, with nrfx- i register &amp;quot;timer_event_handler&amp;quot; to this timer.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and i tried to use &amp;quot;IRQ_CONNECT&amp;quot; and enabled macro but nothing.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;at the end i managed to run something with nrfx but just after pre_kernel1, which is too late so i need to use the bare metal registers to run it before any kernel or OS.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;for some reason, the mcuboot takes ~1sec to boot &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f61e.svg" title="Disappointed"&gt;&amp;#x1f61e;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 - PRE KERNEL1 timer</title><link>https://devzone.nordicsemi.com/thread/523128?ContentTypeID=1</link><pubDate>Sat, 15 Feb 2025 14:09:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c8b68d5-fa28-4633-959e-edbaf73168ce</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;You might also have wrong magic numbers in your own register definitions. Checking would trigger my hourly rates - I am NOT a nordic employee.&lt;/p&gt;
&lt;p&gt;Use the compiler macros from the NRF connect SDK. &lt;code&gt;NRF_P0&lt;/code&gt; should be available once you&lt;/p&gt;
&lt;p&gt;&lt;code&gt; #include &amp;lt;zephyr/kernel.h&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;EDIT: I am a bit blind. Your interrupt handler function TIMER1_IRQHandler is not connected to the interrupt stuff yet. You would need the IRQ_CONNECT macro in order to do that.&lt;/p&gt;
&lt;p&gt;Try putting a debug break point into that handler function in order to check.&lt;/p&gt;
&lt;p&gt;You should have gotten an unhandled interrupt exception unless the timer1 is enabled in the dts - which means it has an interrupt handler function already.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 - PRE KERNEL1 timer</title><link>https://devzone.nordicsemi.com/thread/523126?ContentTypeID=1</link><pubDate>Sat, 15 Feb 2025 13:20:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae72eeaf-8a09-4e2c-aeb0-523506df3dad</guid><dc:creator>Yog!</dc:creator><description>&lt;p&gt;Hi and thanks!&lt;/p&gt;
&lt;p&gt;i got you about magic numbers, absolutely should be taken from device tree.&lt;/p&gt;
&lt;p&gt;anyways, the led gpio actually works, i can make it turn on and off.&lt;/p&gt;
&lt;p&gt;I want to toggle it from timer isr, but i couldnt make it work, i configure the timer but nothing happens.&lt;/p&gt;
&lt;p&gt;the thing is that i want it to work pure hardware, before the OS starts.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;maybe i missed some basic stuff, thanks for your reply!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 - PRE KERNEL1 timer</title><link>https://devzone.nordicsemi.com/thread/523124?ContentTypeID=1</link><pubDate>Sat, 15 Feb 2025 12:21:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8041d9b-f4e0-4fc9-9a40-9a4f725aa5d4</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Pin configs are set much later in startup process, you have to set up the PIN_CNF register manually. GPIO pins have the output disabled at reset.&lt;/p&gt;
&lt;p&gt;You should look up how to use a device tree overlay to set port/pin number instead of using a hard coded magic number.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>