Hi,
I want to write continuously to a serial device (LCD or LCD via 2 BT modules) from within the main loop.
Now consider the connection breaks for some reason, eg. distance too far for BT or LCD firmware too slow
What is the effect on the arduino, namely on the main loop?
Do al the writes get buffered and we experience an overrun/halt/crash or are the bytes in the queue discarded or what?
Reason for me asking is I want to write a continuous stream of telemetry data. Of course this requires a wireless connection. And so I am afraid of side effects on MultiWii in case of BT signal loss or disturbance.
anyone?
Hamburger
Q: does broken serial connection block the main loop?
Re: Q: does broken serial connection block the main loop?
if you only use tx/rx and gnd connections from your arduino (tx) to your bt module (rx), then there is no hardware flow control between the two and data would just be lost if the bt connection breaks. don't think the arduino will even realize this condition (for one way telemetry transfers).
Re: Q: does broken serial connection block the main loop?
noobee wrote: don't think the arduino will even realize this condition (for one way telemetry transfers).
I strongly agree.
The single wire that's used for transmitting data doesn't get any acknowledgement from the receiver. The Atmel would continue to send its data but nobody would receive anything.
What does cause the main loop to hang is if data is announced but not sent, i.e. if settings are to be updated but you don't actually send the complete block.
Re: Q: does broken serial connection block the main loop?
ok, thanks guys,
you got me. I will give it a try and modify the telemetry code to continuously transfer data. Will be interesting to see how it goes.
Hamburger
you got me. I will give it a try and modify the telemetry code to continuously transfer data. Will be interesting to see how it goes.
Hamburger
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: Q: does broken serial connection block the main loop?
In normal situations, there should't be any problem.
But I think there is an exception:
once a 'C' is received (and not a part of other frames) , the arduino will wait for other char
But I think there is an exception:
Code: Select all
case 'C': //GUI to arduino param
once a 'C' is received (and not a part of other frames) , the arduino will wait for other char
Code: Select all
while (Serial.available()<21) {}
Re: Q: does broken serial connection block the main loop?
I can now positively attest that a broken BT connection does not have any negative impact on the MultiWii main loop, if MultiWii is writing data (as is the case for sending telemetry data). That data is just lost. No further harm done.
thanks to all who encouraged me to try this.
Hamburger
thanks to all who encouraged me to try this.
Hamburger