Pages: 1 ... 3 4 [5] 6 7 ... 11   Go Down
Author Topic: NewSoftSerial Library: An AFSoftSerial update  (Read 16782 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Mikal,

would it be hard to change NSS library work with inverted serial signals?

Logged

Austin, TX USA
Offline Offline
God Member
*****
Karma: 4
Posts: 997
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi arnewbie,

I don't have time to do it, but I wouldn't imagine that it would be too hard.  Make sure you have an external pull-DOWN resistor for the RX line, and then simply invert all the digitalRead and digitalWrite calls.  Leave out the digitalWrite call that triggers the internal pull-up resistor for RX.  I would think that would probably do it.

Mikal
Logged

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

Hello,

Does interrupt function get called for both HIGH and LOW or would I need to change the way interrupts are triggerred?
My Garmin GPS module has inverted TTL levels and I used modified simple serial to get the data, but I like your code much better and I plan to use it with TinyGPS.
Logged

Austin, TX USA
Offline Offline
God Member
*****
Karma: 4
Posts: 997
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Does interrupt function get called for both HIGH and LOW?

Yes.  The "PC" in PCINT0_vect stands for "Pin Change".  Note that almost the very first thing that happens in recv() is that a test is done to exclude an interrupt generated on a pin changing to the "wrong" state.

Mikal
Logged

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

How is it that the Windows version of the compiler doesn't have the register problem? I thought they were both on the same version and based on the same code, no?
Logged

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

Thanks Mikal,
I changed all the HIGH to LOW and LOW to HIGH as you suggested and inverted a couple IFs and it works with TinyGPS like a dream.

The only problem is it seems to interfere with mem's ServoTimer2. I can practically see when GPS sentences are being send in the way servo moves smiley. ServoDecode uses pin 8 to read PPM from receiver. With ServoTimer2 i used pins 234 and 7. GPS through NewSoftwareSerial is connected to pins 5 and 6 at 4800 bods. Is this due to limitation on arduino processing power or is there something can be done with maybe assigning different interrupt handlers to servos and GSP serial? I guess using built in UART on pins 0 and 1 for GPS is going to be my last resort... smiley
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That combination is asking the Arduino to do an awful lot of time critical stuff in interrupt handlers that are being called very frequently. I don't think the pin assignments matter. Using the hardware serial should solve the problem if that option is open.
Logged

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

The soft serial interrupt will run (and exit quickly) any time any of the pins in the same block change. You might try putting all the servo pins on a different port if you can rewire it and see if that helps. If you need the PWM pins, try putting the serial on one of the analog pins.
Logged

Chennai, India
Offline Offline
God Member
*****
Karma: 0
Posts: 752
Peace!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been trying to use the New Soft Serial and get the following error....
Code:
NewSoftSerial.cpp:165: warning: 'PCINT0_vect' appears to be a misspelled signal handler
NewSoftSerial.cpp:170: warning: 'PCINT1_vect' appears to be a misspelled signal handler
NewSoftSerial.cpp:175: warning: 'PCINT2_vect' appears to be a misspelled signal handler
NewSoftSerial.cpp: In member function 'void NewSoftSerial::begin(long int)':
NewSoftSerial.cpp:250: error: 'PCICR' was not declared in this scope
NewSoftSerial.cpp:251: error: 'PCMSK2' was not declared in this scope
NewSoftSerial.cpp:254: error: 'PCICR' was not declared in this scope
NewSoftSerial.cpp:255: error: 'PCMSK0' was not declared in this scope
NewSoftSerial.cpp:258: error: 'PCICR' was not declared in this scope
NewSoftSerial.cpp:259: error: 'PCMSK1' was not declared in this scope

What does this mean? how do i resolve this?
Logged

Be The Change...

Austin, TX USA
Offline Offline
God Member
*****
Karma: 4
Posts: 997
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What compiler/Arduino version are you using?  That should work fine with Arduino 13 and avr-gcc 4.3.2.

Mikal
Logged

Chennai, India
Offline Offline
God Member
*****
Karma: 0
Posts: 752
Peace!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Mikal,
I use Arduino12 not sure of avr gcc version though.. how do i check it?

cheers,
Pracas
Logged

Be The Change...

Austin, TX USA
Offline Offline
God Member
*****
Karma: 4
Posts: 997
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The binary is in hardware/tools/avr/bin.  If you run

avr-gcc -v

it tells you the version number.  If you are in Windows, I think this is guaranteed to be 4.3.0 by default.  But you're not, are you?

Mikal
Logged

Chennai, India
Offline Offline
God Member
*****
Karma: 0
Posts: 752
Peace!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

yes i'm on windows.... xp sp2... and yes it is version.. 4.3.0 Should i Upgrade or something? this means a lot to me! smiley-sad
Logged

Be The Change...

Austin, TX USA
Offline Offline
God Member
*****
Karma: 4
Posts: 997
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

pracas, the only thing I can think is that your installation is hosed up somehow.  I can compile NewSoftSerial fine in 0012 under XP.  Wait a sec.  What *board* are you compiling for?

M
Logged

Chennai, India
Offline Offline
God Member
*****
Karma: 0
Posts: 752
Peace!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

A duemilanove with an Atmega8
Logged

Be The Change...

Pages: 1 ... 3 4 [5] 6 7 ... 11   Go Up
Jump to: