Audio shield AudioInputI2S(Line In) conflict with DMXSimple?

Status
Not open for further replies.

ninja118

Member
I'm running into what seems like a conflict between Teensy w/ Audio Adaptor using AudioInputI2S (LineIn) and doing DMX transmit via DmxSimple at the same time.

The behavior I'm seeing is that as soon as I try to send DMX via DmxSimple, the audio from AudioInputI2S stops working.

What I'm trying to achieve is:

1) Audio:
Teensy 3.2 (w/ Arduino 1.6.8 and Teensyduino 1.28 beta)
Teensy Audio Adaptor
LineIn and SD Wav mixing, going to AudioOutputI2S

2) DMX:
transmit DMX using DmxSimple (e.g., DmxSimple.usePin(13)....)
(Teensy connected to an external Max485 chip via pin 13)

3) I2C:
listen on secondary I2C bus (pins 29/30) as a slave

Everything works great together, with the exception of DMX transmit and LineIn together.

As soon as I call DmxSimple.usePin(13) followed by DmxSimple.maxChannel(10) (which I believe calls DmxSimple.begin) the LineIn sound disappears from the output (SDWav continues to function).

Perhaps its some type of interrupt conflict between DmxSimple and the I2S part of the Audio library?

Is there a way to achieve what I'm attempting?

I've read some posts by Paul on the forum making reference to the possibility of transmitting DMX on a serial line, but not exactly sure how to do that (e.g., is an external 485 chip still used?) -- and should it theoretically work in the above 3-part configuration?
 
As soon as I call DmxSimple.usePin(13) followed by DmxSimple.maxChannel(10) (which I believe calls DmxSimple.begin) the LineIn sound disappears from the output (SDWav continues to function).

The audio shield uses pin 13 to send audio data to Teensy. You'll need to choose another pin for DMX.

You might also consider simply using Serial1 to transmit DMX. Something like this:

Code:
uint8_t buffer[513];

void xmit() {
  Serial1.begin(83333, SERIAL_8N1);
  Serial1.write(0);
  Serial1.flush();
  Serial1.begin(250000, SERIAL_8N2);
  // first byte of buffer must be zero
  // to comply with DMX protocol
  Serial1.write(buffer, sizeof(buffer));
  Serial1.flush();
}

#define RED    0xFF0000
#define GREEN  0x00FF00
#define BLUE   0x0000FF
#define YELLOW 0xFFFF00
#define PINK   0xFF1088
#define ORANGE 0xE05800
#define WHITE  0xFFFFFF

void setup() {
  Serial1.begin(250000);
}

void loop() {
  colorWipe(RED);
  colorWipe(GREEN);
  colorWipe(BLUE);
  colorWipe(YELLOW);
  colorWipe(PINK);
  colorWipe(ORANGE);
  colorWipe(WHITE);
}

void colorWipe(int color)
{
  for (int i=0; i < 48; i++) {
    buffer[0] = 0;
    buffer[i*3 + 1] = color >> 16;
    buffer[i*3 + 2] = color >> 8;
    buffer[i*3 + 3] = color >> 0;
    buffer[i*3 + 1 + 144] = color >> 16;
    buffer[i*3 + 2 + 144] = color >> 8;
    buffer[i*3 + 3 + 144] = color >> 0;
    buffer[i*3 + 1 + 288] = color >> 16;
    buffer[i*3 + 2 + 288] = color >> 8;
    buffer[i*3 + 3 + 288] = color >> 0;
    buffer[25] = 0x5A;
    xmit();
    buffer[25] = 0xA5;
    xmit();
  }
}
 
Status
Not open for further replies.
Back
Top