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

DFU app update over BLE with non-BLE app.

HI,

I got nrfutil + BLE DFU app update working using the ble_app_hrs for the test.    I am using the nrf52DK + SES for development, and I have also an external nrf52832 + MPU9250 external board attached to it.  The DFU update work fine on both the nrf52DK and also on the external board.  So the process is not an issue.

When I want to do the same with my app, the DFU process doest not work.

My app is a 9-axis motion capture with fusion (Invensense) based on the following exemple:   nRF52832_pesky/peripheral/md612/    https://github.com/e27182/nRF52832_pesky/tree/master/peripheral/md612

Instead of BLE, the external IMU board is communicating with the central (nrf52DK) using Enhance Shockburst (ESB).  Everything work fine.

However, if  I tried to update the app over DFU, the app won't start.  

From what I  have read in several post, i believe that my app is not flash at the wright location, because its not a BLE app and it conflict with the DFU or softdevice section, please correct me if I am wrong.

Here is the linked placement macro in SES: 

FLASH_PH_START=0x0

FLASH_PH_SIZE=0x80000

RAM_PH_START=0x20000000

RAM_PH_SIZE=0x10000

FLASH_START=0x0

FLASH_SIZE=0x80000

RAM_START=0x20000000

RAM_SIZE=0x10000

I am not to shure if its the wright thing to do but I have tried to change the FLASH_START address  to 0x26000 as in ble_app_hrs exemple.  The app will compile but won't run when flash directly on my external nef52 board with SES and the nrf52DK.

I have a played also with the RAM_START adress but the app won't compile.

Help would be greatly appreciate.

  • I have tried the nrtutil settings generate command, since I did not had problem with the ble_app_hrs test, and was not shure of the purpose.  Should I lookout this ?

  • Hello,

    If you use a BLE bootloader, remember that the bootloader itself use the softdevice, so it is not deleted. If you look in the SDK\examples\peripheral\blinky\pca10040 folder, you see that there are three project files. One blank, one mbr and one for the softdevice. The differences are mostly linking and RAM placement, but if possible, I suggest you use a project file that already has the softdevice included. You don't need to actively use the softdevice in your application, but since the  bootloader requires it, you can't save space by deleting it either way.

    The other approach is to fiddle around with the project settings, so that it will run with a softdevice in the bottom of flash and ram. 

  • Hi,  I have fiddle around with my project changing FLASH and RAM address without success and decide finally to use blinky_S132 as a template and transpose my program in it.  

    It took several hours. I had to set the start addresses for RAM and FLASH according to those recommandation https://devzone.nordicsemi.com/f/nordic-q-a/33077/sdk15-nrfx-error-numbering

    I had also to reduce the heap size by half  to 4096.  I read in ticket that it could be set to 0 if I use the s132 softdevice. I have not tried.

    I am at the point now that my program compile without error, start te setup part but stop after a few line , where I am trying to init the twi driver  with the following routine:

    uint32_t nrf_drv_mpu_init(void)
    {
        uint32_t err_code;
        
        const nrfx_twi_config_t twi_mpu_config = {
           .scl                = MPU_TWI_SCL_PIN,
           .sda                = MPU_TWI_SDA_PIN,
           .frequency          = NRF_TWI_FREQ_400K,
         //  .interrupt_priority = APP_IRQ_PRIORITY_HIGHEST,
           //.clear_bus_init     = false
        };
        
        err_code = nrfx_twi_init(&m_twi_instance, &twi_mpu_config, nrfx_mpu_twi_event_handler, NULL);
        if(err_code != NRF_SUCCESS)
    	{
    		return err_code;
    	}
        
        nrfx_twi_enable(&m_twi_instance);
    	
    	return NRF_SUCCESS;
    }

    The error on the Segger RTT  terminal is : 

    00> <error> app: ASSERTION FAILED at ../../../../../../integration/nrfx/nrfx_glue.h:107

    Line 107 in nrfx_glue.h is :  ASSERT(INTERRUPT_PRIORITY_IS_VALID(priority));

     

    static inline void _NRFX_IRQ_PRIORITY_SET(IRQn_Type irq_number,
                                              uint8_t   priority)
    {
        ASSERT(INTERRUPT_PRIORITY_IS_VALID(priority));
        NVIC_SetPriority(irq_number, priority);
    }

    I am not sure what is the problem.   Is there a priority not define, a conflict, or something else.

    Thanks for helping. 

  • SL06 said:
    I am not sure what is the problem.   Is there a priority not define, a conflict, or something else.

    That sounds like a conflict, yes.

    I suspect this is already what you are doing, but you need your application to be able to run while having the softdevice, so for now you don't need to worry about the bootloader. 

     The INTERRUPT_PRIORITY_IS_VALID() define comes from nrfx_glue.h:

    #ifdef NRF51
    #ifdef SOFTDEVICE_PRESENT
    #define INTERRUPT_PRIORITY_IS_VALID(pri) (((pri) == 1) || ((pri) == 3))
    #else
    #define INTERRUPT_PRIORITY_IS_VALID(pri) ((pri) < 4)
    #endif //SOFTDEVICE_PRESENT
    #else
    #ifdef SOFTDEVICE_PRESENT
    #define INTERRUPT_PRIORITY_IS_VALID(pri) ((((pri) > 1) && ((pri) < 4)) || \
                                              (((pri) > 4) && ((pri) < 8)))
    #else
    #define INTERRUPT_PRIORITY_IS_VALID(pri) ((pri) < 8)
    #endif //SOFTDEVICE_PRESENT
    #endif //NRF52

    In your case, SOFTDEVICE_PRESENT should be true, and NRF51 should be false, hence, this line is what will be checked:

    #define INTERRUPT_PRIORITY_IS_VALID(pri) ((((pri) > 1) && ((pri) < 4)) || \
    (((pri) > 4) && ((pri) < 8)))
    So your priority needs to be either 2, 3, 5, 6, or 7 when you are working on an nRF52, and you are using the softdevice. The reason for this is that the interrupt priority levels 0, 1, and 4 is reserved by the softdevice:
    Not sure if the link you provided is the one you intended to provide, but when you start your application, the log should tell you if you should adjust your ram and flash settings.
    Best regards,
    Edvin
Related