hi, dear nxp engineer
i am learning the KW36 freedom board. i have debug and runned the demo: wireless uart .using the kinetis toolbox.
the app can receive the data send from the uart assisstant connect to KW36 using the USB cable attached with the board.
i also runned the hci bb and learned about that using uart assisstant send hci command. like 01 03 18 00.the uart assisstant will receive the data from the board.
now i use wirelss_uart as the base project. and want to combine the function hci_bb poccess. when i made a contrast with the 2 project i found.
1> hci bb demo had enable the macro: #define gUseHciTransportUpward_d 1 in app_preinclude.h.
2> the hci_tansport has the same source code in file hcit_serial_interface.c
so a add the macro "gUseHciTransportUpward_d" in NXP_WU demo. and meant to implement like this :
when i send data in PC uart com: "0a 02 03" i want the send "02 03" to the phone connected over air.
when i send data in PC uart com: "0b 01 03 18 00" the 01 03 18 00 will be send to hci controller use the API Hci_SendPacketToController(..)
the detail code script like below in bold.
static void BleApp_FlushUartStream(void *pParam)
{
//.......................................................//ignore.
if (pMsg != NULL)
{
/* Collect the data from the serial manager buffer */
if ( Serial_Read( gAppSerMgrIf, pMsg, mAppUartBufferSize, &bytesRead) == gSerial_Success_c )
{
//if (bytesRead != 0)
if(bytesRead != 0 )
{
/* Send data over the air */
if( pMsg[0] == 0x0a) //add by yx.
{
BleApp_SendUartStream(pMsg, bytesRead);
}
else if(pMsg[0] == 0x0b)
{
//BleApp_SendUartStream(pMsg, bytesRead);
//uint8_t packet[20] = {0x00};
//FLib_MemCpy(packet, &pMsg[1], bytesRead-1);
//Hci_SendPacketToController(0x01,packet,3);
uint8_t packet[3] = {0x03,0x18,0x00};
Hci_SendPacketToController(0x01,packet,3);
}
}
}
/* Free Buffer */
MEM_BufferFree(pMsg);
}
}
i found the initialize in code in BleApp_init()
//SerialManager_Init();
/* Register Serial Manager interface */
Serial_InitInterface(&gAppSerMgrIf, APP_SERIAL_INTERFACE_TYPE, APP_SERIAL_INTERFACE_INSTANCE);
Serial_SetBaudRate(gAppSerMgrIf, gUARTBaudRate115200_c);
/* Install Controller Events Callback handler */
Serial_SetRxCallBack(gAppSerMgrIf, Uart_RxCallBack, NULL);
i aslo found the hcit_init() has mapped the same uart.
/* Configure HCI Transport */
hcitConfigStruct_t hcitConfigStruct =
{
.interfaceType = gHcitInterfaceType_d,
.interfaceChannel = gHcitInterfaceNumber_d,
.interfaceBaudrate = gHcitInterfaceSpeed_d,
.transportInterface = (hciTransportInterface_t)Hci_SendPacketToController
};
return Hcit_Init(&hcitConfigStruct);
both mapped to APP_SERIAL_INTERFACE_TYPE APP_SERIAL_INTERFACE_INSTANCE
when i disable serial init in BleApp_init() then the Hci_SendPacketToController(..) can send and receive controller event response.
so how can i keep the uart function to receive data from pc uart assistant meanwhile can send data to controller use api like .Hci_SendPacketToController(..).