Go Down

Topic: NewSoftSerial Library: An AFSoftSerial update (Read 18 times) previous topic - next topic

etracer

mellis:

Looks like you nailed it!

I installed Arduino 0012 on a Windows XP machine and rebuilt and uploaded my test program.  Everything works correctly with no lockups.

So now the question is: how do I resolve this avr-gcc version/interrupt problem on OSX?  Is there a later/different version in the Arduino 0013 build?

rogermm

Quote
Questions for the Arduino world at large:

1. Has anyone experienced the kind of lockup in AFSoftSerial that etracer describes?
2. Please let me know if you
  a. notice any difference in behavior between AFSoftSerial and NewSoftSerial.
  b. have successfully tested multiple instances of NewSoftSerial.
  c. have any observations about baud rates that don't seem to work reliably with either AFSoftSerial or NewSoftSerial.

Mikal


I have tested both AFSoftSerial.h and NewSoftSerial.h with 2400 baud rate for a Parallax RFID reader.  Both produce lockups - although they seem to lock at slightly different points in the code.  The exact same code works perfectly with SoftwareSerial.h

I am using OSX 10.4.11 with Arduino 0012.

rogermm

mikalhart

Sigh.  It does seem like something is broken in OSX interrupts.

Jin

I've been playing around with NewSoftSerial and it's been working pretty well for me, with only a few difficulties so far. Thanks for your great work packaging up a bunch of different ideas, mikalhart.

A few notes:
  • I've experienced some problems doing the same sort of serial pass-through, where you just echo characters between the softserial pins and the UART. If the device I'm speaking to on the softserial port is set to echo, no matter how slowly I type I am liable to get garbage characters interspersed with what I'm typing. Turning off echo and having everything run half duplex gives pretty good results. Could this be because pins 2 and 3 (used very often in the soft serial examples I've seen) share an interrupt with the UART on pins 0 and 1? Unfortunately, my device requires a specially designed shield so I can't move pin assignments around easily, but if someone who is having interrupt problems could try using, say, pins 8 and 9 for the soft serial and see if they continue to have problems, that would be an interesting experiment.

  • Another problem I've had is when I get a whole slew of characters sent back from the serial device, it quickly fills the buffer and I lose the rest of the data, even when I'm not doing hardly anything else in the main loop other than trying to handle the input. I'm looking into adding proper RTS/CTS handling as an option to NewSoftSerial to see if that helps. There's an attempt at CTS handling in the AF_XPort code, but it doesn't seem to work properly for me.

rogermm

Quote
Could this be because pins 2 and 3 (used very often in the soft serial examples I've seen) share an interrupt with the UART on pins 0 and 1? Unfortunately, my device requires a specially designed shield so I can't move pin assignments around easily, but if someone who is having interrupt problems could try using, say, pins 8 and 9 for the soft serial and see if they continue to have problems, that would be an interesting experiment.


I was using pins 2 and 3 and have changed them to 8 and 9 as suggested - unfortunately there is no noticeable change in the lockup.

Really hope this can be resolved..  :)

Go Up