-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
I2C messages are sent too close to each other #1176
Comments
@Prototyx Are those signals the pwm outputs? It looks like those signals are on the same pin. If those are the PWM outputs then you need to send the steering and throttle pwm on two different pins. I would be surprised if it was an I2c issue; it's a serial protocol that can handle bus contention. What error are you seeing? Are you seeing it in the donkeycar console or the arduino serial console? Can you copy the output here? PS: the car looks really cool; very compact. Nice. |
@Prototyx what type of Arduino are you using? Is it 5v or 3.3v? How are you handling the logic-level conversion between the RPi and the Arduino if the Arduino is 5v? The reason I ask is that it is my understanding that some logic-level conversions can 'round' the edges of a logic level change and so could possibly affect I2c communication. |
Hello, The arduino is 5V (it's Atmega328p, same as uno board). I am using a logic level converter between the Arduino and RPi designed for I2C communications (PCA9306).
When I put the scope on I2C lines, in fast mode the frequency is not stable at all, I think the RPi has to deal with others tasks with higher priority and decreases the frequency, maybe it is for this reason that it causes a lot of errors, because the arduino is not able to manage this frequency variation. Anyway, after decreasing the I2C speed, I was able to drive the car without problem, and I did my first autonomous session. I was very impressed ! |
@Prototyx Thank you for detailing the resolution. I'm closing this issue. |
Hello,
I made a donkey car with a RPi 4 (CM4) connected to an Arduino UNO via I2C.
Basically my Arduino UNO is replacing the PCA9685. I have my ESC and my servo attached to some PWM pins on my arduino.
It seems that there is one thread for the steering, and another one for the throttle. And each thread send their command via I2C too close to each other.
Issue : I2C messages too close to each other
Is there a way to not have both thread sending I2C commands at the same time ? I think PCA9685 can manage 2 I2C messages very close to each other but on for my Uno it seems very difficult. I have a lot of I/O Errors. When I do the calibration for only the steering or throttle it works well.
Solution :
Thanks for your help.
The text was updated successfully, but these errors were encountered: