Rapid IoT Kit - Wireless Uart Demo

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

Rapid IoT Kit - Wireless Uart Demo

3,841 Views
ashokfair
Contributor IV

Hi Everyone,

Here we going to see the demo of "Wireless Uart" Demo on Rapid IoT kit. we know that Rapid IoT has build with two MCU , KW41z & K64F. For this demo you should have SDK for KW41z,I have used  SDK_2.2.0_FRDM-KW41Z.

IMG-6812.JPG

Tools Required:

MCUXpressoIDE -> Download it from here

SDK for Rapid-IoT-Kit -> Download it from here

SDK for KW41z -> Download it from here

Rapid IoT Kit

Android or IOS App - IoT Toolbox here

Steps to follow:

The first step to Import "wireless uart" project from KW41z SDK examples.

pastedImage_4.png

the next step, you have to disable the keyboard functionality (keyboard.h)

/*
 * Name: gKeyBoardSupported_d
 * Description: Enables/disables the switches based keyboard
 */
#ifndef gKeyBoardSupported_d
#define gKeyBoardSupported_d                0
#endif

Rapid IoT kit hardware does not have 4 LED's interface with KW41 so some changes are required as below

also remove usage of Led3 & Led4 usages from everywhere.

/*
* Name: gLEDsOnTargetBoardDefault_c
* Description: Default value for LEDs count located on a
*              generic target board
*/
#ifndef gLEDsOnTargetBoardDefault_c
#define gLEDsOnTargetBoardDefault_c     2
#endif

Next step we need to add below code, so that K41z will start the advertising automatically after power on.

        /* BLE Host Stack Init */
        if (Ble_Initialize(App_GenericCallback) != gBleSuccess_c)
        {
            panic(0,0,0,0);
            return;
        }

        LED_StopFlashingAllLeds();
        Led1Flashing();

        BleApp_Start(gGapPeripheral_c);

Now we can compile the code and flash it in Rapid IoT Kit.

The next part is Import the "Hello World" example from Rapid IoT Kit SDK

pastedImage_8.png

next step change the baud-rate for FSCI Interface (UART 4)

/* FSCI Interface Configuration structure */
static const gFsciSerialConfig_t mFsciSerials[] =

{
    {
        .baudrate = gUARTBaudRate115200_c,
        .interfaceType = gSerialMgrUart_c,
        .interfaceChannel = 4,
        .virtualInterface = 0

    },

below changes for  FsciCommunication.c

void FSCI_receivePacket( void* param )
{
    uint16_t            readBytes;
    uint8_t             c;
    static uint8_t bytesReceived=0;
    if( gSerial_Success_c != Serial_GetByteFromRxBuffer( gFsciSerialInterfaces[(uint32_t)param], &c, &readBytes ) )
    {
        return;
    }
    while( readBytes && !wuartreceived)
    {
        if(c == '\r'){
            bytesReceived = 0;
            wuartreceived = 1;
        }
        else
        {
            lcdtext[bytesReceived++] =c;
        }  /* if (!startOfFrameSeen) */

        if ( gSerial_Success_c != Serial_GetByteFromRxBuffer( gFsciSerialInterfaces[(uint32_t)param], &c, &readBytes ) )
        {
            break;
        }
    }
}

below changes in hello_world.c

    /* Main Application Loop (idle state) */
    while (1)
    {

        if(wuartreceived){

            shell_write("\n");
            shell_write(lcdp);

            if(linecount>8)
            {
                GUI_Clear();
                GUI_DispString("\n");
                linecount=0;
            }
            GUI_DispString(" ");
            GUI_DispString(lcdp);
            wuartreceived = 0;
            linecount++;
            Clear_Buffer();

        }

You can also download this code from here https://gitlab.com/mcucodes/rapid-iot-k64f-wuart-hello-world

Compile the code then flash it into Rapid Kit, and  the demo is ready!

Happy Coding!

Working demo of video is here Rapid IoT Kit - Wireless Uart Demo

Checkout latest demo of thread use-case (IoT) here IoT Green Kit

Labels (1)
Tags (4)
9 Replies

2,830 Views
jplathuile
Contributor III

Hi,

I can build the project, but, my rapid iot does not accept the KW41 .bin, led stay green, I think that this .bin is built for being loaded directly, on rapidiot it is loaded via K64.

0 Kudos

2,830 Views
ashokfair
Contributor IV

Hope that, you download the code from gitlab https://gitlab.com/mcucodes/rapid-iot-k64f-wuart-hello-world

0 Kudos

2,830 Views
jplathuile
Contributor III

Yes,

Need to add in hello_world.c

char lcdtext[32];

char *lcdp = lcdtext;
char linecount= 9;
int wuartreceived = 0;

and all doing well,

thank you for that code.

0 Kudos

2,830 Views
jplathuile
Contributor III

Hi,

Tks for your job,

When building ->   wuartreceived , lcdp , linecount   are undeclared.

0 Kudos

2,830 Views
thomas_mercier
Contributor I

Hi,

I don't know if it's caused by a new version of the SDK, but I can't compile and flash the KW41Z.

I get "section .dummy VMA overlaps section .bss" when I tried the example. 

Does someone has the same error ?? Maybe my project settings aren't right too.

Thanks,

Thomas

2,830 Views
marcomerlin
NXP Employee
NXP Employee

Try to put the SDK in a folder that has not too many nested structure.

For instance

C:\nxp\sdk\

I had the same issue in the first place, and this solved it.

0 Kudos

2,830 Views
marcomerlin
NXP Employee
NXP Employee

Thank you very much for this demo!

Before trying it I want to be sure I can revert to the original firmware: can you suggest how to do that?

Also, will the GATT services programmed by the Rapid IoT online IDE still work, once this modification on the KW41 code is applied ?

Thank you for the support!

MM

0 Kudos

2,830 Views
ashokfair
Contributor IV

Hi MM,

GATT  services and Online IDE will not work but still you can play with UART & LCD display i guess.

Thanks,

Ashok r

2,830 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

You can download the OOB demo out of the Rapid IoT studio page and flash it with the image again. 

Regards, 

Estephania 

0 Kudos