Pages: [1]   Go Down
Author Topic: Bug in SoftwareSerial and inverse logic  (Read 1862 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When using the SoftwareSerial and inverse logic, there is a bug in the setTX method, the method does not take into account the inverse logic flag when setting default output on the tx pin.

The second line in setTX should be
Code:
digitalWrite(tx, _inverse_logic ? LOW : HIGH);
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 207
Posts: 12911
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Do you have a test case / a device that uses inverted logic?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I have two of these http://seetron.com/glo416.html, they use inverse logic.

When using one of them I had no trouble, but when using two of them together, I started getting weird data on the second screen I was using. So after a time of debugging and testing I found out that if the time from the instantiation of the SoftwareSerial and the first write was to long, the data was wrong on the display. The error was that the setTX is actually starting a start bit when using inverse logic, but not the rest of the trasmission.

When using two, both of them was instantiated at the same place, but before the first write to the second screen was done, the first screen was set up, and that took a little time.

So by doing the change i suggested, the setTX does not start a start bit when the SoftwareSerial is initilized.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 207
Posts: 12911
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Excellent.  You have identified a bug, you have a good test case, and you have a simple fix.

The next step is to open an issue.  Please go here... https://github.com/arduino/Arduino/issues/new ...and create a new issue report for this bug.  I suggest keeping the report brief and provide a reference to this thread.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Reported bug as https://github.com/arduino/Arduino/issues/1361
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 207
Posts: 12911
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Thank you.

By creating a "pull request" you greatly increase the chances of your bug fix getting into the official release.  Are you interested in doing that?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think I managed to do it...

https://github.com/arduino/Arduino/pull/1362
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 207
Posts: 12911
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Certainly looks like it to me.  Thank you.
Logged

Pages: [1]   Go Up
Jump to: