Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get I2C communication to raspberry pi to work #303

Open
LordSyd opened this issue Apr 5, 2022 · 2 comments
Open

Cannot get I2C communication to raspberry pi to work #303

LordSyd opened this issue Apr 5, 2022 · 2 comments

Comments

@LordSyd
Copy link

LordSyd commented Apr 5, 2022

I tried connecting the RP using the following Arduino code:
`
#include <Wire.h>

void setup()
{
Wire.begin(11); // join i2c bus with address #11
Wire.onReceive(receiveEvent); // register event
Serial.begin(115200); // start serial for output
}

String msg = "";
boolean reset = false;
char current;
char previous;

void loop()
{

}

void receiveEvent(int howMany)
{
//msg = "";

while(Wire.available())
{
char current = Wire.read();
msg += current;
//Serial.println("current: " + String(current) + " pre: " + String(previous));
if(current == ';' && previous == ';'){
//Serial.println("c == 10");
//msg = "";
reset = true;
//break;
}
previous = current;
}

if(reset == true){
Serial.println(msg);
msg = "";
reset = false;
}

}`

On a standard Arduino, this works, but the opencr board does not get recognised as an i2c device. I looked at the libraries in the repository, trying to make sense of them, but I had to give up. Sadly this functionality is also not documented in the e-manual.
What methods and libraries do I need to use to establish an i2c connection with the board?

Regards,
Daniel

@ROBOTIS-Will
Copy link
Contributor

Hi @LordSyd
I'm sorry about the delayed response.
Did you have a chance to look at the thread below which is related to the hardware I2C implementation
#107

@LordSyd
Copy link
Author

LordSyd commented Apr 12, 2022

Hi,
I found a few threads regarding low-level I2c implementations. Not sure if I stumbled upon this one. The problem is that the project I am working on has a tight deadline, so playing around with native Stm32 functions is not an option. I know a bit about programming the MC directly, but not enough to get a working connection in the allotted timeframe (around two weeks from the time of writing and many other things to take care of). I hoped I could use the library just as I would with a "normal" Arduino, but that does not seem to be the case.

To be clear, is I2C support even something that should be available? Because I was a little bit confused about not finding any reference to it in the official e-manual.

If messing around with HAL or the Lower Layer of the Stm32 MC is the only way to get I2C working, I will have to move on for now and use an Arduino.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants