Hi,
I'm working with the serial driver on a STM32F103.
I want to use sdGetTimeout(&SD1, OSAL_MS2I(200)) but the timeout didn't work/has no effect.
osalThreadSleep-functions work as expected.
Serial Driver Timeout has no effect
- wurstnase
- Posts: 121
- Joined: Tue Oct 17, 2017 2:24 pm
- Has thanked: 43 times
- Been thanked: 30 times
- Contact:
Re: Serial Driver Timeout has no effect
Sorry. Add a debug. For some reason the sdGet gets random data. Pretty strange, because I can't see anything on my serial sniffer.
Probably I'm missing something different.
Probably I'm missing something different.
\o/ Nico
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Serial Driver Timeout has no effect
To test the timeout call the function with no data in input, it must exit after the specified timeout.
Giovanni
Giovanni
- wurstnase
- Posts: 121
- Joined: Tue Oct 17, 2017 2:24 pm
- Has thanked: 43 times
- Been thanked: 30 times
- Contact:
Re: Serial Driver Timeout has no effect
The serial driver is buffered?
Guess I need to flush the buffer before starting in my case.
Guess I need to flush the buffer before starting in my case.
\o/ Nico
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Serial Driver Timeout has no effect
Correct or it would immediately return buffered data.
Giovanni
Giovanni
- wurstnase
- Posts: 121
- Joined: Tue Oct 17, 2017 2:24 pm
- Has thanked: 43 times
- Been thanked: 30 times
- Contact:
Re: Serial Driver Timeout has no effect
Is there a simple way to flush?
Currently I simply have a while loop until timeout. Probably there is a better way?
Currently I simply have a while loop until timeout. Probably there is a better way?
\o/ Nico
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
- wurstnase
- Posts: 121
- Joined: Tue Oct 17, 2017 2:24 pm
- Has thanked: 43 times
- Been thanked: 30 times
- Contact:
Re: Serial Driver Timeout has no effect
Probably it is a good idea to add a flush in the queue directly?
Something like:
Something like:
Code: Select all
#define iqFlushI(iqp) \
do { \
(iqp)->q_wrptr = (iqp)->q_rdptr; \
(iqp)->q_counter = 0; \
} while(0)
\o/ Nico
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Who is online
Users browsing this forum: No registered users and 14 guests