AnsweredAssumed Answered

K60n512 serial in block mode,how to change it?MQX4.0

Question asked by jack erison on Apr 27, 2013
Latest reply on Apr 29, 2013 by jack erison

Description:I was using board K60n512.I want to use the serial port to read data,But I find it has some problems.when I use to read

data from serial port,it blocks at there,until it has recevied data from serial prot.when I  change the open_flages:fopen("ttyf:",(pointer)IO_SERIAL_RAW_IO | IO_SERIAL_NON_BLOCKING),but it seems doesn‘t blocks until it recevied some data.

I use the primitve libraries and configuration.and test the com ttya to ttyf

I find that ttya,ttyb,ttyc,ttye can achieve the NON_BLOCKING function by using the IO_SERIAL_NON_BLOCK mode,the  othesrs doesn't.

I find that the  "#define BSPCFG_ENABLE_TTYD  1"         and  "#define BSPCFG_ENABLE_TTYF    1" in the  user_config.h file.


FILE_PTR serial_f=fopen("ttyf:",(pointer)(IO_SERIAL_RAW_IO | IO_SERIAL_NON_BLOCKING));

fgetc(serial_fd);//if doesn't have data,it will block at here


I don't konw why,it puzzled me for a long time.