<?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 to configure and confirm CPU frequency on nRF5340? (LVGL performance concern with ST7789)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/123093/how-to-configure-and-confirm-cpu-frequency-on-nrf5340-lvgl-performance-concern-with-st7789</link><description>Hi, 
 I&amp;#39;m developing an embedded GUI application using LVGL on the nRF5340 application core with Zephyr RTOS. 
 The display I&amp;#39;m using is an ST7789 TFT panel (240&amp;#215;284 resolution) , connected over SPI. However, the performance is quite limited (e.g. UI</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 21 Jul 2025 11:37:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/123093/how-to-configure-and-confirm-cpu-frequency-on-nrf5340-lvgl-performance-concern-with-st7789" /><item><title>RE: How to configure and confirm CPU frequency on nRF5340? (LVGL performance concern with ST7789)</title><link>https://devzone.nordicsemi.com/thread/542998?ContentTypeID=1</link><pubDate>Mon, 21 Jul 2025 11:37:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a11b536d-52c2-4784-811b-6bf312150436</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Thanks for updating the ticket after you found the solution. Here&amp;#39;s also code snippet&amp;nbsp;copied from one of the Zephyr samples that reads back the current CPU frequency as well:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;nrfx_clock.h&amp;gt;

static int nrf53_cpu_boost(void)
{
	int err;

	/* For optimal performance, the CPU frequency should be set to 128 MHz */
	err = nrfx_clock_divider_set(NRF_CLOCK_DOMAIN_HFCLK, NRF_CLOCK_HFCLK_DIV_1);
	err -= NRFX_ERROR_BASE_NUM;
	if (err != 0) {
		printk(&amp;quot;Failed to set 128 MHz: %d\n&amp;quot;, err);
	}

	printk(&amp;quot;Starting %s with CPU frequency: %d MHz\n&amp;quot;, CONFIG_BOARD, SystemCoreClock/MHZ(1));

	return err;
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to configure and confirm CPU frequency on nRF5340? (LVGL performance concern with ST7789)</title><link>https://devzone.nordicsemi.com/thread/542937?ContentTypeID=1</link><pubDate>Sun, 20 Jul 2025 16:00:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:658f3258-131b-48f9-9379-7f295e0afe5b</guid><dc:creator>Sab1e</dc:creator><description>&lt;p&gt;You can also refer to this link: &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/108267/nrf5340-128mhz-spi-32-mhz"&gt;devzone.nordicsemi.com/.../nrf5340-128mhz-spi-32-mhz&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to configure and confirm CPU frequency on nRF5340? (LVGL performance concern with ST7789)</title><link>https://devzone.nordicsemi.com/thread/542936?ContentTypeID=1</link><pubDate>Sun, 20 Jul 2025 15:37:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b7b9fb5-b0e6-49cb-aa83-f9e03fa2461b</guid><dc:creator>Sab1e</dc:creator><description>&lt;p data-start="159" data-end="166"&gt;Hi all,&lt;/p&gt;
&lt;p data-start="168" data-end="456"&gt;I was trying to improve the performance of &lt;strong data-start="211" data-end="219"&gt;LVGL&lt;/strong&gt; on the &lt;strong data-start="227" data-end="238"&gt;nRF5340&lt;/strong&gt; by increasing the application core clock speed. I&amp;rsquo;m using an &lt;strong data-start="300" data-end="310"&gt;ST7789&lt;/strong&gt; display with a resolution of &lt;strong data-start="340" data-end="351"&gt;240&amp;times;284&lt;/strong&gt;, and I noticed rendering was slow, so I wanted to verify and potentially increase the running frequency.&lt;/p&gt;
&lt;p data-start="458" data-end="632"&gt;After some investigation and DWT (Data Watchpoint and Trace) measurement, it appeared that my application core was running at &lt;strong data-start="584" data-end="594"&gt;64 MHz&lt;/strong&gt; rather than the expected &lt;strong data-start="620" data-end="631"&gt;128 MHz&lt;/strong&gt;.&lt;/p&gt;
&lt;p data-start="634" data-end="835"&gt;Eventually, I found that the solution is to explicitly set the HFCLK divider to 1 using the &lt;code data-start="726" data-end="750"&gt;nrfx_clock_divider_set&lt;/code&gt; API. This feature is available when &lt;code data-start="787" data-end="823"&gt;CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT&lt;/code&gt; is defined.&lt;/p&gt;
&lt;p data-start="837" data-end="871"&gt;Here is the working fix I applied:&lt;/p&gt;
&lt;p data-start="837" data-end="871"&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;nrfx_clock.h&amp;gt;

int main(){
...
#if NRFX_CLOCK_ENABLED &amp;amp;&amp;amp; (defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M)
    nrfx_clock_divider_set(NRF_CLOCK_DOMAIN_HFCLK, NRF_CLOCK_HFCLK_DIV_1);
#endif
...
    return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p data-start="1064" data-end="1192"&gt;This successfully configured the HFCLK to &lt;strong data-start="1106" data-end="1120"&gt;1x divider&lt;/strong&gt;, giving me &lt;strong data-start="1132" data-end="1143"&gt;128 MHz&lt;/strong&gt;, and my LVGL performance improved significantly.&lt;/p&gt;
&lt;p data-start="1194" data-end="1268"&gt;The solution was originally provided in &lt;a class="cursor-pointer" href="https://devzone.nordicsemi.com/f/nordic-q-a/110720/get-max-clock-speed-in-app-and-net-cores" data-start="1234" data-end="1267"&gt;this thread&lt;/a&gt;.&lt;/p&gt;
&lt;p data-start="1194" data-end="1268"&gt;&lt;span class="notranslate immersive-translate-target-wrapper" lang="zh-CN" data-immersive-translate-translation-element-mark="1"&gt;Additionally, the standard SPIM modules only support speeds up to 16 Mbps, whereas SPIM4 can support up to 32 Mbps when the application core is running at 128 MHz.&lt;/span&gt;&lt;/p&gt;
&lt;p data-start="1270" data-end="1315"&gt;Hope this helps others facing the same issue!&lt;/p&gt;
&lt;p data-start="1317" data-end="1356"&gt;Best regards,&lt;/p&gt;
&lt;p data-start="1317" data-end="1356"&gt;Sab1e&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>