Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serial readUntil locks if delimiter is not found and rx is full #80

Open
pelikhan opened this issue Jan 1, 2019 · 11 comments
Open

Serial readUntil locks if delimiter is not found and rx is full #80

pelikhan opened this issue Jan 1, 2019 · 11 comments
Assignees
Labels

Comments

@pelikhan
Copy link
Contributor

pelikhan commented Jan 1, 2019

Event(this->id, CODAL_SERIAL_EVT_RX_FULL);

If a fiber is waiting of readUntil and the RX is full, it never receives triggers and the serial is effectively locked.

@pelikhan
Copy link
Contributor Author

pelikhan commented Jan 1, 2019

@finneyj @jamesadevine not sure how to handle this case. What happens when RX gets full and a fiber is waiting on some delimiters?

@jamesadevine
Copy link
Contributor

I think this is for the user to decide, I.e. wait forever or timeout

waitUntil(delimiters, timeout);

Default of 0?

@pelikhan
Copy link
Contributor Author

pelikhan commented Jan 1, 2019 via email

@jamesadevine
Copy link
Contributor

jamesadevine commented Jan 1, 2019 via email

@pelikhan
Copy link
Contributor Author

pelikhan commented Jan 8, 2019

Since MakeCode moved to UF8 support, I ended not using this implementation in MakeCode at all.

@jamesadevine
Copy link
Contributor

How does that work with serial now then?

@pelikhan
Copy link
Contributor Author

pelikhan commented Jan 8, 2019

Just doing the same logic on the TS side.

https://github.com/Microsoft/pxt-common-packages/blob/master/libs/serial/serial.ts#L53

@jamesadevine
Copy link
Contributor

Same problem exists if you do a blocking read on read(), right? i.e. you will wait for a character forever...

@jamesadevine
Copy link
Contributor

If you're going to implement this in ts, pass ASYNC and sleep in the loop.

@pelikhan
Copy link
Contributor Author

pelikhan commented Jan 9, 2019

ok will do. I am trying the new serial on SAMD21, which board did you test it on?

@jamesadevine
Copy link
Contributor

Currently 0 boards, my SAMD's are at the office. It should work fine, I was going to test on CPX on A2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants