-
Notifications
You must be signed in to change notification settings - Fork 39
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
uart write behavior #9
Comments
I don't believe there is any direct knowledge of the UART buffer, although as far as I know it's fairly expedient. What level of latency are you expecting? |
Hello @Fleker Thanks for your response, I am trying to work with RS-485 using two wires, I have to disable the driver as soon as the last bit is transferred, this was not working when I call UART.write followed by the GPIO toggle instruction. Would you suggest me a workaround? |
Do you have to disable it at the exact time of the last bit? Can you get away with a 10ms timeout? One workaround could be to add a UART line back to your device on the Rx pin so that you can see exactly when the data is sent out of the bus. |
Well, the closer the better,. The problem is that 10ms might be too much for high baud rate. Actually a normal baud rate of 19200 means several bits in a 10ms, so at the end it will depend on how fast the other peer can react and send data. If I do not disable the driver before the other peer start sending the response, the channel will get corrupted and data loss. I think the workaround can be really messy, because I have to somehow code an "UART idle detector", it might involve timers, etc ... |
Can the receiving peripheral send an ACK byte back to your device when it receives the last part of the response? |
That would be part of the communication protocol. |
Hi @Fleker , Would it be possible to have an upcoming release of AT that makes a UART.write blocking? Please let me know your thoughts, |
You can file a feature request for the framework using the issue tracker. Is it possible to use four wire RS-485? I'm going to ask some folks and get their insight. |
Four wires would be good since it's like full duplex, the problem is that most industrial RS-485, specially modbus devices are wired in the field using two wire scheme. Basically if you have a 4 wire device and you want to connect to a 2 wire network you just join A-Y and B-Z terminals. |
Hi,
I want to know if it's possible to know when the uart has transmitted the data out of the interface.
My experience is that uart write method buffers the data, but I need to know the exact moment that there are no more bytes to send so I can toggle a GPIO. One way is to make write method blocking, which I understand is not possible.
I was trying to see if the native API offer additional control over this so I can write my low level app in C++ but it seems there is no additional uart core support different than AT API.
Will appreciate your comments,
The text was updated successfully, but these errors were encountered: