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

Programming custom board through SES corrupts host device's bootloader

I am using a nRF52 DK to program an externally powered board with a NRF52811. 

I am able to flash a blinky program onto the custom board successfully using the output .hex files after building in SES

However, when I try to Start Execution while Debug has been selected, the DK will only show up as a corrupted USB device and is not able to flashed until I re-upload the bootloader software onto it. It is still able to be found by nRFgo Studio but it requires that I select a NRF51 device as it is unknown to the version of J-link software.

Furthermore, my custom board will not be programmed by starting execution. The program will build successfully but it will usually give me a hardFault.

This is a problem as I need to test programs that use a serial terminal. Any direction would be appreciated

I am using VDDnRF, VDD, VTC, SWDIO, SWDCLK, RESET, GND DETECT from the development kit to program my board

Update 1: Since using the recover option that nRFgo provides on my development, I am no longer able to flash blinky onto my custom board

Update 2: A fresh install of everything Nordic related seemed to fix my issue regarding flashing blinky, however I am still faced with the hardFault errors for most examples (see my reply below)

Parents Reply Children
  • This allowed the program to builld. If anyone is having the a similar problem with 'multiple definitions of UARTE0_UART0_IRQHANDLER'

    set the flag UART_LEGACY_SUPPORT to 0 in your sdk_config.h file.

    I am now met with another hard fault unfortunately. I've started with a fresh copy of twi_scanner and have performed the following steps on the pca10056 project to try and transfer it to the nrf52811 hardware:

    1. Project Options -> Common -> Debugger -> Target Device -> nRF52811_xxAA
    2. Project Options -> Common -> Preprocessor -> Preprocessor Definitions -> (changed NRF52840_XXAA to NRF52811_XXAA)
    3. Project Options -> Common -> Linker -> Section Placement Macros -> (changed FLASH_SIZE to 0x2FFFF and RAM_SIZE to 0x5FFF)
    4. Right click project -> Open Solution in Editor -> (change ses_startup_nrf52840.s to ses_startup_nrf52811.s and system_nrf52840 to system_nrf52811)
    5. Project Options -> Common -> Code Generation -> (ARM FPU TYPE -> None, ARM FP ABI TYPE -> Soft)
    6. Save and reload project
    7. Add in my own custom board layout and edit the scl and sda pins
    8. In the sdk_config.h file:
      1. NRFX_TWIM0_ENABLED 1
      2. UART_LEGACY_SUPPORT 0 
      3. NRFX_TWI0_ENABLED 1
    9. Also in the sdk_config.h file to enable the debug terminal
      1. NRF_LOG_BACKEND_RTT_ENABLED 1
      2. NRF_LOG_BACKEND_UART_ENABLED 0
      3. NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 0

    The program will then build and when I try to run it will give me a hard fault.

    UPDATE: also be sure to change the register definiton file to nrf52811.svd

    I also tried this with the fatfs example and I am met with the same hard fault

  • Can you attach your modified twi_scanner example? I would like to debug it on a nRF52811 board I have here. 

  • thank_you_bjorn.zip

    I am able to get examples working if I paste them into an already emulated example and import all the libraries etc, however, I'd like to understand what's happening here.

  • Found two errors in the project

    The first error was that FLOAT_ABI_HARD was added under Code > Preprocessor > Preprocessor Definitions. This must be changed to FLOAT_ABI_SOFT. Without this change I was not able to compile the project. 

    Running the project I saw that it Hardfaulted immediately and I saw that the Stack pointer was way out of bounds so I check the FLASH and RAM settings and the second error was that the FLASH and RAM settings were still set as if the code was running on a nRF52840, i.e. 

    FLASH_PH_START=0x0
    FLASH_PH_SIZE=0x100000
    RAM_PH_START=0x20000000
    RAM_PH_SIZE=0x40000
    FLASH_START=0x0
    FLASH_SIZE=0x2FFFF
    RAM_START=0x20000000
    RAM_SIZE=0x5FFF

    If you compare this to another pca10056e peripheral project, see below, then you see that the physical size of FLASH and RAM are much lower. So changing the Code > Linker > Section Placement Macros to the one below 

    FLASH_PH_START=0x0
    FLASH_PH_SIZE=0x30000
    RAM_PH_START=0x20000000
    RAM_PH_SIZE=0x6000
    FLASH_START=0x0
    FLASH_SIZE=0x30000
    RAM_START=0x20000000
    RAM_SIZE=0x6000

    After this change the example runs with no issues on my nRF52811 board. 

    Best regards

    Bjørn

  • With the changes I still hardfault immediately. Would you be able to attach the modified project so I can check if it runs on my board?

Related