<?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 use custom board revisions in application code?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/119947/how-to-use-custom-board-revisions-in-application-code</link><description>Hi, 
 I use Nordic connect SDK and have to create a new revision for a custom board, because there are some hardware changes. I managed to create an overlay for the new revision where I could add some pins, which were added in the new revision. I also</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 25 Mar 2025 08:19:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/119947/how-to-use-custom-board-revisions-in-application-code" /><item><title>RE: How to use custom board revisions in application code?</title><link>https://devzone.nordicsemi.com/thread/528752?ContentTypeID=1</link><pubDate>Tue, 25 Mar 2025 08:19:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0c0667f-8e06-4ee1-a430-a2dfa5f1b1ac</guid><dc:creator>ilockit_CFR</dc:creator><description>&lt;p&gt;Thanks for your suggestion, but I must admit that I haven&amp;#39;t fully understood the concept of these file suffixes. At the moment I add the required overlays and Kconfig fragments when I create a build configuration with VS Code. I think that is working well enough at the moment. But I will take a look at the file suffixes, maybe it can simplify the build process.&lt;/p&gt;
&lt;p&gt;Thanks for your support.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use custom board revisions in application code?</title><link>https://devzone.nordicsemi.com/thread/528267?ContentTypeID=1</link><pubDate>Thu, 20 Mar 2025 15:16:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88f6e830-2c92-4b15-a790-bff26be96686</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="ilockit_CFR"]&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;urd_nrf52833.dts&lt;/li&gt;
&lt;li&gt;&lt;span&gt;urd_nrf52833_0_1_0.overlay&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;urd_nrf52833_canbus.overlay&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;urd_nrf52833_fingerprint.overlay&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;urd_nrf52833_gps.overlay&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;[/quote]
&lt;p&gt;Ideally, how would you like your build command to look for for example 0.1.0, fingerprint and CAN?&lt;/p&gt;
&lt;p&gt;I think what you are asking for are &lt;a href="https://docs.zephyrproject.org/latest/develop/application/index.html#file-suffixes"&gt;File Suffixes&lt;/a&gt;. &lt;br /&gt;Not sure exactly how that would work yet. I will look more into it later, but wanted to give you the idea first.&lt;/p&gt;
&lt;p&gt;Alternativley, I find some reference to &lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.6.0/page/zephyr/hardware/porting/board_porting.html#board-porting-guide"&gt;Custom revision.cmake files&lt;/a&gt;, which indicates that you can make more custom revision stuff, right?&lt;/p&gt;
[quote user="ilockit_CFR"]s it possible to create my own CONFIG_ variables?[/quote]
&lt;p&gt;Yes, you can do that in Kconfig files. See for example &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/boards/nordic/nrf9160dk/Kconfig"&gt;here&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use custom board revisions in application code?</title><link>https://devzone.nordicsemi.com/thread/528205?ContentTypeID=1</link><pubDate>Thu, 20 Mar 2025 12:08:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93646330-ba31-4089-9bc1-78df2d4e387c</guid><dc:creator>ilockit_CFR</dc:creator><description>&lt;p&gt;That was my first idea and it worked well. But then I noticed, that I have to create a lot of revisions for all possible combinations of hardware peripherals, for exaple:&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;led switch&lt;/li&gt;
&lt;li&gt;led switch + can&lt;/li&gt;
&lt;li&gt;led switch + can + gps&lt;/li&gt;
&lt;li&gt;led switch + gps&lt;/li&gt;
&lt;li&gt;fingerprint&lt;/li&gt;
&lt;li&gt;fingerprint + can&lt;/li&gt;
&lt;li&gt;and so on...&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;So I would prefer an approach where I can configure the build process according to the underlying hardware.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;According to your example I have&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;urd_nrf52833.dts&lt;/li&gt;
&lt;li&gt;&lt;span&gt;urd_nrf52833_0_1_0.overlay&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;urd_nrf52833_canbus.overlay&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;urd_nrf52833_fingerprint.overlay&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;urd_nrf52833_gps.overlay&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;and maybe more, if our hw developer has more ideas ;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Can I create defconfig files for the overlays, too? Is it possible to create my own CONFIG_ variables? I tested it once and the compiler said, that it was unknown.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use custom board revisions in application code?</title><link>https://devzone.nordicsemi.com/thread/528199?ContentTypeID=1</link><pubDate>Thu, 20 Mar 2025 11:49:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5ea025a-07b4-46c2-94ed-99a3ea311f47</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="ilockit_CFR"]&lt;p&gt;At the moment I created a revision overlay file, which contains the generals changes to the new pcb design for all subsequent variants. Additionally, I create overlay files for each optional hardware feature. As I understood the documentation the overlays can then be set independently when I set-up a build configuration.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is that approach correct? &lt;/p&gt;[/quote]
&lt;p&gt;I think it does. However, I will list how I would do it, and then you can say if that approach matches what you need or not:&lt;/p&gt;
&lt;p&gt;If practical, I would give different revisions to boards with different peripherals, to simplify the system.&lt;/p&gt;
&lt;p&gt;Then I would add overlays and deconfig to the board files per revision. See &lt;a href="https://docs.zephyrproject.org/latest/hardware/porting/board_porting.html#board-revision-configuration-adjustment"&gt;Board revision configuration adjustment&lt;/a&gt;. For example if my custom board was named &amp;quot;urd&amp;quot;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;urd_nrf52833_0_1_0.overlay
&lt;ul&gt;
&lt;li&gt;can node has `status=&amp;quot;disabled&amp;quot;`&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;urd_nrf52833_0_1_0-pinctrl.overlay&amp;nbsp;
&lt;ul&gt;
&lt;li&gt;Must be included in the normal overlay&lt;/li&gt;
&lt;li&gt;Changes pins&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;urd_nrf52833_0_1_0_deconfig &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Has CONFIG_CAN=n&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;urd_nrf52833_0_2_0.overlay
&lt;ul&gt;
&lt;li&gt;can node has `status=&amp;quot;okay&amp;quot;`&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;urd_nrf52833_0_2_0-pinctrl.overlay &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Must be included in the normal overlay&lt;/li&gt;
&lt;li&gt;Changes pins&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;urd_nrf52833_0_2_0_deconfig
&lt;ul&gt;
&lt;li&gt;Has CONFIG_CAN=y&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Then in the project, you can filter on CONFIG_CAN. In .c files you can do &amp;quot;#if defined(CONFIG_CAN)&amp;quot; and in CMakeLists.txt you can use &amp;quot;if(CONFIG_CAN)&amp;quot;.&lt;/p&gt;
&lt;p&gt;Since pins change in the pinctrl, the driver for those specific pins should be the same for each version, so you should not have to do anything in source code for this.&lt;/p&gt;
&lt;p&gt;PS: You can use &amp;quot;.dts&amp;quot; files instead of &amp;quot;.overlay&amp;quot; files if you want to &lt;strong&gt;overwrite&lt;/strong&gt; original revision instead of overlaying it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use custom board revisions in application code?</title><link>https://devzone.nordicsemi.com/thread/528180?ContentTypeID=1</link><pubDate>Thu, 20 Mar 2025 10:39:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:730542e6-7242-4508-ae58-de7225759075</guid><dc:creator>ilockit_CFR</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;thanks for the reply. It&amp;#39;s a bit more complicated as I thought before. We have a new revision of the board with some minor general changes, e.g. the change of pin assignment of already existing pins.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In addtion to that there&amp;#39;re assembly variants of the pcb, e.g. a CAN bus controller which can be equipped or not. This uses new pins.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And we have assembly variants were already existing pins are repurposed. We have a LED/button combination which can be exchanged for a fingerprint sensor. This means, the button/LED pins are now used for UART communication with the fingerprint sensor.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The combination of these features should be as free as the SOC allows.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;At the moment I created a revision overlay file, which contains the generals changes to the new pcb design for all subsequent variants. Additionally, I create overlay files for each optional hardware feature. As I understood the documentation the overlays can then be set independently when I set-up a build configuration.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is that approach correct? And where do I define some macros for the used hardware overlays, which can be used in the source code to include/exclude features like CAN bus or fingerprint sensor?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Christian&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use custom board revisions in application code?</title><link>https://devzone.nordicsemi.com/thread/528169?ContentTypeID=1</link><pubDate>Thu, 20 Mar 2025 10:04:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:435d4437-1d83-4b86-956c-4499f3531466</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Does the new revision use different pins for one feature, or does it add a new feature with some pins that were not used from the original revision?&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>