2

The SoftwareSerial Library of Arduino don't work with clones made of ATMEGA32 as this do not have PCINT feature. How serial communication is linked with PCINT? can the INT pins of ATMEGA32/16 be someway used by the modification of SoftwareSerial.cpp file?

user45603
  • 25
  • 6

1 Answers1

1

Prior to IDE 1.0.+ the SoftwareSerial used to be a polling of the Rx Pins. This was blockin, requiring constant checking the service of the RX and limited the quality of the baud rate. Since NewSoftSerial replaced the former older Polled SoftwareSerial, using PCint's. Which creates an interrupt on the change of the RX Pin and then checks the time. This is no longer blocking and better emulates the Hardware Serial port, require less (none) servicing (or polling).

One can go back to the older IDE's SoftwareSerial from before 1.+ and attempt to either port it forward or try to use the ATmega32 in the older IDE. I thought I had seen a DEFINE switch somewhere that would allow it to run in polled mode. But I am unable to find it in current releases. Likely did not make it into the released IDE.

Or you can try to find an alternative to SoftwareSerial. Such as tinyserial Where I see that dates back to 2010 and will likely need some updating. Especially on 1.5.8. May have better luck trying it on 1.0.6

mpflaga
  • 2,807
  • 2
  • 15
  • 19
  • You are in Luck!. The ATmega32's INT0,1,2 pins can be configured to generate an interrupt on Rising or Falling or Level. So one can use INT0 (or other) and in principle (almost as) simply start with attachInterrupt(0,myRXhandle_interrupt(),FALLING) which in turn detaches the prior interrupt and attaches the next expected falling edge after calling SoftwareSerial::handle_interrupt(). This will catch and handle the rising and falling of bauds with the same functions that PCint uses. – mpflaga Feb 07 '15 at 06:54
  • thank you very-much @mpflag , I'm in-fact struggling hard for last few days with this. I tried installing old software serial. renaming them as pSoftwareserial.h , pSoftwareserial.cpp and inside .cpp correction the includes to and "pSoftwareserial.h" It compiles with certain warning, but finally the SoftwareSerial didn't worked. I am little habituated with functions like mySerial.readString(), inherited from Stream object possibly. now I am trying to use a library called AltSoftSerial but even that doesn't inherit's Stream object too. – user45603 Feb 09 '15 at 13:40
  • Are you able to compile AltSoftSerial's test.pde. I am able to for both IDE 1.0.6 and 1.5.8. I would expect this route to be the most reliable as PJRC work is quite good. – mpflaga Feb 09 '15 at 14:23
  • #define ALTSS_USE_TIMER1 #define INPUT_CAPTURE_PIN >> ICP1 #define OUTPUT_COMPARE_*_PIN >> OC1* are to be added right? that's I thought after seeing AltSoftSerial_Board.h ...On the 2nd idea that you suggested, i tried mySerial.handle_interrupt(); it gives an error saying undefined reference to SoftwareSerial::handle_interrupt()' this function is possibly not defined in how could I resolve this ? – user45603 Feb 09 '15 at 15:20
  • Could you post the code. It sounds worthy of sharing. – mpflaga Feb 09 '15 at 20:30