<?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>SPIM3 initialization issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/52072/spim3-initialization-issue</link><description>Hello guys, 
 I am using nRF52840 and SDK 15.3.0. Trying to use SPIM3 device because of the speed. 
 In my sdk_config.h file, I set both NRFX_SPIM_ENABLED and NRFX_SPIM3_ENABLED . 
 However, when I try to initialize SPIM3 with 
 
 I get the error &amp;quot;undefined</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Oct 2019 13:56:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/52072/spim3-initialization-issue" /><item><title>RE: SPIM3 initialization issue</title><link>https://devzone.nordicsemi.com/thread/213023?ContentTypeID=1</link><pubDate>Wed, 02 Oct 2019 13:56:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59e075bd-dd5e-4195-8532-b0af37b680dc</guid><dc:creator>awneil</dc:creator><description>[quote userid="26071" url="~/f/nordic-q-a/52072/spim3-initialization-issue/209559"]I agree that this is very confusing,[/quote]
&lt;p&gt;It certainly is:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/52469/segger-studio-trouble-compiling-nrfx_wdt/211317#211317"&gt;devzone.nordicsemi.com/.../211317&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/52818/error-20-identifier-nrf_drv_twi_instance_0-is-undefined-but-defined-in-sdk_config-h/213022#213022"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/52818/error-20-identifier-nrf_drv_twi_instance_0-is-undefined-but-defined-in-sdk_config-h/213022#213022&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;to name but two in the last few days.&lt;/p&gt;
&lt;p&gt;&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;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM3 initialization issue</title><link>https://devzone.nordicsemi.com/thread/211321?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2019 14:14:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:276e0f17-4bca-4c9b-96fe-c86340783be5</guid><dc:creator>awneil</dc:creator><description>[quote userid="6462" url="~/f/nordic-q-a/52072/spim3-initialization-issue/209544"]a constant source of problems &amp;amp; confusion[/quote]
&lt;p&gt;another today:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/52469/segger-studio-trouble-compiling-nrfx_wdt/211317#211317"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/52469/segger-studio-trouble-compiling-nrfx_wdt/211317#211317&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM3 initialization issue</title><link>https://devzone.nordicsemi.com/thread/209582?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2019 10:07:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09ef9362-8bb2-4618-b5b0-ace2479c4d1f</guid><dc:creator>bojan</dc:creator><description>&lt;p&gt;I added &lt;em&gt;&lt;strong&gt;NRFX_SPIM3_ENABLED&lt;/strong&gt;&lt;/em&gt; to this check:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define NRFX_SPIM_ENABLED \
    (SPI_ENABLED &amp;amp;&amp;amp; (NRFX_SPIM0_ENABLED || NRFX_SPIM1_ENABLED || NRFX_SPIM2_ENABLED || NRFX_SPIM3_ENABLED))&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and the code seems to compile even though that line is grayed in &lt;em&gt;apply_old_config.h&lt;/em&gt; file. I needed to set &lt;em&gt;&lt;strong&gt;#define SPI_ENABLED&lt;/strong&gt;&lt;/em&gt; explicitly to &lt;em&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/em&gt; in order to have successful compilation.&lt;/p&gt;
&lt;p&gt;Thanks,&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/edvin-holmseth"&gt;Edvin&lt;/a&gt;, I learned a lot today.&lt;/p&gt;
&lt;p&gt;Thanks for your effort! It is really appreciated.&lt;/p&gt;
&lt;p&gt;Sincerely,&lt;/p&gt;
&lt;p&gt;Bojan.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM3 initialization issue</title><link>https://devzone.nordicsemi.com/thread/209575?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2019 09:40:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1dcc5d91-072b-41f0-ba5b-252bb54ab844</guid><dc:creator>Edvin</dc:creator><description>[quote user="bojan"]I found a workaround for the moment but I don&amp;#39;t think this is a long-term solution: instead of &lt;em&gt;&lt;strong&gt;NRFX_CHECK(NRFX_SPIM_ENABLED)&lt;/strong&gt;&lt;/em&gt; I am checking &lt;em&gt;&lt;strong&gt;NRFX_CHECK(NRFX_SPIM3_ENABLED)&lt;/strong&gt;&lt;/em&gt; and this check passes successfully.[/quote]
&lt;p&gt;&amp;nbsp;I see. That will probably work, but it may cause some issues if someone wants to use your version of the SDK later (someone from the same company), and they want to use SPIM2 instead.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="bojan"]There is no &lt;em&gt;&lt;strong&gt;#define SPI_ENABLED&lt;/strong&gt;&lt;/em&gt; inside &lt;em&gt;apply_old_config.h&lt;/em&gt; file. There is such a define inside &lt;em&gt;sdk_config.h&lt;/em&gt; though. I tried there to set it to 1 or remove it but with no success![/quote]
&lt;p&gt;&amp;nbsp;Yes. You may be right, it may cause some other defines to not be set properly.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There is an:&lt;/p&gt;
&lt;p&gt;#if defined(SPI_ENABLED) in apply_old_config.h on line 811.&lt;/p&gt;
&lt;p&gt;SPI_ENABLED is defined in sdk_config.h as you say, not in apply_old_config.h. If SPI_ENABLED is defined (e.g. in sdk_config.h), it doesn&amp;#39;t matter whether it is set to 0 or 1, it will still overwrite the SPI defines in apply_old_config.h.&lt;/p&gt;
&lt;p&gt;NRFX_SPI_ENABLED will be set to&amp;nbsp;SPI_ENABLED &amp;amp;&amp;amp; (NRFX_SPI0_ENABLED&amp;nbsp; || NRFX_SPI1_ENABLED&amp;nbsp; || NRFX_SPI2_ENABLED)&lt;/p&gt;
&lt;p&gt;Also, on line 820 in apply_old_config.h, there is a check for&amp;nbsp;#if defined(SPI_PRESENT) &amp;amp;&amp;amp; !defined(SPIM_PRESENT), which by default, I don&amp;#39;t believe will return true, but check what these are defined as in your project.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So if your project has:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define SPI_ENABLED 1
#define NRFX_SPI0_ENABLED 0
#define NRFX_SPI1_ENABLED 0
#define NRFX_SPI2_ENABLED 0
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then NRFX_SPI_ENABLED will be set to false. Try adding NRFX_SPI3_ENABLED to this check in apply_old_config.h:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#if defined(SPI_ENABLED)

#undef NRFX_SPI_ENABLED
#define NRFX_SPI_ENABLED \
    (SPI_ENABLED &amp;amp;&amp;amp; (NRFX_SPI0_ENABLED  || NRFX_SPI1_ENABLED  || NRFX_SPI2_ENABLED || NRFX_SPIM3_ENABLED))
#undef NRFX_SPIM_ENABLED
#define NRFX_SPIM_ENABLED \
    (SPI_ENABLED &amp;amp;&amp;amp; (NRFX_SPIM0_ENABLED || NRFX_SPIM1_ENABLED || NRFX_SPIM2_ENABLED || NRFX_SPIM3_ENABLED))&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM3 initialization issue</title><link>https://devzone.nordicsemi.com/thread/209570?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2019 09:23:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:642d507d-0647-4e51-aaaa-2f91f2a0e0b7</guid><dc:creator>bojan</dc:creator><description>&lt;p&gt;WOW!!!&lt;/p&gt;
&lt;p&gt;You want to say that we should doubt the behaviour of IDE as well (I am using SES, by the way)!?&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f631.svg" title="Scream"&gt;&amp;#x1f631;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;God, save our souls!&lt;/p&gt;
&lt;p&gt;There is no &lt;em&gt;&lt;strong&gt;#define SPI_ENABLED&lt;/strong&gt;&lt;/em&gt; inside &lt;em&gt;apply_old_config.h&lt;/em&gt; file. There is such a define inside &lt;em&gt;sdk_config.h&lt;/em&gt; though. I tried there to set it to 1 or remove it but with no success!&lt;/p&gt;
&lt;p&gt;If I remove &lt;em&gt;apply_old_config.h&lt;/em&gt; from the project like you suggested as 3rd possibility then the whole set of new errors emerge and everything starts to fall like the card tower.&lt;/p&gt;
&lt;p&gt;I found a workaround for the moment but I don&amp;#39;t think this is a long-term solution: instead of &lt;em&gt;&lt;strong&gt;NRFX_CHECK(NRFX_SPIM_ENABLED)&lt;/strong&gt;&lt;/em&gt; I am checking &lt;em&gt;&lt;strong&gt;NRFX_CHECK(NRFX_SPIM3_ENABLED)&lt;/strong&gt;&lt;/em&gt; and this check passes successfully.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM3 initialization issue</title><link>https://devzone.nordicsemi.com/thread/209563?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2019 09:04:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a39ca28-594c-496d-852c-8ad4e8e4c087</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure that it&amp;#39;s the SDK &lt;em&gt;code&lt;/em&gt; that needs to be fixed - maybe just the documentation so that users can understand it, and know how to debug it when it goes wrong...&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It certainly doesn&amp;#39;t help when the IDE conspires against you.&lt;/p&gt;
&lt;p&gt;SES (sometimes) seems to cope poorly.&lt;/p&gt;
&lt;p&gt;&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;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM3 initialization issue</title><link>https://devzone.nordicsemi.com/thread/209559?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2019 08:53:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:861bdf27-bbe8-42fc-9c4a-1277c20a4ae4</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Sorry. I meant&amp;nbsp;SPI_ENABLED, not NRF_SPIM_ENABLED.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I also agree that most of apply_old_config.h is greyed out, but I believe that this is just the IDE&amp;#39;s not interpreting the defines correctly. So if SPI_ENABLED is defined, then&amp;nbsp;NRFX_SPI_ENABLED is undefined, and defined as&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;define NRFX_SPI_ENABLED \
    (SPI_ENABLED &amp;amp;&amp;amp; (NRFX_SPI0_ENABLED  || NRFX_SPI1_ENABLED  || NRFX_SPI2_ENABLED))&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I agree that this is very confusing, and you are by far not the only person facing this issue, as &lt;a href="https://devzone.nordicsemi.com/members/awneil"&gt;awneil&lt;/a&gt; points out.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We have reported it to our SDK team, and I hope that it is fixed in the next release of the SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM3 initialization issue</title><link>https://devzone.nordicsemi.com/thread/209554?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2019 08:38:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ce3b063-5a56-4a5a-8cdf-d55e109d11c4</guid><dc:creator>bojan</dc:creator><description>&lt;p&gt;Hello &lt;a href="https://devzone.nordicsemi.com/members/edvin-holmseth"&gt;Edvin&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;Just checked my &lt;em&gt;apply_old_config.h&lt;/em&gt; file (located at &lt;em&gt;integration/nrfx/legacy&lt;/em&gt;)... there is no &lt;em&gt;&lt;strong&gt;NRF_SPIM_ENABLED&lt;/strong&gt;&lt;/em&gt; there. Moreover, the whole content of the file is grayed.&lt;/p&gt;
&lt;p&gt;I think &lt;a href="https://devzone.nordicsemi.com/members/awneil"&gt;awneil&lt;/a&gt; is right, this is really the source of confusion and stress... real attack on our common sense, making us feel bad and doubting our programming skills!&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f913.svg" title="Nerd"&gt;&amp;#x1f913;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I did not know until now that the file like &lt;em&gt;apply_old_config.h&lt;/em&gt; exists. Anyway, good thing is that you are really responsive and helpful there. I hope we will all make Nordic environment even better in the future.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Bojan.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM3 initialization issue</title><link>https://devzone.nordicsemi.com/thread/209544?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2019 08:18:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8d08be4-f931-4b73-9d85-aa85f2dc0ee8</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;I find this to be a constant source of problems &amp;amp; confusion - both myself and in posts by others here on the forum.&lt;/p&gt;
&lt;p&gt;It is particularly hard to debug because of the way everything is hidden in multiple layers of macro definition, redefinition and preprocessor tricks with the ## operator, etc.&lt;/p&gt;
&lt;p&gt;&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;/p&gt;
&lt;p&gt;This really needs to be far better documented!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM3 initialization issue</title><link>https://devzone.nordicsemi.com/thread/209541?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2019 08:12:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e049aca6-8496-4d40-9f4b-bb3293ec0c2c</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Bojan,&lt;/p&gt;
&lt;p&gt;If NRFX_CHECK(NRFX_SPIM_ENABLED) returns false, then it means that NRFX_SPIM_ENABLED is defined to 0. Although you have defined it to 1 in sdk_config.h, it may be redefined in apply_old_config.h, which is a backwards compatibility header file.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Basically, if you define NRFX_SPIM_ENABLED 1 and NRF_SPIM_ENABLED 0, then NRFX_SPIM_ENABLED will be set to 0. So either:&lt;/p&gt;
&lt;p&gt;1: Define NRFX_SPIM_ENABLED to the same as NRF_SPIM_ENABLED&lt;/p&gt;
&lt;p&gt;2: Delete the NRF_SPIM_ENABLED define (not just set it to 0, but remove it).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;3: Remove the apply_old_config.h file from your project.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>