<?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>nRF54L15DK, cannot port HAL SPI code that was working in nRF53</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118958/nrf54l15dk-cannot-port-hal-spi-code-that-was-working-in-nrf53</link><description>I had previously gotten working code to communicate with my SPI device on the nRF5340DK w/ NCS v2.5.0 that uses the HAL SPI library inside TF-M. I used NCS v2.5.0 (nrf\samples\tfm\tfm_secure_peripheral) as the baseline. 
 I now need to port that code</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 08 Mar 2025 04:40:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118958/nrf54l15dk-cannot-port-hal-spi-code-that-was-working-in-nrf53" /><item><title>RE: nRF54L15DK, cannot port HAL SPI code that was working in nRF53</title><link>https://devzone.nordicsemi.com/thread/526434?ContentTypeID=1</link><pubDate>Sat, 08 Mar 2025 04:40:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2701a9df-7af3-4a67-958d-21a348fa6dc0</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;Thank you for everyone&amp;#39;s help; I appreciate all your input. I was able to resolve the issue with my project, by fixing the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Increasing voltage on the I/O pins. It seems the default on nRF54 was too low for my SPI&amp;nbsp;slave device.&lt;/li&gt;
&lt;li&gt;Ensuring enough time between register writes to configure SPI slave device&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15DK, cannot port HAL SPI code that was working in nRF53</title><link>https://devzone.nordicsemi.com/thread/526072?ContentTypeID=1</link><pubDate>Wed, 05 Mar 2025 23:17:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3d8b8d8-0908-4a0b-be09-447af661cc95</guid><dc:creator>Jennifer Gibbs</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You mentioned that you used Port 1 pins in your setup, which pin configurations have you tried? Have you tried setting the MOSI to High Drive? What I see is that in your read attempts the first byte 0x80 isn&amp;#39;t set until AFTER the clock signal goes high so that&amp;#39;s why it isn&amp;#39;t getting decrypted correctly.&lt;/p&gt;
&lt;p&gt;Jennifer Gibbs&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15DK, cannot port HAL SPI code that was working in nRF53</title><link>https://devzone.nordicsemi.com/thread/524717?ContentTypeID=1</link><pubDate>Wed, 26 Feb 2025 05:14:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9300765b-5f67-46ba-b302-949828faa626</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;Tested your sample but did not seem to work.&lt;/p&gt;
&lt;p&gt;The SPI device does not have a register related to a device ID, so I included some reads/writes for a couple configuration-related registers. I have the raw logic analyzer file here. I used a Saleae Logic device, but even without one I think you can just &lt;a href="https://www.saleae.com/pages/downloads?srsltid=AfmBOoqg_73t7QZ4DA3rxuCTJJAts4oPxoQ-nWxSDlul-GlnRLg4gSaH"&gt;download the software and view the file&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/spi_5F00_reg_5F00_0x10_5F00_0x13_5F00_read.sal"&gt;devzone.nordicsemi.com/.../spi_5F00_reg_5F00_0x10_5F00_0x13_5F00_read.sal&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/spi_5F00_reg_5F00_0x10_5F00_0x13_5F00_write.sal"&gt;devzone.nordicsemi.com/.../spi_5F00_reg_5F00_0x10_5F00_0x13_5F00_write.sal&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here are the logic analyzer results from what I tried at the time this post was created (s&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/117956/spis-that-acts-as-prober-sniffer"&gt;ee my other post here for details on how it reads/writes&lt;/a&gt;):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I try writing to registers 0x10 thru 0x13
&lt;ul&gt;
&lt;li&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/spi_5F00_reg_5F00_0x10_5F00_0x13_5F00_write.jpg" /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;I expect to read back what I just wrote, but don&amp;#39;t get anything. Reads in general just seem incorrect in multiple ways.
&lt;ul&gt;
&lt;li&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/spi_5F00_reg_5F00_0x10_5F00_0x13_5F00_read.jpg" /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;One of the reads was correct on MOSI (0x80 | 0x12 = 0x92), but MISO still reported 0x00 (see 2nd byte)
&lt;ul&gt;
&lt;li&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/spi_5F00_reg_5F00_0x12_5F00_read.jpg" /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The other read did not properly detect the first &amp;#39;1&amp;#39; bit and had MOSI send 0x11 instead of 0x91
&lt;ul&gt;
&lt;li&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/spi_5F00_reg_5F00_0x11_5F00_read.jpg" /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15DK, cannot port HAL SPI code that was working in nRF53</title><link>https://devzone.nordicsemi.com/thread/524494?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2025 08:03:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f66a218-425d-4d2d-b0d9-133681cdc53b</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Good morning!&lt;/p&gt;
&lt;p&gt;Here is a sample where I added updated the tfm_secure_peripehral sample for the nRF54L15.&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/tfm_5F00_secure_5F00_peripheral_5F00_nrf54l15.zip"&gt;devzone.nordicsemi.com/.../tfm_5F00_secure_5F00_peripheral_5F00_nrf54l15.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Can you try this way with your sensor?&lt;/p&gt;
&lt;p&gt;If this does not work, can you upload the logic analyzer trace for both the &amp;quot;set Device ID&amp;quot; and &amp;quot;read Device ID&amp;quot;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15DK, cannot port HAL SPI code that was working in nRF53</title><link>https://devzone.nordicsemi.com/thread/524086?ContentTypeID=1</link><pubDate>Fri, 21 Feb 2025 13:09:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acec59b1-ed23-4c08-9ec3-1d78fd9aa278</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;I am still working on making a sample to SPI in TF-M on the nRF54L15, but it is taking more time than expected.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15DK, cannot port HAL SPI code that was working in nRF53</title><link>https://devzone.nordicsemi.com/thread/523592?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2025 18:14:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b5ff340-b693-4c9e-9bc8-b4ea685a2603</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;The frequency is already supported. I added this and there was no compile/build errors. I added it like so:&amp;nbsp;&lt;span&gt;NRF_SPIM_FREQUENCY_STATIC_CHECK&lt;/span&gt;&lt;span&gt;(NRF_SPIM22, 2&lt;/span&gt;&lt;span&gt;000000&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15DK, cannot port HAL SPI code that was working in nRF53</title><link>https://devzone.nordicsemi.com/thread/523372?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2025 00:38:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80497ca4-0482-4713-b0ea-2c53d866c2a1</guid><dc:creator>Jennifer Gibbs</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Have you verified that the frequency you are trying to set is supported for the prescaler value chosen? See the following:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:275px;max-width:607px;" height="275" src="https://devzone.nordicsemi.com/resized-image/__size/1214x550/__key/communityserver-discussions-components-files/4/pastedimage1739839088870v1.png" width="607" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Jennifer Gibbs&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15DK, cannot port HAL SPI code that was working in nRF53</title><link>https://devzone.nordicsemi.com/thread/523182?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2025 08:31:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:255f0ec4-795c-41fb-b19f-bedcbef7062a</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;Code&amp;nbsp;pretty much worked out-of-the-box. This is confirmed in our nRF53 code, which did read/write correctly. It was only changed in the following ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;all pins (CS, SCLK, MISO, MOSI) are used&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;interrupt mask ENDRX is enabled instead of ENDTX&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;NRF_SPIM4 was used instead of NRF_SPIM3 (changes to .yaml and .conf files were made accordingly)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;nrf_spim_enable() and nrf_spim_disable() are called in functions to conserve power&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;nRF54 code is minimally changed from nRF53 code (but again, seems to read and/or write incorrectly). Only major changes were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;NRF_SPIM22 was being used&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;Pins I passed into spim_init() were all in Port 1&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;I did try playing around with Port 2 pins (including cutting SB11-22 on the nRF54L15 DK) but it did not change the results.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;nrf_spim_frequency_set() replaced w/ nrf_spim_prescaler_set(), since the former doesn&amp;#39;t seem possible in nRF54 anymore&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;Frequency is 2MHz, so now I call it with&amp;nbsp;nrf_spim_prescaler_set(NRF_SPIM22, NRF_SPIM_PRESCALER_CALCULATE(NRF_SPIM22, 2000000));&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Data read is wrong because when reading the SPI device&amp;#39;s registers, it should return values I had written when initializing the peripheral (via SPI writes). But the values don&amp;#39;t match what I wrote. Yet, logic analyzer also shows these same wrong values.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15DK, cannot port HAL SPI code that was working in nRF53</title><link>https://devzone.nordicsemi.com/thread/523173?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2025 07:59:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17c520ad-bc29-4980-a569-6e4d851913e5</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="esmart-engineering"] I don&amp;#39;t expect nrfx to work especially since I need TFM[/quote]
&lt;p&gt;Ah, right. Let us have a look at HAL then.&lt;/p&gt;
&lt;p&gt;I see that there are SPIM code inside the &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/c223901da7952a81e8cf96f81319754c801bc3d0/samples/tfm/tfm_secure_peripheral/secure_peripheral_partition/secure_peripheral_partition.c#L105"&gt;secure partition sample&lt;/a&gt;. Do you mean to say that this code does not work out of the box?&lt;/p&gt;
&lt;p&gt;Alternativley: How is your code different from what the sample does?&lt;/p&gt;
[quote user=""] but the data being read in is wrong[/quote]
&lt;p&gt;Wrong how exactly?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15DK, cannot port HAL SPI code that was working in nRF53</title><link>https://devzone.nordicsemi.com/thread/523102?ContentTypeID=1</link><pubDate>Fri, 14 Feb 2025 17:22:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbeed32a-5a8e-4588-90a7-cc2d84c1d96f</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;If time permits, I can take a look. But that is using nrfx, and I&amp;#39;m looking for code using HAL directly. I don&amp;#39;t expect nrfx to work especially since I need TFM (&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/115720/nrf5340-uart-interrupt-based-reads-in-secure-partition"&gt;see Einar&amp;#39;s Nov 1 post here&lt;/a&gt;). I&amp;#39;m also requesting code that works with nRF54L15, since examples like those were only tested with boards up thru nRF53.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF54L15DK, cannot port HAL SPI code that was working in nRF53</title><link>https://devzone.nordicsemi.com/thread/523081?ContentTypeID=1</link><pubDate>Fri, 14 Feb 2025 14:48:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dba6008e-e910-4ac4-a222-9c466e8c0a46</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]Can you provide&amp;nbsp;&lt;span&gt;code for a simple working &amp;quot;HAL-SPI only&amp;quot; example that works on nRF54L15DK and NCS v2.9.0?&lt;/span&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;We would like to see if the issue is related to TF-M or not.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;[/quote]
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src/nrfx_spim"&gt;https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src/nrfx_spim&lt;/a&gt;&lt;/p&gt;
[quote user=""]Can you provide code for a simple working &amp;quot;HAL-SPI + TFM-secure-partition&amp;quot; example that works on nRF54L15DK and NCS v2.9.0?[/quote]
&lt;p&gt;Try the sample above first, and then we can get to this after.&lt;/p&gt;
[quote user=""]Are you aware of any other issues in the DK or NCS v2.9.0 that can cause issues with SPI?
[/quote]
&lt;p&gt;No, not really. I recommend testing the Zephyr SPI drivers for SPI in general to test this.&lt;br /&gt;See for example&amp;nbsp;&lt;a href="https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-5-serial-peripheral-interface-spi/"&gt;The DevAcademy course on SPI&lt;/a&gt; for how to do this.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>