UART problem using K70 with TWR-SER

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

UART problem using K70 with TWR-SER

Jump to solution
1,339 Views
juanmanuelpanie
Contributor II

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

0 Kudos
1 Solution
759 Views
mjbcswitzerland
Specialist V

Juan

The UART on TWR-SER and TWR-K70F120 is UART 2 and the pins to use are PTE16 (TX) and PTE17(RX).

You can get out-of-the-box code for this tower kit (UARTs in interrupt or DMA mode, TCP/IP and USB stack as well as FAT on SD card etc.) as well as a simulator for the K70 tower kit at http://www.utasker.com/forum/index.php?topic=1721.0

A screen shot of the simulator in operation is shown below.

Regards

Mark

twr-k70F120.png

View solution in original post

0 Kudos
4 Replies
759 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Juan,

Is this issue solved? Please kindly let me know if the problem is still there.


Have a great day,
Kan

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

0 Kudos
759 Views
juanmanuelpanie
Contributor II

Hi Mark,

Thanks for the answer, I probed it today and it works. But I can not receive anything, I send well, but I tried to receive from the PC and nothing happend. I configured all register for enable the receiver, something that I should be missing with the code or with jumpers? Thanks

Regards

Juan Manuel

0 Kudos
759 Views
mjbcswitzerland
Specialist V

Juan

Which SW are you using?

At µTasker Test Software and Demos there is pre-built binary files for the K70 TWR kit which you can load. This will allow you to verify that the HW is Ok and all jumpers are correct.

The SW uses the UART so responds so you can see transmission at 115k Baud and verify that it responds to reception.

Regards

Mark

0 Kudos
760 Views
mjbcswitzerland
Specialist V

Juan

The UART on TWR-SER and TWR-K70F120 is UART 2 and the pins to use are PTE16 (TX) and PTE17(RX).

You can get out-of-the-box code for this tower kit (UARTs in interrupt or DMA mode, TCP/IP and USB stack as well as FAT on SD card etc.) as well as a simulator for the K70 tower kit at http://www.utasker.com/forum/index.php?topic=1721.0

A screen shot of the simulator in operation is shown below.

Regards

Mark

twr-k70F120.png

0 Kudos