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 Reply Children
  • 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.

Related