Wireless UART Demo with USB-KW41Z

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

Wireless UART Demo with USB-KW41Z

Jump to solution
2,938 Views
kevinlfw
Contributor III

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)
{
    MEM_BufferFree(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?

Thanks,

Kevin

Labels (2)
1 Solution
1,593 Views
jc_pacheco
NXP Employee
NXP Employee

Hello Kevin, 

The "usb_device_cdc_vcom" demo found in NXP/MKW41Z_ConnSw_1.0.2/boards/usbkw41z_k22f/usb_examples  is a simple demonstration program that uses the KSDK software. That enumerates the board as a COM port, which the users can open using terminal tools, such as TeraTerm. The demo echoes back any character it receives.
The purpose of this demo is to show how to build a device of USB CDC class and to provide a simple project for further
development.

For the BLE wireless_uart demo (...\usbkw41z_kw41z\wireless_examples\bluetooth\wireless_uart), you require to have the OpenSDA firmware on the K22 uC. Please follow steps provided in this post to flash your K22 with the correct OpenSDA firmware. Then follow steps on Chapter 5.15 Wireless UART at BLE Demo Applications User's Guide.pdf

-JC

View solution in original post

5 Replies
1,594 Views
jc_pacheco
NXP Employee
NXP Employee

Hello Kevin, 

The "usb_device_cdc_vcom" demo found in NXP/MKW41Z_ConnSw_1.0.2/boards/usbkw41z_k22f/usb_examples  is a simple demonstration program that uses the KSDK software. That enumerates the board as a COM port, which the users can open using terminal tools, such as TeraTerm. The demo echoes back any character it receives.
The purpose of this demo is to show how to build a device of USB CDC class and to provide a simple project for further
development.

For the BLE wireless_uart demo (...\usbkw41z_kw41z\wireless_examples\bluetooth\wireless_uart), you require to have the OpenSDA firmware on the K22 uC. Please follow steps provided in this post to flash your K22 with the correct OpenSDA firmware. Then follow steps on Chapter 5.15 Wireless UART at BLE Demo Applications User's Guide.pdf

-JC

1,593 Views
kevinlfw
Contributor III

Thanks jcpacheco‌, that worked.  Is the OpenSDA firmware source code publicly available?  I'd like to take the USB VCOM example and add in the UART functionality so that I can, 1. make it my own USB device and 2. remove the MSD functionality that the OpenSDA image has. If not, do I just have to use the USB VCOM example (w/ the K22) and make use of the UART drivers in the SDK?

0 Kudos
1,593 Views
jc_pacheco
NXP Employee
NXP Employee

Hello Kevin, 

The OpenSDA firmware source code is not public, so yes, you can use the other demo as base example, the K22 is basically serving as a "USB2SER" interface which you can replicate using the UART driver from the KSDK.

1,593 Views
kevinlfw
Contributor III

jcpacheco‌ I'm back.

So I put a demo UART program on the K22 that uses UART1, expecting that when I connect via BLE and send a message, I would see the UART1 interrupt get hit, meaning the KW41Z passed the data along to K22, however that is not the case.  Is there something I'm missing?  Via BLE, I do see my data on the KW41Z, so that isn't the problem.  

Any help is appreciated.

Kevin

0 Kudos
1,593 Views
kevinlfw
Contributor III

Thank you Juan!

0 Kudos