UART SDK Problem

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

UART SDK Problem

Jump to solution
954 Views
philhale
Contributor IV

KDS V3.0.0

KSDK V1.3.0

 

I am able to get the Debug Console UART routines to work just fine. However, when using the UART Peripheral Drivers (UART_DRV_*) to work, I am unable to get these routines to work properly. In the example below, I am getting only the first letter of the string buffStart to display in an infinite loop on the receiving RS232 port.  As you can see below, I have tried this blocking and non-blocking, to no avail.  I am using the GPIO LEDs as debugging features so please ignore these.  Any ideas what is happening here with the UART?

 

int main(void)

/*lint -restore Enable MISRA rule (6.3) checking. */

{

  /* Write your local variable definition here */

  uint8_t buffStart[]   = "++++++++++++++++ UART Send/Receive Non Blocking Example +++++++++++++++++\r\n";

  uint8_t bufferData1[] = "\r\nType characters from keyboard, the board will receive and then echo them to terminal screen\r\n";

  uint8_t byteCountBuff, txChar, rxChar;

 

  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/

  PE_low_level_init();

  /*** End of Processor Expert internal initialization.                    ***/

 

  /* Write your code here */

  GPIO_DRV_Init(gpio1_InpConfig0, gpio1_OutConfig0); // Initialize GPIO

  GPIO_DRV_WritePinOutput(LED_RED, ON); // Set LED to RED while program loads

 

  UART_DRV_Init(UART0_IDX, &uartCom0_State, &uartCom0_InitConfig0);

 

  // Inform to start non blocking example

  byteCountBuff = sizeof(buffStart);

  UART_DRV_SendDataBlocking(UART0_IDX, buffStart, byteCountBuff, 1);

  //UART_DRV_SendData(UART0_IDX, "Hello", 5);

 

  GPIO_DRV_WritePinOutput(LED_RED, OFF);

  GPIO_DRV_WritePinOutput(LED_GREEN, ON);

 

  // Wait until transmission is finished

  //while (kStatus_UART_TxBusy == UART_DRV_GetTransmitStatus(UART0_IDX, NULL)){}

 

  GPIO_DRV_WritePinOutput(LED_GREEN, OFF);

  GPIO_DRV_WritePinOutput(LED_BLUE, ON);

 

  // Inform user of what to do

  byteCountBuff = sizeof(bufferData1);

  UART_DRV_SendDataBlocking(UART0_IDX, bufferData1, byteCountBuff, 1);

 

  GPIO_DRV_WritePinOutput(LED_RED, ON);

 

  // Wait until transmission is finished

  //while (kStatus_UART_TxBusy == UART_DRV_GetTransmitStatus(UART0_IDX, NULL)){}

 

  GPIO_DRV_WritePinOutput(LED_GREEN, ON);

 

  for(;;)

  {

      // Call received API

       UART_DRV_ReceiveDataBlocking(UART0_IDX, &rxChar, 1u, 1);

 

 

       // Wait until we receive a character

       //while (kStatus_UART_RxBusy == UART_DRV_GetReceiveStatus(UART0_IDX, NULL)){}

 

 

       // Echo received character

       txChar = rxChar;

       UART_DRV_SendDataBlocking(UART0_IDX, &txChar, 1u, 1);

  };

Labels (1)
0 Kudos
1 Solution
424 Views
philhale
Contributor IV

I wasn't able to get the routines to work until I declared a RX buffer and modified the fsl_uart_driver.c routine as defined in the link below.

https://community.freescale.com/message/599730?et=watches.email.thread#599730

View solution in original post

0 Kudos
1 Reply
425 Views
philhale
Contributor IV

I wasn't able to get the routines to work until I declared a RX buffer and modified the fsl_uart_driver.c routine as defined in the link below.

https://community.freescale.com/message/599730?et=watches.email.thread#599730

0 Kudos