AnsweredAssumed Answered

UART0 issue with TWR-K65F180 and TWR-SER2 boards

Question asked by Drugo Drughi on Dec 10, 2015
Latest reply on Dec 16, 2015 by Alice_Yang

Hello community, this is my first post here. Please, I am asking help because I’m having big issues with K65 UART

 

I am using TWR-K65F180M tower board and simply want to make K65 MCU communicate - over UART0->USB - with Tera Term PC-console (I want to visualize an initial string, enter a single character from the console and echo it back to the console itself). The issue I’m having is that I cannot communicate over UART0. In fact, I checked with the scope if the TWR-K65F180M board transmits and receives data over UART0, but I always see a constant 3.3V signal. No data is both transmitted and received! I can do it just over UART2 and openSDA USB port, but I cannot use this port for my final goal (which is to make this board communicate with another device over UART. In addition, I cannot use the RS-232 present in the TWR-SER2 board because, in this case, I should renounce in using openSDA USB port for debugging of TWR-K65F180M board).

 

I want to use “serial-to-USB” port of TWR-SER2 board (connected to TWR-K65F180M through the elevator board). Looking at the schematics, in order to use the serial-to-USB hardware converter, I have to use UART0 MCU port (connected over A41 and A42 primary elevator pins).

 

In order to init and communicate over UART0, I am using Kinetis SDK v.1.3 UART API functions. Following a chunk of code I’m using to initialize, trasmit and receive data over UART0:

 

 

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

#include <string.h>

#include <stdio.h>

#include "board.h"

#includefsl_uart_driver.h"

#include "fsl_clock_manager.h"

 

 

// variables declaration

uint8_t rx_char = 0;

uart_state_t uartState0;

uart_user_config_t uartConfig =

{

               .bitCountPerChar = kUart8BitsPerChar,

               .parityMode      = kUartParityDisabled,

               .stopBitCount    = kUartOneStopBit,

.baudRate        = 115200

};

const uint8_t buff_header_1[] = "\r\nK65-UART0 test\r\n ";

int8_t status = FAIL;

 

memset(&uartState0, 0, sizeof(uart_state_t));

 

// configure PTA1 (UART0_RX) and PTA2 (UART_TX) pins

PORT_HAL_SetMuxMode(PORTA,1u,kPortMuxAlt3);

PORT_HAL_SetMuxMode(PORTA,2u,kPortMuxAlt3);

 

// init UART0

UART_DRV_Init(UART0_IDX, uartState, &uartConfig);

 

// TX a string to the PC-console

UART_DRV_SendDataBlocking(UART0_IDX, buff_header_1, sizeof(buff_header_1), 1000u);

 

for(;;)

{

               if (kStatus_UART_Success == UART_DRV_ReceiveDataBlocking(UART0_IDX, rx_char, 1u, OSA_WAIT_FOREVER))

               {

            // SUCCESS: echo the character received back to the console

             UART_DRV_SendDataBlocking(UART0_IDX, rx_char, 1u, 1000u);

}

else

{

            // FAIL: do other things

}

}

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

 

 

I started developing with Freescale products just 2 months ago. But my feeling is that, the issue I’m having, is due to the firmware reported above. There is something wrong, but I cannot understand what.

 

Anyone can please provide me a help?

 

  Thanks so much!!!

Outcomes