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

nRF52832 WLCSP Package SWD Programming with nRF52DK (PCA10040)

Dear Nordic FAE and fellow engineers,

I am using a custom board with nRF52832 WLCSP and I am trying to program it via SWD using NRF52DK PAC10040, and SES for programming SDK_17.0. I followed 2 layer reference design of NRF52832 CIAA, however the program still cannot be flashed onto the MCU even though it is showing on SES that it was programmed successfully. The connection for SWD programming followed is based on this link. Attached is the schematic and layout. Any suggestions are much appreciated, thank you.

Parents
  • Hi,

    How do you determine that the application isn't properly flashed? Could you try using nrfjprog and program it directly with the log option:

    nrfjprog --program YOURHEXFILE --sectorerase --log

  • Thank you for your respond. Yes, below is the log message. I am using this program from Nordic GitHub (link) to test BLE and ADC of my custom board.

    I tried to debug with SES, and it stopped at timers.init() and stopped at HardFault_Handler(). Do I need to change one of the timer parameters in the sdk_config ? Please advise what possibly caused this issue. Please refer to image below for details on the debugging, thank you.

  • Hi,

    Ok, so the program is actually flashed properly since you're able to use the debugger in SES. I flashed a nRF52 DK with the example and it worked without any issues. Have you made a custom board file for your custom board? Note that resuming a softdevice application in debugging after you've halted it will result in error. You would have to restart the application between every time you've paused it during debugging. Exactly at what step in timers_init() does it hardfault?

    regards

    Jared

  • Hi Jared, 

    It turns out that the custom_board.h file was the issue. It was still defined as pca10040.h. However, currently the program does not work after power restart. Could it be the button defined in the custom_board.h that causes the issue ? Since my board does not have any button. Below is the attached header file for the custom board. Please advise, thank you.

    /**
     * Copyright (c) 2014 - 2020, Nordic Semiconductor ASA
     *
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without modification,
     * are permitted provided that the following conditions are met:
     *
     * 1. Redistributions of source code must retain the above copyright notice, this
     *    list of conditions and the following disclaimer.
     *
     * 2. Redistributions in binary form, except as embedded into a Nordic
     *    Semiconductor ASA integrated circuit in a product or a software update for
     *    such product, must reproduce the above copyright notice, this list of
     *    conditions and the following disclaimer in the documentation and/or other
     *    materials provided with the distribution.
     *
     * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
     *    contributors may be used to endorse or promote products derived from this
     *    software without specific prior written permission.
     *
     * 4. This software, with or without modification, must only be used with a
     *    Nordic Semiconductor ASA integrated circuit.
     *
     * 5. Any software provided in binary form under this license must not be reverse
     *    engineered, decompiled, modified and/or disassembled.
     *
     * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
     * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
     * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
     * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
     * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     */
    #ifndef CUSTOM_BOARD_H
    #define CUSTOM_BOARD_H
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    #include "nrf_gpio.h"
    
    // LEDs definitions for 
    #define LEDS_NUMBER    1
    
    #define LED_1          8
    
    #define LEDS_ACTIVE_STATE 1
    
    #define LEDS_INV_MASK  LEDS_MASK
    
    #define LEDS_LIST { LED_1 }
    
    #define BSP_LED_0      LED_1
    
    #define BSP_LED_0_MASK (1<<BSP_LED_0)
    
    #define LEDS_MASK      (BSP_LED_0_MASK)
    
    #define LEDS_INV_MASK  LEDS_MASK
    
    #define BUTTONS_NUMBER 1
    
    #define BUTTON_START   13
    #define BUTTON_1       13
    #define BUTTON_STOP    13
    #define BUTTON_PULL    NRF_GPIO_PIN_PULLDOWN
    
    #define BUTTONS_ACTIVE_STATE 0
    
    #define BUTTONS_LIST { BUTTON_1 }
    
    #define BSP_BUTTON_0   BUTTON_1
    
    #define RX_PIN_NUMBER  26
    #define TX_PIN_NUMBER  27
    #define CTS_PIN_NUMBER 24
    #define RTS_PIN_NUMBER 25
    #define HWFC           false
    
    #define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_RC,              \
                                     .rc_ctiv       = 16,                               \
                                     .rc_temp_ctiv  = 2,                                \
                                     .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif
    
    

  • Hi,

    Please specify what you mean by "does not work", where does the program stop? It could be the button, but it depends entirely on what error that you get. 

    regards

    Jared

  • Hi, 

    After further inspection, I find that there are some discrepancies in the register. My findings are as follow :

    1. Below is the register read after flashing the program via SES where the BLE application is running properly.

    2. Below is the register read after power restart where the BLE cannot be detected on the mobile phone.

    3. However, the program runs again after I did verify in SES (target --> verify) or when I connect it on nRF Connect Programmer.

    4. When programming the device with hex file via nrfjprog --program ble_app_uart_pca10040_s132.hex --sectoranduicrerase, the read register is also different. It becomes as follow :

    It looks like there are errors in my setup, please advise what I did wrong, thank you.

    Regards,

    Reno

Reply
  • Hi, 

    After further inspection, I find that there are some discrepancies in the register. My findings are as follow :

    1. Below is the register read after flashing the program via SES where the BLE application is running properly.

    2. Below is the register read after power restart where the BLE cannot be detected on the mobile phone.

    3. However, the program runs again after I did verify in SES (target --> verify) or when I connect it on nRF Connect Programmer.

    4. When programming the device with hex file via nrfjprog --program ble_app_uart_pca10040_s132.hex --sectoranduicrerase, the read register is also different. It becomes as follow :

    It looks like there are errors in my setup, please advise what I did wrong, thank you.

    Regards,

    Reno

Children
  • Hi,

    The content of the registers is dependent on when you check them in the execution of the program and what compiler that is used to build the application. It doesn't really tell us what the error is.

    Build an unmodified example from the SDK in debug mode and flash it to your custom board. The only thing that you should modify is the custom board map that maps the pins correctly. A error message should then be outputted when the application hits an error. 

    Note, that your original problems statement was that it wasn't flashed properly to the board. But it seems that the application is indeed flashed properly, but that it's running into some run-time error. Exactly what error is what we're trying to figure out. 

    regards

    Jared 

Related