I2C Receive Blocking not working

Hi all,

I’m using a Patch SM that I want to receive data from a Teensy. I have tried this out via the Arduino IDE code and it works but under C++ it’s not working as a Receiver. I have changed the direction by having the Patch SM send data to the Teensy with no issues under C++. To me this proves the I2C init is working fine.

Here’s my code:-

#include "daisysp.h"
#include "daisy_patch_sm.h"
#include "daisy_core.h"

using namespace daisy;
using namespace patch_sm;

// Declare a DaisySeed object called hardware
DaisyPatchSM hardware;
static I2CHandle::Config i2c_conf;
I2CHandle i2c_handle;
I2CHandle::Result res;

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_SLAVE;
    i2c_conf.pin_config.scl = DaisyPatchSM::B7;
    i2c_conf.pin_config.sda = DaisyPatchSM::B8;

    hardware.StartLog(true); // start USB monitor
	
	// initialise the I2C
    if (i2c_handle.Init(i2c_conf) != I2CHandle::Result::OK)
	{
		hardware.PrintLine("i2c init FAILED!!!");
    }
	else
		hardware.PrintLine("i2c initialised.");


    uint8_t rx_buffer[1]; // Buffer to store received data
    uint8_t target_address = 0x40; // Example 7-bit I2C address

    while(1)
    {
        res = i2c_handle.ReceiveBlocking(target_address, rx_buffer, sizeof(rx_buffer), 100);
		if(res == I2CHandle::Result::OK)
        {
            hardware.Print("-%d-",rx_buffer[0]);
        }
        else
        {
			hardware.Print("*");
        }
    }
}

I get no compilation errors. The i2c reports that it initialised but all I get on the USB monitor is * which is the response for no data in the buffer.

Any leads would be greatly appreciated.

Steve.