AnsweredAssumed Answered

Wireless UART Demo with USB-KW41Z

Question asked by Kevin Luty on Feb 27, 2017
Latest reply on Mar 9, 2017 by Kevin Luty

I have the USB-KW41Z and I'm currently running the "wireless_uart" demo on the KW41Z.  I am running the "usb_device_cdc_vcom" demo found in NXP/MKW41Z_ConnSw_1.0.2/boards/usbkw41z_k22f/usb_examples.  I can connect to the KW41Z with the Kinetis BLE Toolbox app on my Android.  I can open up a terminal session on TeraTerm (115.2k baud) successfully.  I'm using IAR.


When I type data into the console/uart and send it, I hit breakpoints in the wireless_uart project, so I know the data is getting transferred to the KW41Z.  However, it seems to stop there.  Nothing gets sent to the terminal.  If I type into the terminal, nothing gets sent to the Kinetis BLE Toolbox Wirelress UART app either.  I'd say the "link" between the wireless_uart demo and the usb_device_vcom demo is "broken."  How do I fix it?


In wireless_uart demo, when I send data to the KW41Z via the smartphone app, it hits this method (located in app.c):


static void BleApp_ReceivedUartStream(uint8_t *pStream, uint16_t streamLength)
    uint8_t *pBuffer = NULL;

    /* Allocate buffer for asynchronous write */
    pBuffer = MEM_BufferAlloc(streamLength);

    if (pBuffer != NULL)
        Serial_AsyncWrite(gAppSerMgrIf, pStream, streamLength, Uart_TxCallBack, pBuffer);


It eventually calls Serial_AsyncWrite, which then steps into the method defined inSerialManager.c and look like it "successfully" completes since it returns gSerial_Success_c.  Uart_TxCallBack is called and in that method is a simple:


static void Uart_TxCallBack(void *pBuffer)

So my guess is I'm supposed to do something in Uart_TxCallBack to get it over to the PC terminal, something is wrong with Serial_AsyncWrite, or the configuration of the device/board in the project is not set up properly.  FYI, Serial_AsyncWrite does call Serial_WriteInternal which calls LPUART_SendData(pSer->serialChannel, pSer->txQueue[idx].pData, pSer->txQueue[idx].dataSize), and even after that, I see nothing in terminal.  


Any suggestions?


P.S. BLE pairing doesn't help.  UartStreamFlushTimerCallback is never executed, so does code exist in this example that is never used, and what is safe to remove?