KW36 can switch Central / peripheral?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KW36 can switch Central / peripheral?

735 Views
danieltseng
Contributor V

Continuing the previous question,
KW36A OTA  
Now there is an idea:
    We want to integrate the two OTA updates as following
          A. BLE Demo Applications User Guide.pdf , ch 5.19.5 with IOT toolbox
          B. BLE Demo Applications User Guide.pdf , ch 5.19.4 with Test tool

Based on the original two OTAs update(A. B.), the architecture is modified as follows

pastedImage_1.png

Step 1:
    Master(pre-burn BL+AP1).
    AP1 and AP2 are packaged into one Image(AP1+AP2).
    Master (AP1) [ use the receive function in "bootloader_otap" ]  for receive Image from the OTA phone.
Step 2:
    OTA update from phone to external Flash via Master(AP1) with one package(AP1+AP2).

    The purpose is to transfer data to external flash for storage.
Step 3:
    After reset the Master, the Master(Bootloader) will update Master(AP1) from external flash to AP1.
Step 4:
    Master(AP1) reads external flash and send AP2 to 4 Slave via OTA.
Step 5:
    After Slave(Bootloader) receiving the Image(AP2) from the Master, Slave does the Image update by itself.

Question:
   1. Because Master(AP1) needs to be in a different role (peripheral or central),

       can Master(AP1) be switched from peripheral to central without reset chip?
   2. What function to switch between the two roles?

Labels (1)
  • KW

3 Replies

559 Views
danieltseng
Contributor V

Thank you for providing a good example explanation for my reference, thanks

559 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Daniel!

Please let me know if you need any more information.

Best regards,

Sebastian

0 Kudos

559 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Daniel, I hope you're doing well!

 

It is possible to change the Bluetooth role of a device without resetting it. Could you please take a look at the Wireless UART SDK example?

 

<…\SDK_2.2.2_FRDM-KW36 - MCUXpresso\boards\frdmkw36\wireless_examples\bluetooth\w_uart>

 

This example allow for the device to change roles by pressing a SW3 and then pressing SW2. This calls two different events in the BleApp_HandleKeys (located in the wireless_uart.c source file):

 

  • The gKBD_EventPressPB2_c event first checks which mode is the device currently operating in, and then sets the global mGapRole variable to the opposite role (i.e. if it's in Central, the variable will be set to Peripheral and vice-versa).
  • Then, the gKBD_EventPressPB1_c event calls the BleApp_Start function with the previously set GAP role, which in turn either calls the App_StartScanning or the BleApp_Advertise function, depending on the role set by the gapRole local variable.

 

Please let me know if you need any more information.

 

Best regards,

Sebastian