Hi guys,
I think I may have found a bug in the FastSerial Library...
In trying to get the CLI test to perform a XBee test, I found that no data was being written to the telemetry port, after checking my APM_Config.h settings, my XBee setup and hooking up my osciloscope up to the telemetry transmit pin, I turned to the code to start debugging...
I found that in the XBee test routine the line that should transmit the data read
Serial3.printf_P(PSTR("0123456789:;<=>?@ABCDEFGHIJKLMNO\n"));
and although this line was clearly directing output to serial port 3, the data was in fact coming back on serial port 1, I also found that using Serial3.printf instead worked fine.
I therefore looked in the FastSerial Library source, where these two functions are declared on the base class and found that in the printf_P function, the code was passing stdout instead of a pointer the local _fd member variable to the stdio vfprintf_P function (while in the printf routine this code was correct)
So, in the prinf_P routine, I replaced the line
i = vfprintf_P(stdout, fmt, ap);
with
i = vfprintf_P(&_fd, fmt, ap);
and this seemed to solve all my problems.
Since stdout seems to default to serial port 1, this would not have caused a problem when using Serial.printf_P and therefore would also only have affected the APM with it's multiple ports.
Any thoughts or collaborations on my findings, my c++ is a bit rusty so wanna be sure I am on the right track.
Thanks
Chris
London

Permalink Reply by Chris Mulder on October 19, 2010 at 4:45pm
Permalink Reply by Chris Mulder on October 19, 2010 at 4:52pm
Permalink Reply by Chris Mulder on October 20, 2010 at 1:31am 
Permalink Reply by Chris Mulder on October 27, 2010 at 3:19pm
Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.203 members
54 members
88 members
24 members
720 members
© 2013 Created by Chris Anderson.
Powered by
