AnsweredAssumed Answered

UART problem using K70 with TWR-SER

Question asked by Juan Manuel Paniego on Sep 12, 2014
Latest reply on Sep 15, 2014 by Mark Butcher

Hi,

I'm trying to communicate the K70 board with a PC via UART. I initialize the UART1 module and connect a serial cable between TWR-SER's DB9 connector to my PC, and finally I want to see the message at Hyperterminal window.

At the beggining, I have a doubt wich UART Module is driven to de DB9 connector. I have been looking at the schematics and I think that the module 1 is the correct. I do not know that it is a code problem or I am making a mistake with jumpers connections.

Here I paste the main code that I'm using:

int main(void)
{
  register uint16_t ubd;
  uint8_t temp;

  SIM_SCGC4 |= SIM_SCGC4_UART1_MASK;
  SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;

  PORTC_PCR4 |= 0x300;
  PORTC_PCR3 |= 0x300;
  PORTC_PCR2 |= 0x500;
  PORTC_PCR1 |= 0x500;

  UART1_C2 &= ~(UART_C2_TE_MASK | UART_C2_RE_MASK);

  UART1_C1 = 0;

  //ubd = (uint16_t)135;// ((20971520)/9600*16);

  //temp = UART0_BDH & ~(UART_BDH_SBR(0x1F));

  UART1_BDH = UART_BDH_SBR(0x00);
  UART1_BDL = UART_BDL_SBR(0x88);

  UART1_C2 |= UART_C2_TE_MASK;

  while(!(UART1_S1 & UART_S1_TDRE_MASK));

  UART1_D = (uint8_t) 'a';

  return 0;
}

 

P.D: I'm using CodeWarrior 10.6 IDE

Outcomes