chprintf and finite timeout Topic is solved

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
tsichevski
Posts: 35
Joined: Fri Feb 09, 2018 12:44 am
Has thanked: 2 times
Been thanked: 5 times

chprintf and finite timeout  Topic is solved

Postby tsichevski » Mon Dec 10, 2018 2:21 pm

Hi,

is it possible to use finite timeouts with chprintf()? I use this function to emit data to a serial line, which may asynchronously disconnect in the middle of the call, in which case my task hangs forever :(

Regards,
Vladimir

User avatar
Giovanni
Site Admin
Posts: 13115
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 765 times
Been thanked: 647 times
Contact:

Re: chprintf and finite timeout

Postby Giovanni » Mon Dec 10, 2018 2:45 pm

Hi,

It is not currently possible, it would require changes because chprintf() prints on a stream (BaseSequentialStream) and streams don't have timeouts.

You could consider the normal printf() and provide your output function with timeout, this is compiler-dependent however. I will look into changes for chprintf() but this could take a while.

Moving this topic under "change requests".

BTW, you could reset the serial driver output queue, it would be released.

Giovanni

tsichevski
Posts: 35
Joined: Fri Feb 09, 2018 12:44 am
Has thanked: 2 times
Been thanked: 5 times

Re: chprintf and finite timeout

Postby tsichevski » Mon Dec 10, 2018 3:47 pm

Thank you, Giovanni.

Can I reset both the queues from an ordinary task, not from an interrupt?

User avatar
Giovanni
Site Admin
Posts: 13115
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 765 times
Been thanked: 647 times
Contact:

Re: chprintf and finite timeout

Postby Giovanni » Mon Dec 10, 2018 6:23 pm

Hi,

You can reset from task or interrupt.

Giovanni


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 5 guests