Austin, TX USA
Offline
God Member
Karma: 3
Posts: 992
Arduino rocks
|
 |
« Reply #90 on: March 25, 2009, 11:32:56 am » |
Jason, I like your thinking. Unfortunately, the symbol you reference there is defined inside Print.h, and GekoCH's error message was that NewSoftSerial couldn't find Print.h. So this wouldn't solve his particular problem. I'd love in the future to be able to simply write something like #if ARDUINO_VERSION < 12 #error "Whoops!" #endif Thanks much for your feedback. Mikal
|
|
|
|
|
Logged
|
|
|
|
|
Forum Administrator
Cambridge, MA
Offline
Faraday Member
Karma: 8
Posts: 3532
|
 |
« Reply #91 on: March 25, 2009, 12:16:59 pm » |
In this case, you could offer a better error message, but it still wouldn't work. I know it's not that hard to add, and wouldn't really cause any problems, but I'm still not really convinced that it's that useful. Are there cases where we can't just tell people to upgrade to the latest version of the IDE?
|
|
|
|
|
Logged
|
|
|
|
|
Austin, TX USA
Offline
God Member
Karma: 3
Posts: 992
Arduino rocks
|
 |
« Reply #92 on: March 25, 2009, 12:30:21 pm » |
In my experience, there are a number of users -- GekoCH here for example -- that like to stick with earlier versions of Arduino. There are a number of "stale" libraries that no longer work on the newer Arduino versions. That's frequently the motivation for staying with one version. Is that the case here, GekoCH? When these users try to deploy certain newer libraries like NewSoftSerial, they get these cryptic error messages. Then we get thrash on the forum as the well-meaning library writer tries to make sure his users are happy.  If I had been able to deliver a succinct #error " This library requires Arduino version X. Please update." I think some thrash could be avoided. Thanks, Mikal
|
|
|
|
« Last Edit: March 25, 2009, 12:31:24 pm by mikalhart »
|
Logged
|
|
|
|
|
Forum Administrator
Cambridge, MA
Offline
Faraday Member
Karma: 8
Posts: 3532
|
 |
« Reply #93 on: March 25, 2009, 12:44:43 pm » |
Can't we just put that on the website where you download the library? Again, it's not that I'm opposed to the ARDUINO_VERSION define, I'm just not convinced yet. 
|
|
|
|
|
Logged
|
|
|
|
|
Austin, TX USA
Offline
God Member
Karma: 3
Posts: 992
Arduino rocks
|
 |
« Reply #94 on: March 25, 2009, 12:54:54 pm » |
Yes. You are right. I can (and should) put a "requirements" section in the documentation. That's a good idea whether or not we have ARDUINO_LIBRARY symbol. But if users read documentation anywhere as haphazardly as I do, I bet there will still be forum thrash.  I guess that I usually follow the philosophy that "if it could be useful and it almost certainly will not be harmful, then put it in", although I very much appreciate that the conservative strategy "keep it out unless it must be in" pays great dividends in many cases. Frankly, I'll save my passion for other issues.  Mikal
|
|
|
|
« Last Edit: March 25, 2009, 01:07:25 pm by mikalhart »
|
Logged
|
|
|
|
|
Switzerland
Offline
Sr. Member
Karma: 0
Posts: 261
|
 |
« Reply #95 on: March 26, 2009, 04:32:48 pm » |
In my experience, there are a number of users -- GekoCH here for example -- that like to stick with earlier versions of Arduino. There are a number of "stale" libraries that no longer work on the newer Arduino versions. That's frequently the motivation for staying with one version. Is that the case here, GekoCH? That's right. I got a Project and I'm limited to the space of the Arduino Nano. And the new version of Arduino (0013) has something changed with the millis() and now it takes to much space. That's one reason why I stick to the 0011 version. Project under: www.snowflakeONE.chGeko
|
|
|
|
|
Logged
|
|
|
|
|
"The old Europe"
Offline
Edison Member
Karma: 0
Posts: 2003
Bootloaders suck!
|
 |
« Reply #96 on: March 29, 2009, 11:44:35 am » |
@mikalhart I've tracked down my problem on linux (gcc 4.3.3_20090316-17.1) to this block of inline assembler code: /* asm volatile("sbiw %0, 0x01 \n\t" "ldi %1, 0xFF \n\t" "cpi %A0, 0xFF \n\t" "cpc %B0, %1 \n\t" "brne .-10 \n\t" : "+r" (delay), "+a" (tmp) : "0" (delay) ); */
Error messages: /tmp/ccdD9LWq.s: Assembler messages: /tmp/ccdD9LWq.s:855: Error: register r24, r26, r28 or r30 required /tmp/ccdD9LWq.s:912: Error: register r24, r26, r28 or r30 required /tmp/ccdD9LWq.s:957: Error: register r24, r26, r28 or r30 required
o: In function `main': undefined reference to `NewSoftSerial::NewSoftSerial(unsigned char, unsigned char)'
The .o file of the library never gets built. It is irrelevant if I choose the 168 or 328 chip as target Edit: If I remove the "SBIW ...." line, it compiles. But I don't think is is any good. Hope it points to a solution though.
|
|
|
|
« Last Edit: March 29, 2009, 12:00:57 pm by madworm »
|
Logged
|
• Upload doesn't work? Do a loop-back test. • There's absolutely NO excuse for not having an ISP! • Your AVR needs a brain surgery? Use the online FUSE calculator. • My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets... • Microsoft is not the answer. It is the question, and the answer is NO!
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 40
|
 |
« Reply #97 on: April 03, 2009, 05:19:18 am » |
Thanks for making NewSoftSerial - it works very well for me. Saved my day when SoftwareSerial's limitations were too stringent.
But for one specific project I really wanted the ability to receive multiple independent serial streams at the same time so I started working on a somewhat different approach to try and see how far one can push the ATmega chip. It turns out that it is possible to receive at least 5 streams @ 9600 baud with an Arduino - though I don't know how much processing power that leaves for other tasks.
The basic idea is shown here: http://jeelab.equi4.com/2009/03/25/multiplexing-code-for-arduino/ It's being used in a "MuxShield", which is described in these posts: http://jeelab.equi4.com/tag/muxshield/ The complete source code is available here: http://jeefiles.equi4.com/muxshield.pde
Perhaps some of this is of use to Mikal or others - feel free to adopt any part of this if it helps you take the NewSoftSerial library further. Ironically perhaps, I'm also using NewSoftSerial inside the MuxShield (to implement its slave bootstrap function).
|
|
|
|
|
Logged
|
|
|
|
|
Austin, TX USA
Offline
God Member
Karma: 3
Posts: 992
Arduino rocks
|
 |
« Reply #98 on: April 05, 2009, 08:11:58 pm » |
Thanks for the interesting write up, Jean-Claude. There are a couple of people working on a timer-based approach to serial communication. It all seems very promising. Perhaps I would suggest making a parallel library? (I'm a little reluctant to modify NewSoftSerial so radically at this point when there are so many other features in the works for it.)
Really, really good work!
Mikal
|
|
|
|
|
Logged
|
|
|
|
|
The Big Smoke
Offline
Sr. Member
Karma: 0
Posts: 259
Hacking and Slashing
|
 |
« Reply #99 on: May 02, 2009, 12:09:11 pm » |
Hey guys, great work! Can I make a simple suggestion. For my library I had to create a branch of your library to support dynamic instancing (AVR-GCC doesn't support the new operator implicity?!). This support can be added in about 4 lines (download the library to see). Throwing that in would be really useful for devs like myself. Cheers
|
|
|
|
|
Logged
|
|
|
|
|
Summerville, Oregon
Offline
Jr. Member
Karma: 0
Posts: 57
I like this little thing!
|
 |
« Reply #100 on: May 11, 2009, 07:46:33 pm » |
Sorry if I missed this information somewhere else Mikal. Does NSS work on the new Arduino Mega? I am trying to send data from Liquidware's TouchShield Slide to the Mega. My Oscilloscope tells me that the Slide is doing it's part and I have data on pin three of the Mega but mySerial.available() never returns anything. Here is the code from the Mega:
#include <NewSoftSerial.h>
int RXpin = 3; int TXpin = 2;
NewSoftSerial mySerial = NewSoftSerial(RXpin,TXpin); int zz = 0;
void setup() { Serial.begin(57600); //set data rate from Arduino to PC Serial.println("Lets get started!"); // this prints fine. mySerial.begin(9600); // set the data rate for the NewSoftSerial port }
void loop() { if (mySerial.available() > 0) // this never triggers... { Serial.print((char)mySerial.read()); Serial.print(zz++); } }
------------------------------------------------------ Thank you Keshka
|
|
|
|
|
Logged
|
|
|
|
|
Austin, TX USA
Offline
God Member
Karma: 3
Posts: 992
Arduino rocks
|
 |
« Reply #101 on: May 11, 2009, 08:58:09 pm » |
I know that NewSoftSerial definitely does not work on the Mega when the RX pin > 19. What I don't know is whether the Mega's lower numbered pins are compatible with the "regular" Arduino. I'm guessing not based on what you report. Does anyone know?
Mikal
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 65
Arduino rocks
|
 |
« Reply #102 on: May 11, 2009, 10:11:19 pm » |
I have not tried the NSS library on my Mega yet, I thought the beauty of the Mega was that it has 4 hardware Serial ports....
|
|
|
|
|
Logged
|
|
|
|
|
Austin, TX USA
Offline
God Member
Karma: 3
Posts: 992
Arduino rocks
|
 |
« Reply #103 on: May 11, 2009, 10:40:06 pm » |
Yeah, that's a good point.
|
|
|
|
|
Logged
|
|
|
|
|
Summerville, Oregon
Offline
Jr. Member
Karma: 0
Posts: 57
I like this little thing!
|
 |
« Reply #104 on: May 12, 2009, 06:15:11 pm » |
And using one of those ports looks like what I am going to have to do. Did like having the TouchSlide mount right on top of the Mega as a "shield" but I will get over it. Pin 2 & 3 on the Mega are routed to (OC3B/INT4)PE4 & (OC3C/INT5)PE5 on the ATMEGA1280-16AU.
Keshka
|
|
|
|
|
Logged
|
|
|
|
|
|