WIFI and BLE at the same time
Antwort
23.01.19 04:33

Hi, I already try BLE data communication, it work fine. Then I try data communication via WIFI, it work fine too. Then now I come to a condition where I need to use both WIFI and BLE in active mode, after I try with condition of:

1. call WlanConnect_Init() >>>>only

2. init BLE, (include give name, start, and wake up)

3. at first the BLE found by other device,

4. after some delay, and I configure and get the WIFI connection, IP Address, etc., the BLE of XDK is undiscoverable, (consist of calling WLAN_Disable() and WLAN_Enable())

5. the communication through BLE is disconnected. (???????? why? is it not possible to run BLE and WIFI at the same time?)

Thankyou for your respon,

Best Regard,

Visit

 

0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
23.01.19 14:11 als Antwort auf Visit Silmi.
Dear Visit,

Using BLE and Wi-Fi at the same time should work since the modules are independent of each other.

Here it depends on how you implemented the functionality. Are you using the XDK_BLE.h and XDK_WLAN.h API to combine both modules in your application? Am I right so far?

If I am then this is issue might be caused by the reinitialization of the Wi-Fi module by calling the function WlanConnect_Init() at the beginning of your source code and then once more with the function WlanConnect_Init() .

However, if this is not the issue in your implementation, it would be very helpful if you could provide the outline of how you implemented the usage of both modules.

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
24.01.19 03:04 als Antwort auf Franjo Stjepandic.

Hi Mr. Franjo,

the Lib I use:

#include "XDK_WLAN.h"
#include "BCDS_WlanConnect.h"
#include "BCDS_NetworkConfig.h"

#include "BCDS_BlePeripheral.h"
#include "BCDS_BidirectionalService.h"

BLE code I use is from the project example in XDK knowledge base.

routine:

WlanConnect_Init();

BlePeripheral_Initialize(BleEventCallBack, CreateServiceCallback);

BlePeripheral_SetDeviceName(BLE_NAME);

BlePeripheral_Start();

BlePeripheral_Wakeup();

WifiSetup.IsEnterprise    = bufIsEnterprise;

WifiSetup.IsStatic    = bufIsStatic;

WifiSetup.SSID = bufSSID;

WifiSetup.Password = bufPassword;

.... etc

WLAN_Setup(&WifiSetup);

WLANPersonalWPA2Connect();

 

//----------------------------------------//

//inside WLANPersonalWPA2Connect() I comment the line of WlanConnect_Init();

//---------------------------------------//

 

1. from the routine above, re result is, successfully initiate BLE, BLE found by other device, then successfully connected to the internet and got IP, right after this, when I rescan for the XDK BLE, the BLE is gone, not discover by other device (mobile phone).

2. if I switch the code order, finish configure wifi and got connection for wifi, then configure the BLE, the BLE comunication is ok, I can use it to transfer data.

as the addition information, here is my appinfo configuration, is there any effect because of the stack size or the task prio:

#define TASK_PRIO_MAIN_CMD_PROCESSOR                (UINT32_C(3))
#define TASK_STACK_SIZE_MAIN_CMD_PROCESSOR          (UINT32_C(1600))
#define TASK_Q_LEN_MAIN_CMD_PROCESSOR               (UINT32_C(10))

#define TASK_PRIO_APP_CONTROLLER                    (UINT32_C(2))
#define TASK_STACK_SIZE_APP_CONTROLLER              (UINT32_C(1200))

 

0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
24.01.19 15:23 als Antwort auf Visit Silmi.
Hello Visit,

regarding your first point, this has a simple explanation. This is the normal application flow for BLE.
A typical application flow of an application based on the BLE module is summarized below:
 
  1. Initialization with event and service registration callbacks
  2. Set the necessary peripheral properties such as name and MAC address
  3. Start (the device will be in sleep mode initially in order to save power)
  4. Wakeup
  5. Use the services API of the registered services to Send & Receive data if connected
  6. Sleep in order to save power
  7. repeat steps 4.-6.
  8. Deinitialize
As you can see, after the initialization, the device will be in sleep mode. Without a wakeup, the device will obviously not be discoverable by a mobile phone.

Regarding the second point, I assume that the difference is in the interrupt between the initialization of BLE and the sending/receiving of a BLE message. You initialize the Wi-Fi module in between and in the meantime, BLE is returning into sleep mode since no messages are sent/received.

Since it is working, I recommend either to go further with the second option or to call the function BlePeripheral_Wakeup() once more after the Wi-Fi initialization.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
28.01.19 10:48 als Antwort auf Franjo Stjepandic.

Hallo Mr. Franjo,

Thankyou for the explanation. After I try your instruction, here are the result:

A. Trial one

1. After step 1 to 6, which make the BLE in sleep condition, then I activate the XDK wifi, the XDK wifi succesfully connected to the Internet.

2. After connected to the Internet, then the code suppose to call the wake up BLE, but there is no sign that the code enter BleEventCallBack() and give BLE_PERIPHERAL_WAKEUP_SUCCEEDED. In result, the BLE cannot be found by other network (failed to broadcast), I still can't communicate with XDK BLE after activating XDK Wifi

B. Trial two

1. I run step 1 to 6, BLE enter sleep mode, not activate XDK Wifi, just simple taskDelay 20 seconds,

2. the code succesfully enter BleEventCallBack() and give BLE_PERIPHERAL_WAKEUP_SUCCEEDED, so I can use the BLE communication again...

 

Here the problem still not solved, what should I check to make the code able to enter BleEventCallBack() after activating XDK Wifi?

0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
28.01.19 17:32 als Antwort auf Visit Silmi.
Hello Visit,

thank you for the update.
The addition of the vTaskDelay is a really smart idea.
I tested the setup with the SendAccelDataOverUdpAndBle example from the Workbench Version 3.5.0.

The following setup worked for me.
 
  1. WLAN_Setup();
  2. BLE_Setup();
  3. WLAN_Enable();
  4. BLE_Enable();
Regarding your question about entering BLEEventCallBack() , this function is called during the BLE_Setup() .
The trick here is, that after BLE_Setup() the module falls back into the sleepmode but BLE_Enable() at the end calls the wakeup. Therefore WiFi is already active and BLE is now ready to use.
Please tell me if this was helpful and is working for you, do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
29.01.19 09:49 als Antwort auf Franjo Stjepandic.

Hallo franjo, thank you for your replay...


(condition 1.) the case you mention indeed work fine, the example case you mention is: 1.WIFI Active >> 2. BLE Active >> 3. WIFI & BLE Active...

(condition 2.) but the routine I need to run is: 1. BLE Active >> 2. WIFI Active >>3. BLE & WIFI Active.

If I do the (condition 2.), the BLE failed to broadcast again. I need to run the code routine like this:

(from the "BCDS_BlePeripheral.h"):

 \endcode
 *
 * @note
 * 1. Minimum initial connection interval time is defined as 30mSec.(BleGap.h)
 * 2. The Latency for mode transition INITIALIZATION -> START is ~ 16mSec, for SLEEP -> WAKEUP ~ 2.7mSec.
 * 3. BlePeripheral_Start must be called only once after initialization. The calling thread must have lesser priority than the BLE peripheral thread.
 * The priority of BLE peripheral thread is defined using the macro BLE_TASK_PRIORITY
 * in package configuration header file (BCDS_BluetoothConfig.h).
 * 4. If de-initialized, then after initialization BLE start shall be called once again.
 * 5. After BlePeripheral_Start, the Alpwise stack will be initialized and the radio will be in sleep mode. The
 *    BLE_PERIPHERAL_STARTED event will be provided upon successful initialization through BlePeripheral_EventCallback.
 * 6. After successful BlePeripheral_Start, only BlePeripheral_Wakeup and BlePeripheral_Sleep may be called.
 * 7. After BlePeripheral_Wakeup, it takes ~50mSec for device to be discoverable.
 * 8. BLE device is no longer discoverable after entering to SLEEP and vice-versa for WAKEUP.
 * 9. Upon SLEEP trigger, if the BLE device was previously connected,
 *    it would disconnect (providing event) and then enter the SLEEP mode.
 * 10. Upon SLEEP and WAKEUP trigger we must wait atleast 1 ms before triggering
 *     the next power control successfully. It is expected to be synchronized with the
 *     corresponding events.
 * 11. All the SLEEP and WAKEUP trigger operation status will be updated through
 *     BLE_PERIPHERAL_SLEEP_SUCCEEDED and BLE_PERIPHERAL_WAKEUP_SUCCEEDED event notification via BLE event callback
 *     that would have been registered at the time of initialization.
 * 12. For all the SLEEP and WAKEUP triggers, application must wait / sync with the events before
 *     triggering further operations.
 *
 *
 *
 * @file
 */

so the code I made is like this (using the SendAccelDataOverUdpAndBle, inside App Fire, cause I need it like this):

1A. Test Code One to test above procedure:

    while(!BLE_IsConnected())
    {
        printf("wait BLE connected by master \r\n");
        vTaskDelay(2000);
    }

    if (BlePeripheral_Sleep() == RETCODE_OK)
    {
        //This Sleep command is to notify the BLE master that the communication need to be cut
        printf("success sleep BLE \r\n");
    }
    else printf("failed sleep BLE \r\n");

    vTaskDelay(2000);

    BlePeripheral_Deinitialize();
    vTaskDelay(1000);

    retcode = BLE_Setup(&BLESetupInfo);
    if (retcode == RETCODE_OK)
    {
        printf("success setup again BLE \r\n");

        retcode = BLE_Enable();
        if (retcode == RETCODE_OK)
        {
            printf("success enabled again BLE \r\n");
        }
        else printf("failed re-enable BLE \r\n");
    }
    else printf("failed re-setup BLE \r\n");

    while(1)
    {
        printf("my random string.... \r\n");
        vTaskDelay(2000);
    }

1B. Result of 1A:

 INFO | XDK DEVICE 3: BleEventCallBack : BLE powered ON successfully
 INFO | XDK DEVICE 3: BleEventCallBack : Device Wake up succeeded
 INFO | XDK DEVICE 3: wait BLE connected by master
 INFO | XDK DEVICE 3: wait BLE connected by master
 INFO | XDK DEVICE 3: BleEventCallBack : Device connected
 INFO | XDK DEVICE 3: success sleep BLE
 INFO | XDK DEVICE 3: BleEventCallBack : Device Disconnected
 INFO | XDK DEVICE 3: BleEventCallBack : BLE successfully entered into sleep mode
 INFO | XDK DEVICE 3: Pase 1
 INFO | XDK DEVICE 3: Pase 2
 INFO | XDK DEVICE 3: Pase 3
 INFO | XDK DEVICE 3: Pase 4     //this pase 4 is when call BlePeripheral_Initialize(BleEventCallBack, BleServiceRegistry); but the result is failed.
 INFO | XDK DEVICE 3: failed re-setup BLE
 INFO | XDK DEVICE 3: my random string....

2A. Test Code TWO:

    while(!BLE_IsConnected())
    {
        printf("wait BLE connected by master \r\n");
        vTaskDelay(2000);
    }

    vTaskDelay(5000); //this line will be replaced by other routine

    if (BlePeripheral_Sleep() == RETCODE_OK)
    {
        //This Sleep command is to notify the BLE master that the communication need to be cut
        printf("success sleep BLE \r\n");
    }
    else printf("failed sleep BLE \r\n");

//    WLAN_Setup(&WLANSetupInfo);
//    WLAN_Enable();

    vTaskDelay(5000);

    retcode = BLE_reActivate();
    if (retcode == RETCODE_OK)
    {
        printf("success enabled again BLE \r\n");
    }
    else printf("failed re-enable BLE \r\n");

    while(1)
    {
        //this line will be replaced by other routine, or the main loop
        printf("my random string.... \r\n");
        vTaskDelay(2000);
    }


2B. result of 2A:

 INFO | XDK DEVICE 3: phase 1
 INFO | XDK DEVICE 3: BleEventCallBack : BLE powered ON successfully
 INFO | XDK DEVICE 3: phase 2
 INFO | XDK DEVICE 3: phase 3
 INFO | XDK DEVICE 3: BleEventCallBack : Device Wake up succeeded
 INFO | XDK DEVICE 3: phase 4
 INFO | XDK DEVICE 3: phase 5
 INFO | XDK DEVICE 3: endline BLE enable
 INFO | XDK DEVICE 3: wait BLE connected by master
 INFO | XDK DEVICE 3: wait BLE connected by master
 INFO | XDK DEVICE 3: wait BLE connected by master
 INFO | XDK DEVICE 3: BleEventCallBack : Device connected
 INFO | XDK DEVICE 3: success sleep BLE
 INFO | XDK DEVICE 3: BleEventCallBack : Device Disconnected
 INFO | XDK DEVICE 3: BleEventCallBack : BLE successfully entered into sleep mode
 INFO | XDK DEVICE 3: phase 1
 INFO | XDK DEVICE 3: BleEventCallBack : Device Wake up succeeded
 INFO | XDK DEVICE 3: phase 2
 INFO | XDK DEVICE 3: phase 3
 INFO | XDK DEVICE 3: endline BLE re-Activate
 INFO | XDK DEVICE 3: success enabled again BLE
 INFO | XDK DEVICE 3: my random string....
 INFO | XDK DEVICE 3: my random string....

3A. Test Code THREE (expected type of code routine I want to use): similira with 2A. but uncomment the:

    WLAN_Setup(&WLANSetupInfo);
    WLAN_Enable();

3B. result of 3A:

 INFO | XDK DEVICE 3: phase 1
 INFO | XDK DEVICE 3: BleEventCallBack : BLE powered ON successfully
 INFO | XDK DEVICE 3: phase 2
 INFO | XDK DEVICE 3: phase 3
 INFO | XDK DEVICE 3: BleEventCallBack : Device Wake up succeeded
 INFO | XDK DEVICE 3: phase 4
 INFO | XDK DEVICE 3: phase 5
 INFO | XDK DEVICE 3: endline BLE enable
 INFO | XDK DEVICE 3: wait BLE connected by master
 INFO | XDK DEVICE 3: wait BLE connected by master
 INFO | XDK DEVICE 3: BleEventCallBack : Device connected
 INFO | XDK DEVICE 3: success sleep BLE
 INFO | XDK DEVICE 3: WLAN_Enable : Preparing for Personal WPA2 connection
 INFO | XDK DEVICE 3: This is a CC3100R device
 INFO | XDK DEVICE 3: CHIP 0x4000000
 INFO | XDK DEVICE 3: MAC 31.1.2.0.2
 INFO | XDK DEVICE 3: PHY 1.0.3.23
 INFO | XDK DEVICE 3: NWP 2.2.0.1
 INFO | XDK DEVICE 3: ROM 0x3333
 INFO | XDK DEVICE 3: HOST 1.0.1.6
 INFO | XDK DEVICE 3: WLANPersonalWPA2Connect : Connecting to MY_WIFI_NET
 INFO | XDK DEVICE 3:  Connected to WPA network successfully
 INFO | XDK DEVICE 3: IP address of device  192.168.77.172
 INFO | XDK DEVICE 3:               Mask    255.255.255.0
 INFO | XDK DEVICE 3:               Gateway 192.168.77.1
 INFO | XDK DEVICE 3:               DNS     192.168.77.1
 INFO | XDK DEVICE 3: WLANPersonalWPA2Connect : Connected to WPA network successfully.
 INFO | XDK DEVICE 3: phase 1
 INFO | XDK DEVICE 3: phase 2
 INFO | XDK DEVICE 3: phase 2a
 INFO | XDK DEVICE 3: endline BLE re-Activate
 INFO | XDK DEVICE 3: failed re-enable BLE
 INFO | XDK DEVICE 3: my random string....
 INFO | XDK DEVICE 3: my random string....

I mean like this Mr. Franjo, I need to run the code line like 3A, activate and deactivate WIFI inside AppControllerFire, with result of code where I can use both BLE and WIFI, as I mention in (condition 2.).

how to make it possible? could you please tell what should i fix from my code?

Thank you so much....

0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
29.01.19 15:12 als Antwort auf Visit Silmi.
Hello Visit,

Could you provide me with the full source code on a platform like Github?
Making an interpretation with the currently provided information is difficult, given that your application fails in later phases of the execution outside the code you provided, that also makes use of the function BLE_reActivate()
that is not native to the XDK and not in the code you provided.

Apart from that, I assume you are trying to send out Wi-Fi credentials over BLE and then trying to connect with the received Wi-Fi credentials? Otherwise, it might be helpful if you could go more into detail about your use case.

Kind regards,
Franjo
0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
30.01.19 10:11 als Antwort auf Franjo Stjepandic.

Hallo Mr. Franjo, here is the file in github : https://github.com/visitsilmi/WIFI_over_BLE

Thank you for always asisting us...

Best Regard,

Visit

0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
30.01.19 16:17 als Antwort auf Visit Silmi.
Hello Visit,

Unfortunately, I cannot make use of your upload as it is missing the mentioned BLE_reActivate() function, which I assume you edited directly in the BLE implementation in the SDK of the XDK. If you make use of a changed implementation in the SDK, I would require to have those changes as well for interpretation.

Kind regards,
Franjo
0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
31.01.19 02:54 als Antwort auf Franjo Stjepandic.

Hallo Mr. Franjo,

Oh no, I thought sending the folder project also include the SDK lib I edited...

the function of reActivate() is consift only of BLE wakeup command:

Retcode_T BLE_reActivate(void)
{
	//This function only consist of BLE wake up...........

	Retcode_T retcode = RETCODE_OK;

	vTaskDelay(pdMS_TO_TICKS(1000));
	printf("phase 1 \r\n");

	(void) xSemaphoreTake(BleEventSignal, pdMS_TO_TICKS(0));

	BleWakeUpStatus = false;
	retcode = BlePeripheral_Wakeup();
	if (RETCODE_OK == retcode)
	{
		printf("phase 2 \r\n");
		if (pdTRUE != xSemaphoreTake(BleEventSignal, pdMS_TO_TICKS(BLE_EVENT_SYNC_TIMEOUT)))
		{
			printf("phase 2a \r\n");
			retcode = RETCODE(RETCODE_SEVERITY_ERROR, RETCODE_BLE_WAKEUP_FAILED);
		}
		else if (false == BleWakeUpStatus)
		{
			printf("phase 2b \r\n");
			retcode = RETCODE(RETCODE_SEVERITY_ERROR, RETCODE_BLE_WAKEUP_FAILED);
		}
		else
		{
			printf("phase 3 \r\n");
			/* Do not disturb retcode */;
		}
	}
	else printf("Failed WakeUp again BLE \r\n");

	printf("endline BLE re-Activate \r\n");

	return retcode;
}

here I upload the file of BLE.c inside of Common/source/Connectivity/BLE/BLE.c

https://github.com/visitsilmi/WIFI_over_BLE

0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
31.01.19 15:34 als Antwort auf Visit Silmi.
Hello Visit,

could you please go more into detail about the use case you are trying to develop? Do you want to receive WiFi credentials through BLE and then establish a connection?

Furthermore, I took a look at your source code and I do not see any necessity to use the interfaces XDK_BLE.h and XDK_WLAN.h while you can use the underlying ones. Additionally, how to do you ensure sending the BLE chip into sleep mode worked? I do not see that there is a semaphore combination used, which might be necessary.

In that regard, I recommend going one API layer deeper and use the BCDS_Ble.h , BCDS_BlePeripheral.h and BCDS_BidirectionalService.h .

Furthermore, I recommend using a new project and test the setup with the mentioned APIs.

As a guideline, you can use the Advanced Implementation section of the BLE article here . Please note, that you have to register a free account beforehand to access the content of the XDK knowledgebase.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
31.01.19 16:27 als Antwort auf Franjo Stjepandic.

Hallo mr franjo,

I already make project using example code from knowledge base. The code I upload to the github I share to you is just a simple test project.

My goal is while the XDK is on, I want to give command through the BLE to make the XDK Wifi connect and disconnect to a specific LAN, that's why I need to activate and enable BLE 1st before the WIFI setup then in a loop of BLE task I hope i can do the WIFI enable and WIFI disconnect.

I already got the data from BLE, and successfully set the WIFI connection (only once), after 1 time the WIFI connected, the BLE is not broadcasting. have you tried the code i send you? to see the condition I told you?

0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
01.02.19 14:32 als Antwort auf Visit Silmi.
Dear Visit,

Thank you for providing further information. Unfortunately, I would need answers to the following questions too:

How to do you ensure that sending the BLE chip into sleep mode works? Does your use case require the exchange of Wi-Fi credentials or do you simply send a true/false command for connecting?

Furthermore, I analyzed your source code more detailed. As I observed, you only relied on the return code of the respective functions to send the BLE chip into sleep and wake up mode. These do not provide the actual success of the operation, but only that the function call was successful.

As such, you have to bind your further functionality on the events BLE_PERIPHERAL_WAKEUP_SUCCEEDED , BLE_PERIPHERAL_SLEEP_SUCCEEDED and BLE_PERIPHERAL_CONNECTED in the BLE event handler.

In regards to the processing time, it might be helpful to swap functions calls, such as WlanConnect_WPA() into secondary one time running timer tasks with configured processing times. This will ensure that the function calls have enough processing time to establish a connection without being suppressed during the connection attempt by the MCU.

Furthermore, I recommend implementing a semaphore for sending the BLE chip into sleep mode in the same manner as for the wake up too.

Then you should be able to use Wi-Fi and BLE at the same time, without one module being unusable at a time.

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
09.02.19 04:10 als Antwort auf Franjo Stjepandic.

Hallo Mr. Franjo,

thankyou for your support,

I already use the example using BLE_PERIPHERAL_WAKEUP_SUCCEEDED , BLE_PERIPHERAL_SLEEP_SUCCEEDED and BLE_PERIPHERAL_CONNECTED in the BLE event handler. Still not worked.

I also tried : implementing a semaphore for sending the BLE chip into sleep mode in the same manner as for the wake up too. Still failed.

ensure that sending the BLE chip into sleep mode works : if i only use the comman for BLE sleep then BLE wakeup, I succeded get the BLE_PERIPHERAL_WAKEUP_SUCCEEDED, but if I add the XDK command  WLAN_Enable() failed to get BLE_PERIPHERAL_WAKEUP_SUCCEEDED.

  1. Initialization with event and service registration callbacks
  2. Set the necessary peripheral properties such as name and MAC address
  3. Start (the device will be in sleep mode initially in order to save power)
  4. Wakeup
  5. Use the services API of the registered services to Send & Receive data if connected
  6. Sleep in order to save power (SUCCESS BLE_PERIPHERAL_SLEEP_SUCCEEDED)
  7. repeat steps 4.-6. (SUCCESS BLE_PERIPHERAL_WAKEUP_SUCCEEDED)
  8. Deinitialize

after i tried above instruction, the result is only work If the sequence like that, only sleep the ble than wake up the BLE without doing WIFI connect to the internet command.

  1. Initialization with event and service registration callbacks
  2. Set the necessary peripheral properties such as name and MAC address
  3. Start (the device will be in sleep mode initially in order to save power)
  4. Wakeup
  5. Use the services API of the registered services to Send & Receive data if connected
  6. Sleep in order to save power (SUCCESS BLE_PERIPHERAL_SLEEP_SUCCEEDED)
  7. Connect WIFI to Internet (SUCCESS Internet Connect)
  8. repeat steps 4.-6. (FAILED BLE_PERIPHERAL_WAKEUP_SUCCEEDED )
  9. Deinitialize

and after i tried above sequence, the process failed to get BLE_PERIPHERAL_WAKEUP_SUCCEEDED.

The following setup worked for me.
 
  1. WLAN_Setup(); //SUCCESS
  2. BLE_Setup(); //SUCCESS
  3. WLAN_Enable(); //SUCCESS
  4. BLE_Enable(); //SUCCESS

If i tried above sequence it's also worked. but

The following setup FAILED for me.
 
  1. BLE_Setup(); //SUCCESS
  2. WLAN_Setup(); //SUCCESS
  3. BLE_Enable(); //SUCCESS BLE FOUND
  4. WLAN_Enable(); //SUCCESS WLAN Connected internet, but from this point BLE NOT FOUND

and this note from BCDS_BlePeripheral.h did not worked for me.

 \endcode
 *
 * @note
 * 1. Minimum initial connection interval time is defined as 30mSec.(BleGap.h)
 * 2. The Latency for mode transition INITIALIZATION -> START is ~ 16mSec, for SLEEP -> WAKEUP ~ 2.7mSec.
 * 3. BlePeripheral_Start must be called only once after initialization. The calling thread must have lesser priority than the BLE peripheral thread.
 * etc.....
 * @file
 */

I cannot do the sequence as the note above, after step 4 de-initialized, but do step 6 to BlePeripheral_Start is failed.

 

Sorry for my poor explanation so that it's hard to catch what I meant with my question. So I'll try to simplified my question to this:

Is it possible to call WLAN_Enable() after BLE_Enable() ? how to do it?

 

*thank you for your recommendation of using BCDS_WlanConnect.h, I'll try it and update the result later...

Best Regard,

Visit

0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
04.02.19 04:57 als Antwort auf Visit Silmi.

Hallo again Mr. Franjo,

if doing sequence of BLE_Enable() then WLAN_Enable() is not possible, i'm planning to use BCDS_MCU_Flash.h, save some value as a parameter to indicate after a reboot of the XDK with the standard sequence (WLAN_Enable then BLE_Enable) whether it's needed to Enable WLAN or not, is it possible? In that case I want to know more about BCDS_MCU_Flash.h, is there any documentation I can read as a reference? like the maximum address for XDK110, the start address user can manipulate (is it 0x000AF000), or what is the size of MCU_Flash_ErasePage() (is it 1024 Byte)...

 

Once again thank you...
Best Regard,

Visit

 

We already Found it (FLASH MEMORY BCDS_MCU_Flash.h) in XDK Guide of FreeRTOS document, at section 4.1 page 23, Thankyou :D
0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
04.02.19 15:40 als Antwort auf Visit Silmi.
Dear Visit,

Instead of writing code inside BCDS_MCU_Flash.h have you considered using a simpler approach,
for example, incrementing a value on the SD card during startup?

Making an incrementation outside the data memory, which is reserved for FOTA and flashing would be adviseable since you may corrupt your XDK being unable to flash files.

You can however write into the reserved address space without an actual issue. Please note that is only possible for Bootloader versions about 1.1.0.

About implementing both WiFi and BLE they should, as I already stated, be independent of each other. The initialization order of the SendAccelDataOverUdpAndBle is in fact WLAN then BLE being enabled. Is the modified library you have on github up to date (last update 4 days ago) and do you still need feedback on that? Please note that it also might be the case, that you need to add a delay of 5 seconds, for example, before you call WLAN_Enable() .

Please let me know if this was helpful and feel free to ask if you have further questions.
Also keep me updated on the progress of your project.

Kind regards,
Franjo
0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
09.02.19 04:09 als Antwort auf Franjo Stjepandic.

Hallo Mr. Franjo,

after tring it again, even after I give 5  second vTaskDelay the problem still not solved. Then I look further into WLANPersonalWPA2Connect() to find why I cannot connect to BLE again after calling this function. The problem accure when it call NetworkConfig_SetIpStatic()  or NetworkConfig_SetIpDhcp(), after call this function, succeded connected to the internet and get IP set, the BLE communication is failed. But if I comment this NetworkConfig_SetIpStatic()  or NetworkConfig_SetIpDhcp() and let the wlan successfully connected to an internet, BLE communication is OK.

could you please give some advice to solve this?

*NB: I don't make any modification to the SDK library

0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
08.02.19 13:37 als Antwort auf Visit Silmi.
Dear Visit,

Since this issue is persisting for a while and hard to reproduce, I would ask you to provide me with your console output from said errors as well as update the repository. In order to replicate, I require the changes in the utilized libraries as well.

As I already stated the BLE and WLAN implementation should be independent, if that actually is not the case, I would also like to replicate that and assist you.

Also, you connect to WLAN with NetworkConfig_SetIpStatic() or NetworkConfig_SetIpDhcp() commented out, have you verified if this is actually functioning?

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 Stimmen)
RE: WIFI and BLE at the same time
Antwort
09.02.19 04:43 als Antwort auf Franjo Stjepandic.

Hallo mr. franjo,

May i ask your email address, to share the project file i have?
0 (0 Stimmen)