Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Serial2 and Serial3 on Adafruit Grand Central M4
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Serial2 and Serial3 on Adafruit Grand Central M4

by hopskipjump on Tue Apr 28, 2020 10:04 am

For the Adafruit Grand Central M4 I thought that RX2 (pin17) and RX3 (pin 15) work with Serial2 and Serial3. But I get

error: 'Serial2' was not declared in this scope

and

error: 'Serial3' was not declared in this scope

Are these expected to work?

hopskipjump
 
Posts: 6
Joined: Wed Nov 09, 2016 11:28 am

Re: Serial2 and Serial3 on Adafruit Grand Central M4

by dastels on Tue Apr 28, 2020 11:36 am

It look like it's partially implemented, but the Uart objects aren't being created.

I 've been playing with this and getting some results with Serial2.
The exact file locations may/will be different on your system, but there shoudl be enough information in the paths for you to find it on your system.

In file ~/.arduino15/packages/adafruit/hardware/samd/1.5.11/variants/grand_central_m4/variant.h look for a line:
Code: Select all | TOGGLE FULL SIZE
extern Uart Serial1;

Add a line after it:
Code: Select all | TOGGLE FULL SIZE
extern Uart Serial2;

And one for Serial3 if you wish.

In file ~/.arduino15/packages/adafruit/hardware/samd/1.5.11/variants/grand_central_m4/variant.cpp look for a line:
Code: Select all | TOGGLE FULL SIZE
Uart Serial1( &sercom0, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ;

As before, add after it:
Code: Select all | TOGGLE FULL SIZE
Uart Serial2( &SERCOM_SERIAL2, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ;

And a similar one for Serial3 if desired.

Dave

dastels
 
Posts: 3531
Joined: Tue Oct 20, 2015 3:22 pm

Re: Serial2 and Serial3 on Adafruit Grand Central M4

by hopskipjump on Tue Apr 28, 2020 11:59 am

Thank you!

That resolved the error.

hopskipjump
 
Posts: 6
Joined: Wed Nov 09, 2016 11:28 am

Re: Serial2 and Serial3 on Adafruit Grand Central M4

by tomjennings on Fri Jul 03, 2020 2:30 pm

THANK YOU! Easy fix.

Is there a reason this isn't in the distribution as default?

One of the main reasons I have been using Mega 2560s, and now Grand Central's, is multiple hardware serials.

For mac users, the variant.* files are in /Users/username/Library/Arduino/packages/.... etc

tomjennings
 
Posts: 78
Joined: Thu Aug 17, 2006 1:21 am

Re: Serial2 and Serial3 on Adafruit Grand Central M4

by dastels on Fri Jul 03, 2020 5:24 pm

Agreed. I was surprised.

Dave

dastels
 
Posts: 3531
Joined: Tue Oct 20, 2015 3:22 pm

Re: Serial2 and Serial3 on Adafruit Grand Central M4

by tomjennings on Tue Jul 07, 2020 7:19 pm

Has anyone actually gotten additional UARTs working on Grand Central M4 Express? If so, could you be so kind as to post example code and config?

I'm stumped.

I'm getting hangs just TRANSMITTING. And the output pins remain LOW.

tomjennings
 
Posts: 78
Joined: Thu Aug 17, 2006 1:21 am

Please be positive and constructive with your questions and comments.