Page 1 of 1

"printf" BUG

PostPosted: Mon May 23, 2011 7:44 am
by bogdan
I think I found a serious bug in the "printf" function used for telemetry and LOG data transfer (at least in C30 v3.01 of the compiler):
Sending an int using %d descriptor takes a very long time. My workaround was to convert the integer to float (or double) and use %.0f descriptor. It's about 5 times faster (maybe more).
Can anyone confirm this in later versions of the compiler ?

Bogdan

Re: "printf" BUG

PostPosted: Mon May 23, 2011 1:45 pm
by Tom
Holy smokes!

I heared on the forum that version 3.23 (?) uses the Hi-Tech-C compiler libraries, which has a lot of impact on RAM usage (and speed).

How did you test this?

Re: "printf" BUG

PostPosted: Mon May 23, 2011 3:57 pm
by bogdan
I am sending 200kB of data from the external flash to the computer via the dsPIC. I send strings of 6 variables, 3 int and 3 float using printf. At one time I sent only floats and I observed it finished the data a lot faster.

Re: "printf" BUG

PostPosted: Mon May 23, 2011 4:05 pm
by Tom
Ok, since all telemetry data is sent using printf, this is something I should investigate

In the gluon code there is also a custom function to print an integer to uart1. I suppose it should be a lot faster than any printf-variant:
http://code.google.com/p/gluonpilot/sou ... _csv.c#768