Hi, I’m trying to establish communication between an Arduino Mega (Slave) and the Daisy Seed (Master). I’ve connected the SDA and SCL of each board (pins 12 and 13 on the Seed) and recently added pullup resistors (4.7kohm) to 5v.
The hardware.PrintLine(“RX Result: %d”, rx_result); in the following code of the Daisy returns 1 so there’s an error in the communication but can’t figure out what it is…
My Daisy code :
#include "daisy_seed.h"
// Use the daisy namespace to prevent having to type
// daisy:: before all libdaisy functions
using namespace daisy;
// Declare a DaisySeed object called hardware
DaisySeed hardware;
I2CHandle::Config i2c_conf;
int main(void)
{
hardware.Configure();
hardware.Init();
i2c_conf.periph = I2CHandle::Config::Peripheral::I2C_1;
i2c_conf.speed = I2CHandle::Config::Speed::I2C_100KHZ;
i2c_conf.mode = I2CHandle::Config::Mode::I2C_MASTER;
i2c_conf.pin_config.scl = {DSY_GPIOB, 8};
i2c_conf.pin_config.sda = {DSY_GPIOB, 9};
I2CHandle i2c;
i2c.Init(i2c_conf);
hardware.StartLog(true);
uint8_t rxdata=0x00;
for (;;)
{
I2CHandle::Result rx_result = i2c.ReceiveBlocking(0xA1, &rxdata, 3, 1000);
hardware.PrintLine("RX Result: %d", rx_result);
if (rxdata==0){
hardware.PrintLine("Released");
}
else {
hardware.PrintLine("Pressed !");
}
hardware.DelayMs(100);
}
}
I’m not using UART because I’m already using it to receive data from a MIDI port, but yes it could have saved me some time…
I’ve digged into it and programmed both boards with the Arduino IDE. I’m testing the connection with 2 basic I2C codes, one for slave (Arduino Mega) and one for master (Daisy Seed).
I tried to replace the Seed with another Arduino (Uno), without changing anything else and the I2C communication works, so the problem doesn’t come from the code (do I have to specify more than the clock frequency when using Seed ?). For the I2C channels, I’ve also tried pullup resistor to 5v and to 3.3v : both do work with arduinos (even if their I2C is supposed to run on 5v) but still doesn’t work with the Seed…
Any help would be greatly appreciated, feel free to ask details.