Vic20 wrote:I don't understand why you use:
chprintf((BaseSequentialStream*)&SDU1, "%s", menu1); // ALB - does not work with this line
instead of:
chprintf((BaseSequentialStream*)&SDU1, menu1);
I don't think that "%s" is meant to be used on long strings.
Regards
Vicente
There should be no limit on the length of the argument to the "%s" format specifier.
Also, your suggestion is suboptimal for writing this fixed string, because if the fixed string contained, for instance, the text "Press X to display %done", it will interpret the %d as a format specifier and will format the nonexistent argument to chprintf(). You could of course escape the "%" in that string, but since he does not intend to treat the menu as a printf format string, but rather a literal text string, using chprintf(stream, "%s", menu1) is the correct thing to do.
I bet there is some kind of buffering issue in the SDU driver. The first chprintf() writes a small string, which is buffered by SDU driver, and then the second chprintf() tries to write a large string, but there may be a problem in the SDU driver where it doesn't correctly deal with this write. Maybe even a timing dependent issue.
@alb: what if you put a small delay of 1ms to 50ms between the first and second chprintf() calls? Does it fix the issue? That would confirm an SDU driver issue, I think.