<?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>NRF5 SDK 15 TWI Scanner example, strange pin layout</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43208/nrf5-sdk-15-twi-scanner-example-strange-pin-layout</link><description>Hi, 
 
 I have Ublox EVK-NINA-B3 on table, which has totally different pin layout than NRF52 DK (not sure why): https://www.u-blox.com/sites/default/files/EVK-NINA-B3_UserGuide_%28UBX-17056481%29.pdf 
 
 It mentions: 
 SDA, schematic pin GPIO_4, NRF52_pin</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 06 Feb 2019 11:13:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43208/nrf5-sdk-15-twi-scanner-example-strange-pin-layout" /><item><title>RE: NRF5 SDK 15 TWI Scanner example, strange pin layout</title><link>https://devzone.nordicsemi.com/thread/169695?ContentTypeID=1</link><pubDate>Wed, 06 Feb 2019 11:13:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7f29980-d64d-41d0-8edd-b2a1a9e4de50</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I think it&amp;#39;s a good thing that a fatal error is thrown when you have defined BOARD_CUSTOM without including the &lt;em&gt;custom_board.h&lt;/em&gt; file. Then you get redirected to the line shown below in &lt;em&gt;boards.h.&amp;nbsp;&lt;/em&gt;Then you can easily see how to avoid the error, either remove the definition or include the header file. Do you agree?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#elif defined(BOARD_CUSTOM)
  #include &amp;quot;custom_board.h&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So you think the example projects would be improved without having the board definitions? If so, how should everything be organized in order to make one project compatible with several boards?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5 SDK 15 TWI Scanner example, strange pin layout</title><link>https://devzone.nordicsemi.com/thread/169086?ContentTypeID=1</link><pubDate>Fri, 01 Feb 2019 13:50:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a52e2173-1152-4e78-a701-753f48e4d65c</guid><dc:creator>cyberluke</dc:creator><description>&lt;p&gt;I&amp;#39;m not at desktop PC with NRF SDK atm. Just on laptop with Java. From what I remember, the problem was that if you define BOARD_CUSTOM anywhere in the project, some include inside /components/boards will catch this and will want to include custom_board.h file in /components/boards folder, which does not exist here by default. So the app will not compile and will throw fatal error during the build (tried yesterday on SDK 15.2). Any clues?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My guess:&lt;/p&gt;
&lt;p&gt;1) Let Nordic include empty custom_board.h themselves in /components/boards&lt;/p&gt;
&lt;p&gt;2) Do not set BOARD_CUSTOM, do not set BOARD_anything in the project&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5 SDK 15 TWI Scanner example, strange pin layout</title><link>https://devzone.nordicsemi.com/thread/169080?ContentTypeID=1</link><pubDate>Fri, 01 Feb 2019 13:45:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:737397fb-7fe2-48a4-8af0-792eb4fc2371</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I understand your concern.&amp;nbsp;If you create your own&amp;nbsp;&lt;em&gt;custom_board.h&amp;nbsp;&lt;/em&gt;file and put it in&amp;nbsp;&lt;em&gt;components\boards&lt;/em&gt;,&amp;nbsp;and&amp;nbsp;you share the project file with others, they won&amp;#39;t find the file.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, you can still use the approach explained below, while &lt;span&gt;custom_board.h is a part of your project. You do this&lt;/span&gt;&amp;nbsp;by placing the &lt;em&gt;custom_board.h&lt;/em&gt; file inside&amp;nbsp;&lt;em&gt;examples\peripheral\twi_scanner. &lt;/em&gt;Then you simply define&amp;nbsp;BOARD_CUSTOM, and the boards.h will include the file &lt;em&gt;custom_boards.h.&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5 SDK 15 TWI Scanner example, strange pin layout</title><link>https://devzone.nordicsemi.com/thread/169077?ContentTypeID=1</link><pubDate>Fri, 01 Feb 2019 13:31:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9ecdffc-7ddb-414f-ae38-f76135c2d9ae</guid><dc:creator>cyberluke</dc:creator><description>&lt;p&gt;It&amp;#39;s only header file, without any logic. It must be separated from code logic (SDK) in order to easily make transition on another SDK deployment: ie. wipeout NRF5_SDK folder and unzip new NRF5 SDK folder. That&amp;#39;s how software architecture &amp;amp; development should be. Layers, modules, separate business logic, etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5 SDK 15 TWI Scanner example, strange pin layout</title><link>https://devzone.nordicsemi.com/thread/169076?ContentTypeID=1</link><pubDate>Fri, 01 Feb 2019 13:29:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7101348-31d8-4240-92eb-0f393bbf6b9e</guid><dc:creator>cyberluke</dc:creator><description>[quote userid="72692" url="~/f/nordic-q-a/43208/nrf5-sdk-15-twi-scanner-example-strange-pin-layout/169073"]If you can&amp;#39;t find your board in&amp;nbsp;&lt;em&gt;components\boards &lt;/em&gt;then you would need to create your own custom header file&amp;nbsp;&lt;em&gt;custom_board.h&amp;nbsp;&lt;/em&gt;with the appropriate definitions (remember to use the same naming conventions as the example projects).[/quote]
&lt;p&gt;^ THIS. Let me try to ask in more simple way. I have new board and I need to create custom_board.h, but I believe, by best practices, it should not be included in SDK folder. It should be included in project folder. Is it possible? Does it make sense? Then I would not put any preprocessor symbol like BOARD_CUSTOM or BOARD_PCAxxxxx. Would it be correct?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5 SDK 15 TWI Scanner example, strange pin layout</title><link>https://devzone.nordicsemi.com/thread/169073?ContentTypeID=1</link><pubDate>Fri, 01 Feb 2019 13:19:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb9af604-9c3b-4ea6-a397-4d5cf73b9f3f</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;The arduino definitions are intended to be used when the&amp;nbsp;&lt;span&gt;nRF52 Development Kit&lt;/span&gt;&lt;span&gt;&amp;nbsp;board is used as a shield together with an Arduino standard motherboard (see &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52%2Fdita%2Fnrf52%2Fdevelopment%2Fnrf52840_pdk%2Fconnector_if.html"&gt;this&lt;/a&gt; link). I am not sure why the TWI examples uses these definitions. It may be due to simplicity (no need to make new SCL and SDA definitions when it works perfectly well to use the arduino definitions). Also, it doesn&amp;#39;t really matter which pins are being used, as long as you connect it correctly to the TWI sensor.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Regarding board mapping, I think the current approach used in the SDK is a good way of doing it. The examples in the SDK are written in a manner that is independent of the board used, which makes it possible to create&amp;nbsp;one single&amp;nbsp;project, for many&amp;nbsp;different boards.&lt;/p&gt;
&lt;p&gt;This is achieved by&amp;nbsp;being consistent regarding the definition names. E.g. in the TWI scanner example, the definitions&amp;nbsp;ARDUINO_SCL_PIN and&amp;nbsp;ARDUINO_SDA_PIN are used, and if you look at the files&amp;nbsp;&lt;em&gt;components\boards\pca10040.h&lt;/em&gt; and&amp;nbsp;&lt;span&gt;&lt;em&gt;components\boards\pca10056.h&lt;/em&gt;, both contain these definitions (In this case they are assigned the same pin values, but this is not always the case). Then you can easily switch board by adding the appropriate&amp;nbsp;preprocessor definition, and &lt;em&gt;boards.h&lt;/em&gt; will include the correct board mapping. E.g. BOARD_PCA10040 will include the&amp;nbsp;&lt;em&gt;pca10040.h&amp;nbsp;&lt;/em&gt;file and make the project compatible with the &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52%2Fdita%2Fnrf52%2Fdevelopment%2Fnrf52840_pdk%2Fconnector_if.html"&gt;nRF52832 DK&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;If you can&amp;#39;t find your board in&amp;nbsp;&lt;em&gt;components\boards &lt;/em&gt;then you would need to create your own custom header file&amp;nbsp;&lt;em&gt;custom_board.h&amp;nbsp;&lt;/em&gt;with the appropriate definitions (remember to use the same naming conventions as the example projects).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5 SDK 15 TWI Scanner example, strange pin layout</title><link>https://devzone.nordicsemi.com/thread/168910?ContentTypeID=1</link><pubDate>Thu, 31 Jan 2019 14:50:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:403e7035-a5c5-41a9-89ff-3048147508ae</guid><dc:creator>cyberluke</dc:creator><description>&lt;p&gt;Yes, but I&amp;#39;m developing on DK in order to make firmware for NRF52 unit and for this I only need to setup TWI specific stuff. So it should be portable and written in terms of the best practices for TWI library inside NRF5 SDK 15.2.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The manufacturer = UBlox and it is big mess. They have custom_board.h in that PDF only and it is split across two pages. I cannot understand, why they cannot provide zip file with headers and just put it inside PDF in a bad way with bad&amp;nbsp; formatting. Also they mention to put custom_board.h inside NRF SDK/components/boards/ ...which is not portable. Every SDK version, I will have to run recursive diff &amp;amp; merge for these extra files.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So question is: Where can I find best practices for NRF5 SDK making custom board and including inside example project? Not polluting SDK folder, which is not under my control?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5 SDK 15 TWI Scanner example, strange pin layout</title><link>https://devzone.nordicsemi.com/thread/168886?ContentTypeID=1</link><pubDate>Thu, 31 Jan 2019 13:54:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba18a4eb-dc1a-41ca-9f2b-95270c31c003</guid><dc:creator>awneil</dc:creator><description>[quote userid="76701" url="~/f/nordic-q-a/43208/nrf5-sdk-15-twi-scanner-example-strange-pin-layout"]Isn&amp;#39;t it too bad, after all these years, of NRF5 SDK to put Arduino defines in your official example[/quote]
&lt;p&gt;Seems perfectly reasonable to me: these map to the Arduino connectors on on the DK - so it seems obvious to name them, &amp;quot;ARDUINO_...&amp;quot;&lt;/p&gt;
[quote userid="76701" url="~/f/nordic-q-a/43208/nrf5-sdk-15-twi-scanner-example-strange-pin-layout"]// Arduino board mappings&lt;br /&gt;#define ARDUINO_SCL_PIN 27&amp;nbsp;// SCL signal pin&lt;br /&gt;#define ARDUINO_SDA_PIN&amp;nbsp;26 // SDA signal pin&lt;br /&gt;#define ARDUINO_AREF_PIN 2 // Aref pin[/quote]
&lt;p&gt;If you look at the DK User Guide, you will see that SCL on the Arduino headers goes to P0.&lt;strong&gt;27&lt;/strong&gt;, and SDA&amp;nbsp;&lt;span&gt;on the Arduino headers goes to P0.&lt;strong&gt;26&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So, to use other pins, just change those numbers.&lt;/span&gt;&lt;/p&gt;
[quote userid="76701" url="~/f/nordic-q-a/43208/nrf5-sdk-15-twi-scanner-example-strange-pin-layout"]no defines like&amp;nbsp;TWI0_SCL_PIN do exist in whole SDK[/quote]
&lt;p&gt;Presumably because, on the nRF52, you can route the functions to any pin you like.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>