SoftwareSerial lib and atmega1284p sends data but does not recieve it

Hi again folks,

Having won the battle of the SPI and the Ethernet controller with the guidance and help here on the forum I have now moved onto my second problem with the atmega3284P

SoftwareSerial sends data but does not receive it

I am setting up a soft serial port using pins D2 and D3. The system is sending data happily at 9600 but not receiving anything.

I am looking for any clues as to why this might be.

Cheers Pete.

Software serial uses pin change interrupts and not all pins raise pin change interrupts. Check the documentation.

[quote author=Nick Gammon link=topic=192521.msg1422742#msg1422742 date=1381353487] Software serial uses pin change interrupts and not all pins raise pin change interrupts. Check the documentation. [/quote]

Thanks Nick,

According to the pin allocation in the documentation D2 has INT2 associated with it.

I guess this should be allocated to the RX pin in the library. I will try this and see what happens.

Cheers Pete.

That isn't a pin change interrupt, it's an external interrupt.

http://arduino.cc/en/Reference/SoftwareSerial

Limitations

The library has the following known limitations:

If using multiple software serial ports, only one can receive data at a time.

Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).

Pin 2 isn't on that list.

Thanks Nick,

can you point me at the list for the 1284P if you know where to find it.

Cheers Pete.

Is it on a board, if so which board? The 1284 and 2560 are from the same family of chips.

If you are looking at the raw chip (the datasheet) you need a pin with PCINTx on it (Pin Change Interrupt).

HI Nick,

It is not on any board just the chip on breadboard waiting for the PCB design to be finalized.

It has the atmighty optiboot boot loader with the standard pin configuration from maniacbug.

Cheers Pete.

The 1284 has 2 hardware UARTs. I would try using the 2nd one, referenced in Ardunio lingo as Serial1.begin(57600), Serial1.read(), etc.

In regards softserial, I never had any luck with it myself, and avoid it now. That was a major reason I switched over to 1284.

oric_dan: The 1284 has 2 hardware UARTs. I would try using the 2nd one, referenced in Arduino lingo as Serial1.begin(57600), Serial1.read(), etc.

Thanks Dan but I am already using both the UART based serial interfaces as MODbus interfaces. TBH I only needed it for inter module communication to another temperature differential switch module I have designed for the same client. Since both are currently still in the design stages then I might just move over the IIC for the inter-board stuff since I have that working on the 1284 anyway for my LCD interface.

From my experience, softserial works very poorly - [but I have bad luck with a lot of Ardunio 3rd party libraries, lol]. If you really need a lot of serial ports, you might better go to a Mega board. Good luck.