Adding RS485 to FRDM-K64F

FRDM-K64F is nice piece of development board. Unfortunately, it is “bonded” to MBED development platform, which is a nightmare! Adding RS485 “out of the box” to the FRDM-K64F in MBED is NoGo. But it is very easy.

Here is image from my scope sending single char via UART4 with enabled RTS as DE for RS485 in Half Duplex mode:


There is “bluetooth” connector J199 on the board. It is connected to UART4 pins PTC14 (UART4_Rx) and PTC15 (UART4_Tx). The signal UART_RTS is available on connector J6, pin 3:



Initialization for UAR4 is simple when using UART Periph Driver:

#include "fsl_uart_driver.h"   // UART periph driver
int main (void) {
    uint8_t txchar = 'A';
    // Initialize variable uartState of type uart_state_t
    uart_state_t uartState;
    // Uart config data
    uart_user_config_t uartConfig = {
        .bitCountPerChar = kUart8BitsPerChar,
        .parityMode      = kUartParityDisabled,
        .stopBitCount    = kUartOneStopBit,
        .baudRate        = 9600
  // Init UART4          
  UART_DRV_Init(UART4_IDX, &uartState, &uartConfig);
  // Config RTS
  PORTC_PCR12 |= PORT_PCR_MUX(3);   // PC13 ... Alt3 = UART4_RTS (RS485 DE)
  while(1) {
    UART4_D = txchar++;

One Comment

  1. Mare says:

    R and D are not correctly connected to Rx and Tx in schematic above. The connection must be: Tx->D and R<-Rx

Leave a Reply