I have one Thread which sends every second two chars (one integer and one blank) with chprintf
Code: Select all
while (TRUE) {
time += MS2ST(1000);
u++;
chprintf(stream_usb, "%d ", u);
palTogglePad(GPIOB, GPIOB_LED_BLUE);
chThdSleepUntil(time);
}
If I have running some program monitoring the ttyACM0 at the pc side, then the firmware runs nice.
If nobody is listening to the ttyACM0, then after some transmissions, the firmware stops at chprintf.
If after this, I monitor the serial port at the pc side. Then I read all the bytes sent by the micro at once,
Code: Select all
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
and one extra iteration occurs (the LED toggles), and it stops again.
Probably is related with some buffer which is full? Is this an expected behavior?
I have read this in the documentation about employing a streamer.
"The function writes data from a buffer to a channel. If the channel is not ready to accept data then the calling thread is suspended."
But after receiving the data at the PC side, it should keep sending right? and not hanging after one extra iteration.
Thanks in advance.