This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

extra Hardware needed to debugging nRF52832 through USB ?

Hi, maybe my question is a little basic, but this is my first time developing with a Nordic chip, i have been reading how to debug a nrf52 based device, and i know that i must upload a custom bootloader if i want to debug my device through USB or UART, my question is about HW,
as i understand i need a USB to UART chip to debugging the device through UART, but if i want to debug my device through SWD interface but using a USB connection on my board , additionally to upload the bootloader,must i have a USB to SWD chip integrated to my board to achieve the communication?

Thanks for reading 

Best regard

Parents
  • Hi,

    The nRF52 DK comes with an onboard SWD debugger (J-Link), so I recommend you go with that. This debugger can also be used to debug other boards via the Debug out connector. The USB connector on the DK is connected to the onboard debugger, which in turn is connected to the SWD pins on the nRF52832. (The nRF52832 does not have a USB interface, so there is no way to do DFU over USB. You consider the nRF52840 instead.)

    You may also find the SDK Getting started guide useful.

    I somewhat disagree with the previous answer when it comes to development environment. In my option, the easiest way to get started with nRF development is using Segger Embedded Studio, which is a fully featured integrated IDE which can be used free of charge for any project where the target device is a Nordic product.

  • ok thanks for clarify my doubt, i was pretty confused about that. So for the first FW upload i must do it over SWD interface and i can use DFU over the air for update FW right?

  • When you have an nRF52 chip that is brand new, its flash will be completely blank. This means it won't have a pre-existing boot loader in it. When you power it up, it'll just sit there unable to do anything. So yes: for a blank chip, the only way to program the flash is using an external SWD debug tool. Once you have programmed it the first time with an image which is able to perform firmware updates on its own, then you can load new code using that mechanism instead.

    That said:

    - If your application code wipes or corrupts the flash, you'll need the debug tool to recover it.

    - The debugger is immensely useful when writing your own software for the MCU. You can use it to examine the CPU state and memory and step through your code line by line (or instruction by instruction) to see what it's doing.

    Without the debugger you'd have to rely on adding lots of printf()s to your code, which can be effective but it's slow going.

    BTW, my preference is to use an completely open source toolchain, including the latest versions of GCC, binutils, GDB, newlib and OpenOCD. You can compile these from the original GNU sources. For the most part, the trick is to configure them using --target=arm-none-eabi.

    Also, there is a free ARM IDE which should work with the nRF52 chip:

    https://gnu-mcu-eclipse.github.io/

    You will want to download the GNU MCU ARM GCC toolchain, which includes binaries of GCC, GDB and binutils. (There's versions for Linux, Windows and MacOS.) You will also want the GNU MCU OpenOCD installation. OpenOCD is what talks to the SWD debug tool and provides support for GDB (or Eclipse) to debug the board.

    -Bill

  • The debugger is immensely useful when writing your own software for the MCU

    Absolutely!

    To call it "indispensable" would only be a slight exaggeration!

    I would still suggest that setting up your own Eclipse IDE from scratch is not a beginner's task - far better to start with a ready-to-use, supported toolset.

    But each to his own.

Reply Children
No Data
Related