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.
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.
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
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
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.
Hope that, you download the code from gitlab https://gitlab.com/mcucodes/rapid-iot-k64f-wuart-hello-world
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.
Hi,
Tks for your job,
When building -> wuartreceived , lcdp , linecount are undeclared.
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
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.
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
Hi MM,
GATT services and Online IDE will not work but still you can play with UART & LCD display i guess.
Thanks,
Ashok r
Hello,
You can download the OOB demo out of the Rapid IoT studio page and flash it with the image again.
Regards,
Estephania