AnsweredAssumed Answered

¿Does the Shell use the LPUART of the R41Z?

Question asked by Cristina Alvarez on Jul 11, 2019
Latest reply on Jul 23, 2019 by Estephania Martinez

Hi community,

I'm using the example of the R41Z eval board "thread_router_eligible_device" on the eval board.

First of all the goal is to send a frame through the Serial Port of the slave when a button of the master is pressed. 

I'm trying to use the LPUART to send the String "Hello World" when a button is pressed through the Serial Port while the app of the eligible device is running. I write the code and it doesn't have any problems but it doesn't print on the Console "Hello World" as the example does.

 

I know how to use the Shell and that it comunicates via SerialManager (using the lpuart) with the PC to print stuff like temperature, IP of the devices, etc on the prompt. Do you know if, maybe, I cannot use the function "PRINTF("Hello World");" -which use the uart- to print on the Console because the uart is being used?

 

What would you try to send frames via Serial Port?

 

Thank you all for your help, regards

Cristina.

 

 

 

 

static void APP_AppModeHandleKeyboard ( uint32_t keyEvent )
{           
         switch(keyEvent)    
         {
         case gKBD_EventPB1_c:          
                 /* Data sink create */  
                         (void)NWKU_SendMsg(APP_SendDataSinkCreate, NULL, mpAppThreadMsgQueue);            
                 break;

#if gKBD_KeysCount_c > 1                     /* If button 4 is pressed (temp) */        
                  case gKBD_EventPB2_c:            
                  /* Report temperature */                              
                          (void)NWKU_SendMsg(APP_ReportTemp, NULL, mpAppThreadMsgQueue);

/////////////////////////////////////////////////            
                           HolaMundo()   
                          /* Pressing button4, send a string by serial port */

//////////////////////////////////////////////////            
                  break;       
                  case gKBD_EventPB3_c: 

....................................................           ----- (keeps going)


I've written all the includes needed
///////////////////////
#include "fsl_lpuart.h"

#include "GPIO_Adapter.h"
#include "gpio_pins.h"

#include "pin_mux.h"
#include "fsl_debug_console.h"
#include <stdio.h>
////////////////////////

I use the same function as in the hello world example

/************************************************************************************** *              

     HITO 2: Hello World (Serial Port - UART) 
**************************************************************************************/

void HolaMundo (void)
{
        BOARD_InitLPUART();
        BOARD_BootClockRUN();
        BOARD_InitDebugConsole();
 PRINTF("Hola Mundo.\r\n");
}


With all this done I don't get the "hello world" printed in the screen. 

I do initialize the correct ports:

void BOARD_InitLPUART void
{
       CLOCK_EnableClock(kCLOCK_PortC);

 

       PORT_SetPinMux(PORTC, PIN6_IDX, kPORT_MuxAlt4); 
       PORT_SetPinMux(PORTC, PIN7_IDX, kPORT_MuxAlt4);            
       SIM->SOPT5 = ((SIM->SOPT5 &    
       (~(SIM_SOPT5_LPUART0RXSRC_MASK)))
         | SIM_SOPT5_LPUART0RXSRC(SOPT5_LPUART0RXSRC_LPUART_RX)           );
}

I use the BootClockRUN as is given (no changes)
And finally the part which I don't know if it makes sense, I use the BOARD_InitDebugConsole given in the "hello world" example

/* Initialize debug console. */
void BOARD_InitDebugConsole ( void )
{   
        uint32_t uartClkSrcFreq;
        CLOCK_SetLpuartClock(2);

        uartClkSrcFreq = BOARD_DEBUG_UART_CLK_FREQ;


        DbgConsole_Init(BOARD_DEBUG_UART_BASEADDR, BOARD_DEBUG_UART_BAUDRATE, 
                                    BOARD_DEBUG_UART_TYPE,            uartClkSrcFreq);
}

Outcomes