Author Topic: Software Serial bug on MoteinoMEGA? [FIXED]  (Read 8320 times)

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Can Software Serial work on a Moteino Mega? And if so, how?
« Reply #15 on: August 24, 2016, 08:15:56 PM »
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:

Code: [Select]
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
« Last Edit: August 24, 2016, 08:21:30 PM by Felix »

dave_sausages

  • NewMember
  • *
  • Posts: 49
Re: Software Serial bug on MoteinoMEGA? [FIXED]
« Reply #16 on: September 07, 2016, 11:46:49 AM »
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

  • NewMember
  • *
  • Posts: 2
  • Country: nz
Re: Software Serial bug on MoteinoMEGA? [FIXED]
« Reply #17 on: November 03, 2016, 03:41:16 AM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Software Serial bug on MoteinoMEGA? [FIXED]
« Reply #18 on: November 03, 2016, 08:15:42 AM »
@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

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: Software Serial bug on MoteinoMEGA? [FIXED]
« Reply #19 on: November 03, 2016, 08:40:02 AM »
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.
« Last Edit: November 03, 2016, 03:14:58 PM by perky »

simon pearce

  • NewMember
  • *
  • Posts: 2
  • Country: nz
Re: Software Serial bug on MoteinoMEGA? [FIXED]
« Reply #20 on: November 05, 2016, 04:40:17 AM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Software Serial bug on MoteinoMEGA? [FIXED]
« Reply #21 on: November 06, 2016, 08:39:57 PM »
Glad you narrowed it down and solved the problem, thanks for the feedback!

ivars211

  • NewMember
  • *
  • Posts: 16
Re: Software Serial bug on MoteinoMEGA? [FIXED]
« Reply #22 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.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Software Serial bug on MoteinoMEGA? [FIXED]
« Reply #23 on: February 02, 2017, 03:04:40 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

  • NewMember
  • *
  • Posts: 16
Re: Software Serial bug on MoteinoMEGA? [FIXED]
« Reply #24 on: February 03, 2017, 04:11:17 AM »
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.
« Last Edit: February 03, 2017, 04:16:08 AM by ivars211 »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Software Serial bug on MoteinoMEGA? [FIXED]
« Reply #25 on: February 03, 2017, 08:00:32 AM »
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

  • NewMember
  • *
  • Posts: 16
Re: Software Serial bug on MoteinoMEGA? [FIXED]
« Reply #26 on: February 03, 2017, 12:20:29 PM »
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.