AnsweredAssumed Answered

printf exception in MQX 4.0 telnet2ser sample

Question asked by Qianming Zhu on May 27, 2014
Latest reply on May 29, 2014 by Qianming Zhu

Hi, everyone,

I am developing a TCP/IP application based on the sample telnet2ser. My problem is only about printf function.

At the main task function, my printf is used well. But when the program goes to "_mqx_int lw_telnet_server(void (_CODE_PTR_ user_fn)(void))" function and call "printf("hello");" as the first statement, the MQX is in ISR and has a endless loop in idle task, with nothing displayed in the console.

I have traced the printf and found that the only different between the error and correct is around as the following figure.

The problem is focused on "tmp = (char) c". This statement will change the file_ptr->SIZE or other element in struct file_ptr except file_ptr->DEV_PTR. And then when it goes into _io_serial_polled_write function in serl_pol.c, the fd_ptr struct always has wrong values but its address is the same as the correct procedure.

Please give me some help. I can't get out of here anymore. Please!

20140527172607.jpg

Outcomes