Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF5 SDK 15 TWI Scanner example, strange pin layout

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 = P0.16

Your SDK example TWI Scanner contains file: PCA10056_H has only this:

// Arduino board mappings
#define ARDUINO_SCL_PIN 27 // SCL signal pin
#define ARDUINO_SDA_PIN 26 // SDA signal pin
#define ARDUINO_AREF_PIN 2 // Aref pin

Isn't it too bad, after all these years, of NRF5 SDK to put Arduino defines in your official example :-D ?

Anyway, how to map custom pins in this specific case? Your older threads mention some TWI configuration for custom boards, but no defines like TWI0_SCL_PIN do exist in whole SDK. It was only in NRF51.

Thanks,

Cyberluke

  • I understand your concern. If you create your own custom_board.h file and put it in components\boards, and you share the project file with others, they won't find the file. 

    However, you can still use the approach explained below, while custom_board.h is a part of your project. You do this by placing the custom_board.h file inside examples\peripheral\twi_scanner. Then you simply define BOARD_CUSTOM, and the boards.h will include the file custom_boards.h.

  • I'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? 

    My guess:

    1) Let Nordic include empty custom_board.h themselves in /components/boards

    2) Do not set BOARD_CUSTOM, do not set BOARD_anything in the project

  • I think it's a good thing that a fatal error is thrown when you have defined BOARD_CUSTOM without including the custom_board.h file. Then you get redirected to the line shown below in boards.h. Then you can easily see how to avoid the error, either remove the definition or include the header file. Do you agree?

    #elif defined(BOARD_CUSTOM)
      #include "custom_board.h"

    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?

Related