0

Regarding M4 Mux'ing for serial port
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Regarding M4 Mux'ing for serial port

by lamachine on Fri Apr 09, 2021 4:04 pm

I am trying to read a second serial input using the Feather M4 Express. There is a post on M4 muxing https://forums.adafruit.com/viewtopic.php?f=62&t=153609&p=758301&hilit=M4+Muxing#p757929 that gives some key information, but not the format it needs to be in.

It says I can use
SERCOM4:
IOSET2 = PAD0, 1 = PB08, 09 = Pins A2, A3 = TX, RX


But in the Creating a New Serial guide https://learn.adafruit.com/using-atsamd21-sercom-to-add-more-spi-i2c-serial-ports/creating-a-new-serial it never mentions how to use the IOSET.

My code
Code: Select all | TOGGLE FULL SIZE
#include <Arduino.h>   // required before wiring_private.h
#include "wiring_private.h" // pinPeripheral() function

// Need to assign pb08,09 to those pins
// Does is need to be sercom4?
Uart Serial2 (&sercom4, A2, A3, SERCOM_RX_PAD_0, UART_TX_PAD_2);
void SERCOM4_Handler()
{
  Serial2.IrqHandler();
}

char message[35];
unsigned long lastSignal = 0;
bool transmission = false;
byte state = 1;
int pos;



void setup() {
  Serial.begin(9600);
  Serial2.begin(9600);

  // Assign pins A2 & A3 SERCOM functionality
  pinPeripheral(A2, PIO_SERCOM_ALT);
  pinPeripheral(A3, PIO_SERCOM_ALT);

... 



Errors in compiling with
Code: Select all | TOGGLE FULL SIZE
exit status 1
'sercom4' was not declared in this scope

lamachine
 
Posts: 35
Joined: Thu Feb 25, 2021 5:01 pm

Re: Regarding M4 Mux'ing for serial port

by lamachine on Tue Apr 13, 2021 5:13 pm

Just to simplify this a LOT. Can I access the additional serial ports on the M4 nRF52840? The Grand Central specifcally says they are available, but the 52840 docs do not.

I need to read a serial input, but have already used the obvious ports for things like GPS, LoRa, SD card. Oddly enough, I only need to receive, never transmit.

lamachine
 
Posts: 35
Joined: Thu Feb 25, 2021 5:01 pm

Re: Regarding M4 Mux'ing for serial port

by lamachine on Thu Apr 15, 2021 9:38 pm

For some reason, the board was showing up but not behaving properly. per IoTPanic on discord, I removed and reinstalled the board support, restarted arduino, and it compiled and loaded.

Please consider this closed!

lamachine
 
Posts: 35
Joined: Thu Feb 25, 2021 5:01 pm

Re: Regarding M4 Mux'ing for serial port

by adafruit_support_carter on Thu Apr 15, 2021 9:47 pm

Thanks for sharing what fixed it. That is not at all an uncommon fix for general Arduino weirdness. Sometimes the install and setup can just get itself wrapped around the axle for unknown and various reasons. Sometimes it even requires reinstalling the entire IDE.

Good luck with your project. Have fun!

adafruit_support_carter
 
Posts: 20331
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.


cron