KW45 OSA Task problem

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

KW45 OSA Task problem

312 Views
Liwa
Contributor I

Hello,

I'm working on on a KW45 based board, I have two tasks to be run on the same time :

The firts one is to emit BLE CW on a specific channel :  

 

void sFct_StartBleRadiationTask(void *argument)
{
    sFct_bleRadiationTask((uint32_t)argument);
}

static OSA_TASK_DEFINE(sFct_StartBleRadiationTask, 2U, 1, 1024, 0);

 

And the BLE INIT specific tasks are being created here : 

 

tenuStatusType

BLE_MGR_enuInit( BLE_MGR_tstr_InitParamsData *pstrBLEinitParams )

{

tenuStatusType fct_status = STD_SUCCESS ;

tpfTaskFunction pfTaskFct_MGR = (tpfTaskFunction)&BLE_MGR_vidTaskFct_MGR ;

tpfTaskFunction pfTaskFct_BLE = (tpfTaskFunction)&BLE_MGR_vidTaskFct_BLE ;



if ( pstrBLEinitParams == NULL )

{

fct_status = STD_FAILURE ;

}

if ( fct_status == STD_SUCCESS )

{

BLE_MGR_pfBleMgrEventHandler = pstrBLEinitParams->pfBleMgrEventHandler ;

// static tenuStatusType BLE_MGR_enuBleMgrEventHandler( uint32_t u32_EventId, void *pData ) ;

BLE_MGR__AL__vidRegisterCallback( BLE_MGR_enuBleMgrEventHandler ) ;

}

if ( fct_status == STD_SUCCESS )

{

// create task MGR

BLE_MGR_strTask_MGR.sTaskName = BLE_MGR_TASK_MGR_NAME ;

BLE_MGR_strTask_MGR.u32StackSize = BLE_MGR__TASK_MGR_STACK_SIZE ;

BLE_MGR_strTask_MGR.u8TaskPriority = 2U ;

BLE_MGR_strTask_MGR.u8StackBuffer = &(BLE_MGR_pu8TaskFctStackBuffer_MGR[0]) ;

fct_status = OSA_enuCreateTaskStatic( pfTaskFct_MGR, &BLE_MGR_strTask_MGR, NULL ) ;

if ( fct_status == STD_SUCCESS )

{

// create event set for task BLE_MGR_TASK_MGR :

BLE_MGR_EventSetHandle_MGR = OSA_strCreateEventStatic( &BLE_MGR_EventSetStruct_MGR ) ;

// create event set for task BLE_MGR_TASK_BLE :

BLE_MGR_EventSetHandle_BLE = OSA_strCreateEventStatic( &BLE_MGR_EventSetStruct_BLE ) ;



if ( ( BLE_MGR_EventSetHandle_MGR == NULL )

|| ( BLE_MGR_EventSetHandle_BLE == NULL ) )

{

fct_status = STD_FAILURE ;

}

}

}

if ( fct_status == STD_SUCCESS )

{

// create task BLE

BLE_MGR_strTask_BLE.sTaskName = BLE_MGR_TASK_BLE_NAME ;

BLE_MGR_strTask_BLE.u32StackSize = BLE_MGR__TASK_BLE_STACK_SIZE ;

BLE_MGR_strTask_BLE.u8TaskPriority = 2U ;

BLE_MGR_strTask_BLE.u8StackBuffer = &(BLE_MGR_pu8TaskFctStackBuffer_BLE[0]) ;

fct_status = OSA_enuCreateTaskStatic( pfTaskFct_BLE, &BLE_MGR_strTask_BLE, NULL ) ;

}

 

And here is where I create the BLE CW emission, and init and start the BLE so that I can start advertising after the CW emission is done : 

 

BLE_MGR_tstr_InitParamsData  strBLEinitParams ;

tenuStatusType JOB_WorkflowJobInit(void)
{
    tenuStatusType xReturn = STD_FAILURE;

    /* Create button task */
    xWorkflowTaskHandle.u32StackSize = WORKFLOW_DISPATCHER_TASK_STACK_SIZE;
    xWorkflowTaskHandle.u8TaskPriority = WORKFLOW_DISPATCHER_TASK_PRIORITY;
    xWorkflowTaskHandle.sTaskName = WORKFLOW_DISPATCHER_TASK_NAME;
    xWorkflowTaskHandle.u8StackBuffer = aWorkflowStackBuffer;
    xWorkflowTaskHandle.strTaskContext.strTaskBuffer = XWorkflowTaskCtx;
    xReturn = OSA_enuCreateTask((tpfTaskFunction)WorkflowJobOperation, &xWorkflowTaskHandle, NULL);

    KFB_MGR_InitializeBTNCallback(xWorkflowBtnWindowCallback);

	PLATFORM_InitGenfsk();
	OSA_TaskCreate((osa_task_handle_t)s_startRadiationTaskHandle, OSA_TASK(sFct_StartBleRadiationTask), NULL);

	strBLEinitParams.pfBleMgrEventHandler = KFB_MGR_enuBleMgrEventHandler ;
	// init BLE module
	BLE_MGR_enuInit( &strBLEinitParams ) ;
	/* init of BLE stack */
	BLE_MGR_enuStartBLE() ;

    return xReturn;
}

 

 The problem that I have is if Ido that the CW(continus wave emission) will not work but the ADV works just fine, and when I try to manipulate the tasks priority in BLE_MGR_enuInit() to make them less, the CW emission works fine but when I try to Advertise i get an assert error in Controller_SetTxPowerLevel : 

 

   /* Set New Lowpower Constraint on Advertising start request */
    ( void )PWR_SetLowPowerModeConstraint(PWR_WFI);

    (void)Controller_SetTxPowerLevel(ADV_POWER_DBM, channelId);

   /*LED ON*/
   GPIO_PinWrite(DIAG_LED_GPIO, DIAG_LED_PIN, DIAG_LED_ON);

   BluetoothLEHost_StartAdvertising(&RADIATION_strAdvertisingData, NULL, NULL);

 

Here is the stack of the error : 

Liwa_0-1707921594290.png

Help please !

Thank you in advanced.

0 Kudos
1 Reply

298 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hello @Liwa

Hope you are doing well.

Could you please provide more details about your development? What is the purpose of your application?

Since there are some memory and time constraints that need to be considered when developing BLE applications, I strongly recommend using any of the BLE example projects from the KW45 SDK as base for your application. This to avoid any memory or stack issue.

If you are trying to develop an application for certification and testing purpose, please refer to the KW45B41Z-EVK RF System Evaluation Report for Bluetooth Low Energy Applications. This Application Note describes the software, equipment and setup required for Transmission and Reception Tests, and Return loss.

Also, you can consult the BLE Application Developer's Guide (from KW45 SDK documentation folder > docs > wireless > Bluetooth): This document explains how to integrate the Bluetooth Low Energy Host Stack in an application and provides detailed explanations of the most commonly used APIs and code examples. This document also sets out the prerequisites and the initialization of the BLE Host Stack, followed by the presentation of APIs grouped by layers and by application role.

Regards,
Eduardo.

0 Kudos