UART test in KDS using Processor Expert

cancel
Showing results for 
Search instead for 
Did you mean: 

UART test in KDS using Processor Expert

Jump to solution
943 Views
santoshsingh
Contributor II

Hi,

     I have created a Processor Expert project in KDS. I want to transmit a string through UART3. I am using FRDM-K64F and a serial to USB (CP2101) converter. I have written the following code to do this task. My question is, why "UART_DRV_SendDataBlocking( )" function is transmitting single character only instead of the string?

In this case string is "123_\n" but it is transmitting only '1'.

 

/* ################################################################### **     Filename    : main.c **     Project     : PE_Test **     Processor   : MK64FN1M0VLQ12 **     Version     : Driver 01.01 **     Compiler    : GNU C Compiler **     Date/Time   : 2015-09-22, 09:22, # CodeGen: 0 **     Abstract    : **         Main module. **         This module contains user's application code. **     Settings    : **     Contents    : **         No public methods ** ** ###################################################################*/ /*! ** @file main.c ** @version 01.01 ** @brief **         Main module. **         This module contains user's application code. */          /*! **  @addtogroup main_module main module documentation **  @{ */          /* MODULE main */ /* Including needed modules to compile this module/procedure */   #include "Cpu.h" #include "Events.h" #include "clockMan1.h" #include "pin_mux.h" #include "osa1.h" #include "gpio1.h" #include "uartCom1.h" #if CPU_INIT_CONFIG   #include "Init_Config.h" #endif /* User includes (#include below this line is not maintained by Processor Expert) */  const uint8_t sourceBuff[] = "123_\n";  /*lint -save  -e970 Disable MISRA rule (6.3) checking. */ int main(void) /*lint -restore Enable MISRA rule (6.3) checking. */ {   /* Write your local variable definition here */      uint32_t byteCount = sizeof(sourceBuff);      /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/   PE_low_level_init();   /*** End of Processor Expert internal initialization.                    ***/    /* Write your code here */   /* For example: for(;;) { } */      UART_DRV_SendDataBlocking(3,sourceBuff,byteCount,1);    for(;;)   {      }   /*** Don't write any code pass this line, or it will be deleted during code generation. ***/   /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/   #ifdef PEX_RTOS_START     PEX_RTOS_START();                  /* Startup of the selected RTOS. Macro is defined by the RTOS component. */   #endif   /*** End of RTOS startup code.  ***/   /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/   for(;;){}   /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/ /* END main */ /*! ** @} */ /* ** ################################################################### ** **     This file was created by Processor Expert 10.5 [05.21] **     for the Freescale Kinetis series of microcontrollers. ** ** ################################################################### */
Labels (1)
0 Kudos
1 Solution
192 Views
santoshsingh
Contributor II

Hi,

     I think I got the answer to this.

Thank you all..!

View solution in original post

0 Kudos
3 Replies
193 Views
santoshsingh
Contributor II

Hi,

     I think I got the answer to this.

Thank you all..!

View solution in original post

0 Kudos
192 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi

in your code, timeout value for RTOS abstraction sync control defined as 1 which is too less. if changing  it to 1000 may solve the problem.

change

UART_DRV_SendDataBlocking(3,sourceBuff,byteCount,1);

to

UART_DRV_SendDataBlocking(3,sourceBuff,byteCount,1000u);

I just perform test, it works on my side. see attached video,

can this help you?


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

192 Views
santoshsingh
Contributor II

Hi Zhang,

               Thanks for the reply. I have already checked by changing it to 1000. Have you checked it in the example code or in a new code? Because the UART example project works fine. I'm struggling with a new project created by Processor Expert.

0 Kudos