fgetc halting MQX

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

fgetc halting MQX

Jump to solution
921 Views
ARQuattr
Contributor IV

I'm having a strange problem where certain received characters are causing my program to halt.  The code has been working very nicely, but I started to receive conditions that caused this problem, which I believe I've narrowed down to the fgetc command.  The relevant snippets are below.  This receives all other characters OK, but when a 0x13 character is received execution stops at the fgetc line.  I don't see the significance of 0x13. I realize it has significance in relation to interrupt vectors on x86 based processors, but I can't imagine it's related to that.

 

The UART is connected to a peripheral that sends a variable data stream and I haven't tried to simulate all other input characters yet, but it has had no trouble with every other character the peripheral has sent, from 0x00 to 0xFF and many in between.  So far this (0x13) is the only character it seems to have a problem with.

 

Any thoughts?

 

Thank you,

Angelo

 

 

char c;
FILE_PTR fh_ptr = NULL;

fh_ptr = (pointer) fopen("ttyb:", (pointer) (IO_SERIAL_XON_XOFF));

do {   if (fstatus(fh_ptr)) {      c = fgetc(fh_ptr);      printf("%02X", c);   }
} while (...)

 

 

 

 

0 Kudos
1 Solution
449 Views
eGuy
Contributor IV

Hi Angelo,

 

You opened the port as XON/XOFF mode. 0x13 is XOFF.

 

If you open the port as IO_SERIAL_RAW_IO, the problem should go away.

 

Hope this helps.

 

Regards,

 

Jeff

View solution in original post

0 Kudos
3 Replies
450 Views
eGuy
Contributor IV

Hi Angelo,

 

You opened the port as XON/XOFF mode. 0x13 is XOFF.

 

If you open the port as IO_SERIAL_RAW_IO, the problem should go away.

 

Hope this helps.

 

Regards,

 

Jeff

0 Kudos
449 Views
ARQuattr
Contributor IV

Jeff,

  Wow, I should have caught that.  Thank you so much for solving that for me!

 

  By the way, I've seen IO_SERIAL_NON_BLOCKING used also, but I haven't seen much documentation on that (and a lot of other things really).  Do you know where I can find more detail on usage of this flag?

 

Regards,

Angelo

0 Kudos
449 Views
eGuy
Contributor IV

I normally read the source code to figure out ( or guess) the usage.

 

Regards,

 

Jeff

0 Kudos