Go Down

Topic: SoftwareSerial not working with ATMEGA1284P (Read 308 times) previous topic - next topic

Jeremyvnc

Jul 21, 2014, 05:27 pm Last Edit: Jul 21, 2014, 05:30 pm by Jeremyvnc Reason: 1
So I have rolled my own board based on the ATMEGA1284P QFN Chip.  I am trying to drive a 4d Systems display with it over software serial and every command is timing out (no ack seen by the display).  I piggy-backed off the display's TX pin and I see the acks coming in just as fast as I am sending the commands.  I have verified the correct pins.  I am using the AVR Developers pinout for the chip.  I am using arduino v1.5 and have made the 4D Systems suggested modifications to the SoftwareSerial.cpp for the TX sending out a 0x00 before any other character.

I have simplified the situation down to just trying to make a software serial loopback using the following code:

Code: [Select]

void setup()
{
 SoftwareSerial debugSerial = SoftwareSerial(21,20);
 debugSerial.begin(9600);
 while(true)
 {
 while(debugSerial.available())
 {
 digitalWrite(30,HIGH);  //On Board LED for visual aid
 debugSerial.write(debugSerial.read());
 }
 delay(100);  //for led blink
 digitalWrite(30,LOW);
 }
}


I plugged the usb serial TXO into 21, and RXI into 20.

I get nothing.  I haven't tried manually sending anything out of the debugSerial because the display worked fine at receiving the commands.  So the issue surrounds SoftwareSerial RX.

Any thoughts?  I have tried multiple pins but I thought the new SoftwareSerial library used any PCINT pin.  Am I mistaken?
Thanks,
-Jeremy

oric_dan

Quote
AVR Developers pinout

1. this pinout is not Arduino shield compatible, so possible you do actually have the wrong pins.

2. I, for one, never had ANY luck whatsoever using softserial, and gave up on it totally, although other people swear by it.

3. the mega1284 has 2 hardware UARTs, and I think you'd be much better off using one of those. This is why I went to the 1284 in the first place.

4. your sketch doesn't even use the default UART. I'd try my code on that "first", and then use it to debug the softserial stuff, if you persist with it.

Jeremyvnc

#2
Jul 21, 2014, 09:08 pm Last Edit: Jul 21, 2014, 09:18 pm by Jeremyvnc Reason: 1
1. This board is not remotely setup like an arduino so I don't have any shields or plans to add traditional shields.  I have verified the correct pins by just doing a digitalWrite with LED's attached.

2. Well, I have gotten TX to work but RX is just not triggering.  I'm just wondering if I don't have it wired up right (need pull-ups or pull-downs?).

3. I agree that I would be using the 2 UARTs first but they are already occupied by other devices.  They work, soft serial RX isn't.  I understand too that the ATMEGA on the MEGA has 4 ports but the chip is also about twice as much and I have quite a few IO still that are not being used on the 1284.

4. Serial and Serial1 are used already and work like they should.

I forgot to mention that this board is running at 8MHz with no bootloader (straight avr isp mkii).  Could the library be getting messed up with the 8MHz instead of 16?

Does anyone have successful experience with the SoftwareSerial library with sending and receiving?

-Jeremy

oric_dan


Go Up