Audio board and serial port conflicts

Status
Not open for further replies.

dsparks

Well-known member
Here is my current situation:

I have a Teensy 3.1 mounted to an Audio board. The audio board also has the flash chip attached to it.

I am using Serial1 for a 4D Systems LCD screen. And from my understanding, The Audio Board uses

Serial2 and Serial3 for its operations.


I need an option for serial communication as I want to implement a midi solution with my current set up.

I have tried disabling the Serial3 pins for the audio board, but then the audio output does not work.

What choices do I have to implement serial comms while also keeping the current functionality of

the audio board?


I am aware of Software Serial, but would only want to use this as a last resort.

Thank you for any help on this!
 
Your best option is using pins 26 & 31, which are on the bottom side pads.

https://forum.pjrc.com/threads/32502-Serial2-Alternate-pins-26-and-31

If you do this, use Serial2.begin() and reassign the pins *before* you use SD.begin(10), if you use the SD lib.

You'll probably also need to add this after Serial2.begin(), to restore pin 9 to I2S usage:

Code:
        CORE_PIN9_CONFIG  = PORT_PCR_MUX(6); // pin  9, PTC3, I2S0_TX_BCLK

SoftwareSerial won't help. It's only a thin layer that lets you use the 3 real ports with other libs that have a hard-coded requirement for SoftwareSerial.

You might be able to to use AltSoftSerial, if you only need a slow baud rate. It uses pins 20 and 21. Maybe that's more convenient than accessing 26 & 31 on the bottom side?
 
Paul,

Thank you for the help!

So just to be clear, As long as Im not using the SD lib / SD card reader on the Teensy,

then I can get away with using the Serial2 option? I have no use for the SD functions

as I am using the Flash chip on the audio board for my storage.


I only need a baud rate of 31250 for Midi. And for right now I only need the Tx pin to send.

As I am not handling Midi inputs at this time. Nothing fancy needed.
 
I want to be clear, Serial2 absolutely will conflict with the audio board's usage of pin 9 for BCLK.

Odds are very good you can use Serial2 on the alternate pins, if you access the registers to reassign the signals after Serial2.begin(), and also if you assign pin 9 back to BCLK after Serial2 interferes. But this hasn't been tested, so the best I can say is it "should" work.

Please understand you *must* access the registers to reconfigure the hardware. This won't happen automatically. And there's a slight chance some other unforeseen issue may come up. I'm trying to help you, but I can't guarantee this will work. I haven't personally tried it.
 
I understand Paul. It would seem then that the AltSoftSerial option is my best bet. Also due to the fact that my Teensy is already soldered to the audio board in question.

So I have to use pins 20 and 21 if I want to implement the AltSoftSerial option? Or can these pins be changed?

Thanks again for all your help!
 
I tried using the Altsoftserial library and example with my current hardware set up of the Teensy 3.1 soldered to the AudioBoard with the Flash chip on that as well.

Unfortunately, I am getting no serial output. I am using the included example sketch directly from the altsoftserial page.

Code:
#include <AltSoftSerial.h>

AltSoftSerial altSerial;

void setup() {
  Serial.begin(9600);
  while (!Serial) ; // wait for Arduino Serial Monitor to open
  Serial.println("AltSoftSerial Test Begin");
  altSerial.begin(9600);
  altSerial.println("Hello World");
}

void loop() {
  char c;

  if (Serial.available()) {
    c = Serial.read();
    altSerial.print(c);
  }
  if (altSerial.available()) {
    c = altSerial.read();
    Serial.print(c);
  }
}

Is there a conflict between a timer on the audio board software and the altsoftserial lib?

Thanks for the help!
 
Is there a conflict between a timer on the audio board software and the altsoftserial lib?

There should not be any conflict. AltSoftSerial uses FTM0. Nothing in the audio lib touches FTM0.

I don't understand why you ask this, but post a program without the audio lib. Are you having trouble with AltSoftSerial alone, or only when used in combination with the audio lib?
 
Status
Not open for further replies.
Back
Top