I'm trying to get some charaters from PC using UART but I couldn't. instead I just can see same repeated strings on the serial terminal that I sent out just before. I have tried all the ways that I can but I couldn't find out any solutions.
Tx and opening ttyb: is working fine because I can see the strings "ttyb opend" from write(serial_fd,"ttyb opend", 10);
using MQX 3.8.1, Kinetis K10 CPU on 96Mhz core clock.
Please help.
settings and code are as below.
in user_config.h
#define BSPCFG_ENABLE_TTYB 1
in main.c
if((serial_fd = fopen("ttyb:",(pointer) ( IO_SERIAL_TRANSLATION)))==NULL){
printf("ttyb open failed!\n");
}else{
write(serial_fd,"ttyb opend", 10);
}
while(1)
{
_time_delay(100);
if (fstatus( serial_fd )) {
tmp = fgetc(serial_fd);
fputc((char)tmp,serial_fd);
}
}
terminal output
petttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opetttyb opettty
thanks