5 years, 7 months ago.

Adding a new target board

So I'm brand new to embedded systems development. Currently, I'm trying to add a new target board to targets.json. I'm using a Fanstel BT840, the specifications for which can be found here: http://www.fanstel.com/bt840f-nrf52840-ble-5-module-secure-iot-802154-thread-zigbee/

I've successfully compiled and programmed the "mbed-os-example-blinky" application onto the board, and when I run "mbed detect", it tells me that I have an NRF52_DK. The board we're using is based off of that DK, however the board does not respond as expected because the peripherals differ from an NRF52_DK. After speaking with someone on a separate thread, I was instructed to edit the PinNames.h file and save it in my target's directory (which I've created in the correct location). The pins are now mapped properly, however I'm having a tough time properly adding the new target board to targets.json. I've read through the following documentation: https://os.mbed.com/docs/v5.9/tools/adding-and-configuring-targets.html

As far as I know, my custom board doesn't need to change anything from the NRF52840_DK.

I've defined the target as follows:

"FANSTEL_BT840": { "inherits": [ "MCU_NRF52840" ], "device_name": "Fanstel_BT840" },

I've also tried:

"FANSTEL_BT840": { "inherits": [ "NRF52840_DK" ], "device_name": "Fanstel_BT840" },

And:

"FANSTEL_BT840": { "inherits": [ "NRF52_DK" ], "device_name": "Fanstel_BT840" },

After making this change to targets.json each time, I ran the lint.py script to check for errors, and in every case I've tried, the hierarchy has a missing link. The output looks like this:

/media/uploads/algorhythymic/mbed-os-example-blinkyerror4.png

What I don't understand is why the MCU_NRF52840 shows up as a Module and not an MCU. Additionally, I haven't found MCU definitions anywhere on the Mbed website, and wouldn't begin to know where to find the MCU that MCU_NRF52840 inherits. According to targets.json, MCU_NRF52840 inherits Target.

If anyone can help me properly add this custom board as a new target, it would be greatly appreciated. Thanks!

2 Answers

5 years, 7 months ago.

Try this (from the NRF52_DK) to get started:

"inherits": ["MCU_NRF52832"], "release_versions": ["5"], "device_name": "nRF52832_xxAA"

Unfortunately, this presents the same error, but instead of Module(MCU_NRF52840) it reads:

'??? -> Module(MCU_NRF52832) -> Board (FANSTEL_BT840)'

posted by Darien Morrison 14 Sep 2018
5 years, 7 months ago.

Hi Darien,

We've taken a look at the lint check utility for targets.json and it doesn't seem to be too happy with any target! We think you shouldn't rely on it for determining if your additions are correct. We will consult with our tools team about the utility.

We did go through the exercise of adding a custom NRF52840-based target. We were able to have the CLI compiler pick it up for building purposes through the -m build option.

Are you able to build for your custom FANSTEL_BT840 and do you see the proper files/properties being utilized by the build infrastructure?

Regards,

Ralph, Team Mbed

Hi Ralph, I believe we spoke on a separate thread related to this issue before. Reading the documentation it's a little unclear which keys need to go into a custom target, but as far as I know our target shouldn't have any difference, which is why I had it simply inherit the existing Nordic boards and gave it a new device name to reference it by. I went ahead and changed the pin mappings in PinNames.h, as well as added the target according to the links you sent from this thread:

https://os.mbed.com/forum/electronics/topic/33165/?page=1#comment-59401

We're currently able to build an mbed example application and flash it to our board, however even after changing PinNames.h and adding a new target, the board doesn't behave as expected. We've mapped the pins correctly according to the schematic we got from our electrical engineer.

posted by Darien Morrison 20 Sep 2018

Hi Darien,

From what you've reported thus far, just inheriting the MCU_NRF52840 should be okay. Do you think the program is running okay except for the pin mappings? We suggest debugging your program or at the minimum scoping the pins to make sure you are hitting the right ones.

Do you have a debugger installed? If not, this area of our Tutorials section should help:

-Ralph, Team Mbed

posted by Ralph Fulchiero 20 Sep 2018