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
  • Hi sheddanl,

    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.

     nRFGo Studio is deprecated for the nRF52 Series. You need to use the nRF Programmer application in nRF Connect for Desktop, see nRF Connect Programmer.  If you flash the bootloader to a nRF52 device, then the nRF52 will remain in bootloader mode even though an application has been flashed until a boootloader settings page is flashed to the nRF52, see Appendix 1 in https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/getting-started-with-nordics-secure-dfu-bootloader

    Best regards

    Bjørn

  • Thank you for replying to my question :)

    Yesterday I did a fresh install of everything Nordic related and now I am able to get the pca10040e blinky example to program from Segger Embedded Studio using Debug and Release, however pca10040 does not work, it will give me a hardfault. This is the same with the TWI scanner for pca10040.

    I suppose my question is now why is the emulated project working for me but not the other?

  • This resolved the error, although I did not have the option for ARM FP ABI Type -> Soft, instead I used None.

    I am trying to use the TWI scanner example, and now I am given the error:

    'TWIM1_EASYDMA_MAXCNT_SIZE' undeclared (first use in this function); did you mean 'TWIM0_EASYDMA_MAXCNT_SIZE'?

    In the file nrfx_twim.c

    Is this related to my original issues?

  • Have you altered the sdk_config.h file of the TWI scanner example for the pca10056? If you could share the modified project, then I can debug it here on my end. 

  • twi_scanner.zip

    I believe I have altered things in the config file. Although forgive me, I can't remember exactly what.

    Thanks very much

    Could this have something to with the limitations on the bit length? 

    If so how can I make sure I use the correct length, as I am trying to use an SD card in SPI mode.

  • The nRF52811 does not have a TWIM1 instance, see Instantiation, so I think its related to your sdk_config.h. 

    In the twi_scanner main.c file you see that the instance is set by the sdk_config.h definitions. 

    /* TWI instance ID. */
    #if TWI0_ENABLED
    #define TWI_INSTANCE_ID     0
    #elif TWI1_ENABLED
    #define TWI_INSTANCE_ID     1
    #endif
    

    So just make sure that TWI0_ENABLED is set to 1 and TWI1_ENABLED is set to 0 in sdk_config.h 

  • 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

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

Children
Related