Daisy Serial Interface

Hi there,
In my project of a multiple guitar effects with DS, I need to interface the DS with an ESP32 through 2 serial ports: one asynchronous (ASCII) for DS chain configuration and other synchronous (binary) for volume pedal data. Of course I could do both with only one serial link, but the DS software would be more complex, heavier and slower. According with the DS pin map, the serial ports are:
USART1 - 13 - 14
USART1 (should it be 2?) - 29 - 30
USART3 - 2 - 1
USART4 - 12 - 11
I tried USART1 with Serial1 on pins 13 and 14 and it worked as expected. However, there is no previous definition of Serial2, Serial3 or Serial4 in DaisyDuino. So I tried
HardwareSerial MySerial(2);
and also MySerial(3) and MySerial(4). I’ve found that MySerial(2) corresponds to USART3 on pins 2 and 1, but all the other USARTs are missing.
Am I missing something?

1 Like

Hi guys
Don’t need to bother yourselves answering me. I’ve just realized what I was doing wrong. The constructor of Daisy’s HardwareSerial is different from the constructor in ESP32. I though they were the same.

@vladuino I’m also looking to control params of a Daisy Seed sketch from an ESP32. Could you please elaborate on how you go this working and possibly post an example of your code showing communicating between the two??

Well, certainly!. I just made a two wire connection for hardware serial communication between DS and ESP32. In DS side I selected the USART1 (pins 13 and 14). ESP32 uses UART1 (Serial_1) on pins 22 and 23. Please note that the ESP pins may change with the manufacturer board. Mine is WROVER module (for TTGO ESP32 WROVER B T8 V1.8 ESP32 8MB PSRAM TF Card WiFi Module Bluetooth Development Board|Replacement Parts & Accessories| - AliExpress). Also note that USART1 on DS uses pins 13 and 14, and not pins 29 and 30 as it was misplaced on Daisy Seed pinout diagram. To avoid short circuit between DS and ESP32, I replaced the serial wires with 1k resistors. The DS example code is:

// Daisy Seed to ESP32 serial communication
// DS pins: RX=11, TX=12;

#include  "DaisyDuino.h"

uint32_t rx3 = 11, tx3 = 12;

HardwareSerial  SerialPot(rx3, tx3); 

char      cs = 0, cr;
char      led_sign;

uint32_t  timer, dtime = 1000;

void setup() 
{
    Serial.begin(115200);
    SerialPot.begin(115200); 
    delay(4000);
    
    pinMode(LED_BUILTIN, OUTPUT);
    led_sign  = HIGH;
}

void loop() 
{
    if (millis() > timer + dtime)
    {
      timer   = millis();
      digitalWrite(LED_BUILTIN, led_sign);
      led_sign = !led_sign;
      SerialPot.write(cs);
      cs++;
      Serial.println(cs);
    }

    if (SerialPot.available())
    {
      cr      = SerialPot.read();
      Serial.print("-> ");
      Serial.println(cr);
      //SerialPot.write(cs);
    }
}

and the ESP32 code is:

// ESP32 to Daisy Seed serial communication
// ESP32 pins: RX=22, TX=23;

#include "BluetoothSerial.h"
#include "HardwareSerial.h"

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
HardwareSerial Serial_1(1);   // UART1  Command

BluetoothSerial SerialBT;

void setup() 
{
  int TX1, RX1;

  Serial.begin(115200);
  //Serial3.begin(115200);
  //Serial2.begin(115200);
 
  SerialBT.begin("GSP"); //Bluetooth device name - To Android
  //Serial.println("The device started, now you can pair it with bluetooth!");

  RX1   = 22;
  TX1   = 23;
  Serial_1.begin(115200, SERIAL_8N1, RX1, TX1); //Serial to Daisy Seed - Command
}

void loop() 
{

  if (Serial.available())   // Input from serial monitor
  {
      Serial_1.write(Serial.read());
  }

  if (Serial_1.available())   // Input from daisy
  {
      Serial.write(Serial_1.read());
  }
  
  if (SerialBT.available())          // Input command from Bluetooth
  {
      Serial_1.write(SerialBT.read());
  }

  return;
}

Best regards

2 Likes