Reply
Highlighted
Posts: 51
Registered: ‎03-02-2017
Accepted Solution

NCP bgapi

Hello,

I would like to use DFU over uart with external mcu to update the firmware of a BGM121.

First of all, I flashed the BGM121 with wstk_bgapi example.
I tried to use gecko_cmd_system_reset(1) (correct answer, version = 3)
then gecko_cmd_dfu_flash_set_address(0) (result answer = 0x0181, wrong state)

I think it's because the NCP is not enable so I tried to flash NCP - Empty target example with Simplicity but Bgapi commands don't seem to work.

Can you help me please

Thank you

Posts: 2,249
Registered: ‎09-01-2015

Re: NCP bgapi

Have you already read through the UART DFU appnote?

https://www.silabs.com/documents/login/application-notes/an1053-uart-dfu.pdf

 

When testing with wstk_bgapi example, did you change the bootloader type to "uart" ? See Chapter 2 of the appnote linked above.

 

Posts: 51
Registered: ‎03-02-2017

Re: NCP bgapi

Thank for the documentation

Yes, the bootloader type is set to "uart" and wstk = "true"

Posts: 2,249
Registered: ‎09-01-2015

Re: NCP bgapi

What SDK version?

Posts: 51
Registered: ‎03-02-2017

Re: NCP bgapi

Not sure what are you're asking, the example wstk_bgapi is in the folder: SimplicityStudio/v4/developer/stacks/ble/v2.1.1.0/app/bluetooth_2.1/examples_bgscript/wstk_bgapi

Posts: 2,249
Registered: ‎09-01-2015

Re: NCP bgapi

OK, seems you are using SDK v2.1.1. 

 

The wstk_bgapi example in that SDK supports UART DFU, there is no need to change anything. Have you tried running the UART DFU host example that is located in: 

C:\SiliconLabs\SimplicityStudio\v4\developer\stacks\ble\v2.1.1.0\app\bluetooth_2.1\examples_ncp_host\uart_dfu

 

In your original question you wrote:

>>I think it's because the NCP is not enable so I tried to flash NCP - Empty target example

>> with Simplicity but Bgapi commands don't seem to work.

 

If NCP is not enabled then you are not able to use ANY BGAPI commands. If you are able to reboot the module with command system_reset(1) then NCP must be enabled.

 

The "NCP empty" example uses OTA bootloader by default. This is all described in the application note that I mentioned earlier.

 

Easiest way to get started is to use the wstk_bgapi example and the UART DFU host example that is found in the SDK.

 

Posts: 51
Registered: ‎03-02-2017

Re: NCP bgapi

Thank for your help.

I don't know what I'm supposed to do with uart_dfu example.

For the moment, I have got an external mcu (frdm-k66f) which is powering a BGM121.
I am able to send bgapi commands with this mcu and the BGM is flashed with wstk_bgapi example.

The bgm is not supposed to answer correctly to cmd_dfu_flash_set_address(0) ?

I noticed something else:

After sending the cmd_dfu_reset(1), some events are generated: 5 evt_endpoint_status and 1  evt_system_boot like if the BGM reboot in normal mode ...

Thank you again !

Posts: 51
Registered: ‎03-02-2017

Re: NCP bgapi

I put the gecko_cmd_dfu_flash_set_address(0) directly in the gecko_evt_dfu_boot and it seems to work !!!