TinyCircuits

Serial.read baud-rate issues...

Serial.read baud-rate issues...
« on: August 27, 2018, 04:23:56 PM »
I've been using a TinyDuino setup successfully for quite a while now, with the Arduino Console set to 115200 baud.
I have had NO problems with OUTput spewing lots of data, with no garbled characters.  I recently decided to add code to accept a user (Console Serial) input ("serial number") to be written to EEPROM.  After wasting far too much time trying to figure out why i was reading back GARBAGE from the EEPROM after (supposedly) writing it, I backtracked to the simple loop using Serial.read(), where I built the user-supplied S/N string.   It was GARBAGE.  After lots of Google finger exercises, I found that some people apparently had (output-related) problems with higher baud-rates; but not much discussion of INput scenarios.  But I decided to try knocking my port speed down to 9600 just for giggles. VOILA!  It works with no problems. HA.
I'm writing this a) to inform others who might go down this path, and b) to pose the question: "is this a possible Hardware issue, or a Arduino/Library Software issue?"

Re: Serial.read baud-rate issues...
« Reply #1 on: September 06, 2018, 10:25:02 AM »
To answer your question, it's possible both hardware and software can cause garbage printing issues. The common software issue, as you saw, is the mismatch of baud rates between two communicating devices. The different rates of communication essentially become foreign languages as the data is receiving and transmitting independently and there is chaos, which gives us garbage.
A common hardware issue can occur when trying to communicate with more than two serial devices on one serial bus. When two devices communicate back and forth on one line, there is some order. When there are multiple devices communicating on one line, there is chaos, all devices could be speaking at once or none at all, again producing visual garbage on the Serial Monitor.

Re: Serial.read baud-rate issues...
« Reply #2 on: September 17, 2018, 07:01:25 PM »
Well, perhaps I wasn't clear when I said "knocking my port speed down to 9600...": I should have said "I changed both the port speed AND the baud-rate specified in the code" from 115200 to 9600.  There was No mismatch at any time.
As for conflicts, there are none.  Also, I'm not using a hub or intermediate USB connection; I suspect a hardware issue of some sort, but don't have time to worry about it at this point.  Still, would be nice to understand what's going on.