Software Serial bug on MoteinoMEGA? [FIXED]

Started by dave_sausages, August 22, 2016, 01:20:27 PM

Felix

OK I found the problem!
There are 2 issues:

Issue #1 - the MoteinoMEGA core
There were some incorrect PCMSK definitions in the pins_arduino.h file. This is now corrected and all core ZIP files are updated including the one for the BoardManager.
If you want to do a manual install follow the instructions in the repo here.
Otherwise if you want to update/install (v 1.2 as of now) through the BoardManager, see the guide here.

Issue #2 - your sketch
Your original sketch has an error, the pin definitions are passed in the wrong order to the SoftwareSerial constructor, please see the SoftwareSerial constructor reference here, the correct constructor is this:

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx); <------ Original from your sketch: INCORRECT PIN ORDER
SoftwareSerial bluetooth(bluetoothRx, bluetoothTx); <------ Use this instead


Thanks for bringing this up to my attention, please test the new core ZIP and let me know if everything is good.
-Felix

dave_sausages

I can confirm that software serial now works when selecting Moteino Mega in the IDE and uploading the sketch (using updated core files). Thanks Felix, and glad to be of some help to others for once, rather than just asking questions :)

simon pearce

Hi all,

Just a quick one, I've updated cores etc and tried to follow the thread here for the fix but am still not getting Software Serial operational. I am using a Moteino Mega with software serial using pins 17,18, I can get comms in one direction only. I am using arduino ide 1.6. Is there anything else I could try? I know this is down as being fixed and possibly I am misunderstanding but I'm getting tough going here, any help would be greatly appreciated!

Felix

@simon,
What exactly is the behavior?
Does the baud match on both ends and that TX/RX are properly wired?
Are you sure you got the latest Moteino core installed which has the soft serial fix included? This was verified to work by myself and others here.
Can you verify other pair(s) pins?

perky

#19
If the Moteino Mega uses the atmega1284P then pin 18 is possibly on JTAG TCK, so make sure you have the JTAGEN fuse disabled otherwise you won't be able to use that for IO.
Edit: Felix ships this with JTAG disabled so this is only if you've changed the fuse settings.
Mark.

simon pearce

Thank you all so much for your replies, have now fixed the issue. It was a software serial issue we fixed with the MCUdude MightyCore version of SoftwareSerial. Seems like it is working well now across a variety of baud rates. Loving using the Moteino it meets our needs exactly and this was really the final piece of the puzzle for us. Now we just need to multiplex the Serial 1 and we'll be doing well.

Once again thank you for your timely and insightful help, it is very much appreciated!

Felix

Glad you narrowed it down and solved the problem, thanks for the feedback!

ivars211

I can confirm, that Standard SoftwareSerial library doesn't work on Moteino mega (at least it didn't for me). As suggested by simon pearce, use MightCore (https://github.com/MCUdude/MightyCore/tree/master/avr/libraries/SoftwareSerial) library.

Felix

Quote from: ivars211 on February 02, 2017, 02:31:44 PM
I can confirm, that Standard SoftwareSerial library doesn't work on Moteino mega (at least it didn't for me). As suggested by simon pearce, use MightCore (https://github.com/MCUdude/MightyCore/tree/master/avr/libraries/SoftwareSerial) library.
Can you give more details and the core you were using ?

ivars211

#24
Quote from: Felix on February 02, 2017, 03:04:40 PM
Can you give more details and the core you were using ?
Hi Felix,

This is with your Moteino mega dualoptiboot bootloader. I was using Arduino IDE 1.6.7 SoftwareSerial library + your updated pins_arduino.h  file and it would compile fine, but software serial won't work.
If I replace that library with MightCore's + your updated pins_arduino.h, everything works as expected.
It could be that I just need to update my IDE version, didn't bother to investigate any further.

Felix

Have you seen the top 2 posts on this page? Others have confirmed the Moteino core fixes this problem. Have you chosen Moteino MEGA as target in the IDE?

ivars211

Yes. To me, it doesn't matter much which software serial library is being used, as far as it works. Just thought someone else might find that useful.