Re: Sparkfun Pro nRF52840 Mini support?


Lawrence King
 

Hi Rodrigo:

 

I went through the schematics for the SparkFun nrf52840 mini, the Adafruit nrf52840 Feather, and the Nordic pca10059 reference board. All three boards are nearly identical, (other than physical form factors, and the choices of which GPIOs go to the switches, led(s) and I/Os). All three boards use the same boot loader and are fully capable of downloading and running code without the use of an external programming dongle.

 

Unfortunately the Zephyr developers have elected to not use the onboard debug facilities of these boards, and have instead decided that users need to buy and use an external programming device for these boards. This is not the first time I have seen this, I had exactly the same issue with the i.MXMRT1064 board, it too has an onboard debugger, but the only way to use the board is with an external probe.

 

Here is what the Zephyr documentation for the Adafruit feather says https://docs.zephyrproject.org/latest/boards/arm/nrf52_adafruit_feather/doc/nrf52_adafruit_feather.html

 

Flashing

Flashing Zephyr onto the nrf52_adafruit_feather board requires an external J-Link programmer. The programmer is attached to the X1 SWD header.

Other boards such as the MakerDairy nrf52840-mdk do use the onboard debug facilities, and these boards are trivial to bring up with Zephyr, just plug the board into the USB port and type “ninja flash”. If only all of the boards with onboard debug facilities were this easy.

 

Dear Zephyr Developers:

              Please use these boards in exactly the same way a “customer” would use them. Use the onboard debug facilities! It is quick and easy for you to bring the board up with your external debugger, but this should only be used for initial bringup. After that you really should move the debugger dongle off your bench and use the onboard debug facilities.

 

Lawrence King

Principal Developer

+1(416)627-7302

 

From: users@... <users@...> On Behalf Of Rodrigo Peixoto
Sent: Monday, April 22, 2019 11:28 AM
To: Lawrence King <lawrence.king@...>
Cc: Zephyr-users@...
Subject: Re: [Zephyr-users] Sparkfun Pro nRF52840 Mini support?

 

Lawrence,

Do you have the memory footprint detailed when using their bootloader?

I would suggest you change the flash partition to fit the bootloader image size at the bootloader portion and the rest of the image after that. 

 

```c++

...

chosen {

                            zephyr,console = &uart0;

                            zephyr,shell-uart = &uart0;

                            zephyr,uart-mcumgr = &uart0;

                            zephyr,bt-mon-uart = &uart0;

                            zephyr,sram = &sram0;

                            zephyr,flash = &flash0;

                            zephyr,code-partition = &code_partition;

              };

 

...

 

&flash0 {

              /*

              * For more information, see:

              */

              partitions {

                            compatible = "fixed-partitions";

                            #address-cells = <1>;

                            #size-cells = <1>;

 

                            boot_partition: partition@0 {

                                          label = "sparkfun_bootloader";

                                          reg = <0x000000000 0x000XXXX>; // size of that

                            };

                            code_partition: partition@XXXX {

                                          label = "image-0";

                                          reg = <0x0000XXXX 0x0000YYYYYY>; // fit the rest of the memory remember the storage partion

                            };

                            /*

                            * The flash starting at 0x000f8000 and ending at

                            * 0x000fffff is reserved for use by the application.

                            */

 

                            /* Storage partition will be used by FCB/NFFS/NVS if enabled. */

                            storage_partition: partition@f8000 {

                                          label = "storage";

                                          reg = <0x000f8000 0x00008000>;

                            };

              };

};

```

 

Something like that.

 

Answering your question: 

 

Of course my fallback plan is to use an external debugger (J-Link of some kind? Black Majic?). Is there a recommended external debugger I should use for nRF52840?

 

I am using the JLINK with a tag connect plug (TC2030) to flash via SWD pins. west flash always works for me.

I hope it helps. 

 

Best regards,

Rodrigo Peixoto

Co-founder and Technical advisor

 

+55 (82) 98144-8585

http://ayna.tech | Skype: rodrigopex

 

 

 

Em seg, 22 de abr de 2019 às 10:38, Lawrence King <lawrence.king@...> escreveu:

Hi Rodrigo

 

The parts you talked about are the easy parts and I have no problem with these changes. (LDO/DC-DC, crystals, gpio aliases, dts, etc.). I think I already have these set up.

 

The “challenge” with the Sparkfun board is the debugger, and the FLASH space. The Sparkfun board does NOT have an external chip of some kind to do debugging, instead they preload the nRF52840 with a bootloader which presents itself on the native USB interface as a serial port (CDC) and a mass storage device. This way the “usual” tools will work (pyocd) exactly as expected. However the bootloader is “somewhere” in the internal FLASH and it is necessary to change the memory definition in dts to not overwrite the bootloader (and brick the board), also the serial console needs to call the bootloader to output messages on the virtual serial port.

 

Has anyone looked into these portions of the problem for some other chipset? This is the portion of the problem I am not quite sure how to fix.

 

Of course my fallback plan is to use an external debugger (J-Link of some kind? Black Majic?). Is there a recommended external debugger I should use for nRF52840?

 

Lawrence King

Principal Developer

+1(416)627-7302

 

From: Rodrigo Peixoto <rodrigopex@...>
Sent: Thursday, April 18, 2019 12:49 PM
To: Lawrence King <lawrence.king@...>
Cc: Zephyr-users@...
Subject: Re: [Zephyr-users] Sparkfun Pro nRF52840 Mini support?

 

Hi Lawrence,

 

I am not aware if anyone is bringing up this board, but I can suggest you bring it up yourself. It is not a big deal. The process is copying, pasting, and changing some portion of the files. 

 

How experienced are you on Zephyr?

 

 

1 - Is the Bluetooth module using dc-dc or LDO? 

    YES: Do nothing just copy the board files and rename them;

     NO: You must to disable DCDC by setting the BOARD_ENABLE_DCDC to "default n" at the Kconfig file. 

2 - Is the low-frequency oscillator is present on the Bluetooth module?

    YES: Do nothing

    NO: You have to add the CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y to the "board_name_defconfig" file. 

 

The last step is to change the DTS to adjust the pins used by your board. 

 

If you need further help let us know.

 

 

Best regards,

Rodrigo Peixoto

Co-founder and Technical advisor

 

+55 (82) 98144-8585

http://ayna.tech | Skype: rodrigopex

 

 

 

Em qui, 18 de abr de 2019 às 11:09, Lawrence King <lawrence.king@...> escreveu:

I just received some Sparkfun nRF52840 boards and I was hoping to bring up Zephyr on the boards.

 

There is a Sparkfun nRF52832 board listed in the supported boards, but this board needs an external debugger. Now that Sparkfun has two different nRF52 boards I think that the existing board in the tree nrf52_sparkfun needs to be renamed to nrf52832_sparkfun, and the new board should be added as nrf52840_sparkfun.

 

The nrf52840_sparkfun board has an onboard bootloader which presents as a tty and a usb drive when I plug it in so I expect that pyOCD should work for loading code and debugging, however I think that the ROM layout may need to be changed to not overwrite the bootlopader.

 

Is anyone working on bringing up this board?

 

https://www.sparkfun.com/products/15025

 

 

Lawrence King

Principal Developer

Connected Transport Market Unit

https://www.Irdeto.com

+1(416)627-7302

 

1  2 - linkedin  3 - instagram  4 - youtube  6 - facebook  7

            

CONFIDENTIAL: This e-mail and any attachments are confidential and intended solely for the use of the individual(s) to whom it is addressed. It can contain proprietary confidential information and be subject to legal privilege and/or subject to a non-disclosure Agreement. Unauthorized use, disclosure or copying is strictly prohibited. If you are not the/an addressee and are in possession of this e-mail, please delete the message and notify us immediately. Please consider the environment before printing this e-mail. Thank you.

 

 

 

Join users@lists.zephyrproject.org to automatically receive all group messages.