Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Repeat communication problem

  1. #1
    Junior Member
    Join Date
    Mar 2021
    Posts
    3

    Repeat communication problem

    Hello,

    I have a system that is supposed to read angles from encoders. Attached to each encoder is one slave who is supposed to send the information of the angle to the master. At the beginning of the work 3 slaves were connected to the master and my code worked well. But now I connected a total of 9 slaves to it and I had a communication problem between the master and the slaves. I do not understand why in the beginning the code worked and there was communication between the components and now not.
    When I open the Arduino print window sometimes there is Error Wire 2 and sometimes there is Error Wire 4 - each time there is a different note and sometimes it manages to get information from some of the slaves. When the errors appear in the value of the angle there is 0.
    - I checked all the slaves and they all manage to read the angle from the encoder connected to them.
    - I checked the master and it works, both it and the slaves get enough electrical voltage.
    - There is no shortage in the system, and all hardware components work.

    I use teensy 3.2 and 3.5.

    Code Master's - I added 3 more slave addresses to this code work (9 in total): https://github.com/shmulike/robot_sn...ead_master.ino
    Code for the slave: https://github.com/shmulike/robot_sn...read_slave.ino


    I would be very happy if you could help me understand what the problem is!

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,230
    What are these "encoders"? Link?

    Seems to be I2C?
    How many pullup resistors are there, and what value?
    How long is the connection in sum?

  3. #3
    Junior Member
    Join Date
    Mar 2021
    Posts
    3
    1. We use a magnetic encoder, its purpose was to read the angle between different vertebrae.
    2. Yes it I2C , and Im wrong the master and slaves are all teesny3.2.
    3.The master has 2 external pullups, each 4.7K Ohm one for SLA one for SDA, connected to 3.3V.
    4. 1 master + 9 slaves The distance between each slave is about 160 mm

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,769
    So the 10 i2c devices are all Teensys? Are they on multiple i2c busses? They have unique addresses for their bus?

    Typical pullup values noted for the 3.3V Teensy is 2.2K?

    What does i2c SCANNER example show from the Master?

  5. #5
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,230
    The distance (9*160mm with connectors) is quite high.
    Yes, using lower resitance pullups is a good idea. You could go even lower - mabe 1k?
    If that still does not work, I'd try a lower I2C speed.

  6. #6
    Junior Member
    Join Date
    Mar 2021
    Posts
    3
    When i upload the basic-scan, nothing happens.
    I see in the comments that i need to "Pull the control pin low to initiate the scan"
    What does it mean?

    I'm using 4.7K Ohm as mentioned here: https://www.pjrc.com/teensy/td_libs_Wire.html

    I also tried to connect only 1 slave in distance of ~160 mm
    Same result, I get error #2 from the Wire.getError() function
    Last edited by stavavr; 03-11-2021 at 09:20 AM. Reason: add more answer

  7. #7
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,230
    Quote Originally Posted by stavavr View Post
    When i upload the basic-scan, nothing happens.
    I see in the comments that i need to "Pull the control pin low to initiate the scan"
    What does it mean?
    Connect the pin with GND.

    Quote Originally Posted by stavavr View Post
    I'm using 4.7K Ohm as mentioned here: https://www.pjrc.com/teensy/td_libs_Wire.html
    Yes, please read our posts

    Quote Originally Posted by stavavr View Post
    I also tried to connect only 1 slave in distance of ~160 mm
    Same result, I get error #2 from the Wire.getError() function
    I don't understand. In post#1 you wrote, it works with 3 slaves.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •