I'm toying with pigpio and I can't find some informations:
1) I'm currently using a arduino uno to send bytes (as master) to a Rpi3 as slave, I currently use BCM2 as SDA (A4 on Uno) and BCM3 as SDL(A5 on Uno) on the Rpi.
It seems odd to use the I2C master GPIOs to perform I2C-slave, but I couldn't find any relevant information. Am I using the "good" GPIOs ?
2) If I'm, I can't receive anything from the Uno here are both sources:
#include <Wire.h>
void setup()
{
Wire.begin(); // join i2c bus as master
}
char str[17];
int x = 0;
void loop()
{
sprintf(str, "Message %7d\n", x);
if (++x > 9999999) x=0;
Wire.beginTransmission(0x0A);
Wire.write(str);
Wire.endTransmission();
delay(100);
}
Arduino code is pretty much standard.
On the Rpi:
#include <pigpio.h>
#include <iostream>
#include <atomic>
#include <signal.h>
//g++ -Wall -pthread -o test test.cpp -lpigpio -lrt
std::atomic<bool> Quit = ATOMIC_VAR_INIT(false);
void quit(int sig)
{
Quit = true; //will require handler quit too
}
int main(int argc, char** argv)
{
signal(SIGINT, quit);
bsc_xfer_t xfer;
gpioInitialise();
xfer.control = (0x0A<<16) | 0x305;
int status = bscXfer(&xfer);
if (status >= 0)
{
xfer.rxCnt = 0;
while(!Quit)
{
status = bscXfer(&xfer);
if(status)
{
if (xfer.rxCnt > 0)
{
std::cout << std::endl << xfer.rxBuf;
memset( xfer.rxBuf, '\0', sizeof(char)*BSC_FIFO_SIZE );
}
else
{
//std::cout<<"\n No datas";
}
}
}
}
else
{
std::cout<<"\nInit status error.\n"<<std::flush;
}
return status;
}
Any help on what Im doing wrong will be appreciated.
Edit: following Joan's answer I did swap the SDA & SCL to [ GPIO 18 & 19][1], and it works perfectly, solved fast