I am trying to get the Pi to receive data from an ESC via I2C. It works like this:

  • Pi sends series of 4 bytes to speed controller to initiate connection
  • ESC responds with a series of bytes
  • Pi sends a prompt for more data (2 bytes) and the ESC responds
  • Repeat step 3 until the bytes sent from the ESC match a certain "end pattern"
  • End of communication.

    The documentation for the ESC states

esc documentation

Running I2Cdetect with (only) the speed controller connected shows a device at 0x50 and 0x51. I can use i2c_write_block_data() to send the "request" sentence to either 0x50 or 0x51 without error, but if I then use any i2c read function I get an IO error.

I'm assuming the Pi is the I2C master here, but as I2C is a master/slave bus I don't really understand what it means by "taking turns" on the bus. Can I set/verify the Raspi's I2C address as 127?

Am I misunderstanding something fundamental here?

(This is quite a specific application, so I don't want to overload with information but if I can clarify something I will)

  • 1
    The Pi acts as an I2C bus master. It can not switch itself to a slave on an ad hoc basis. Could you link to the ESC documentation you paraphrased above? – joan Jul 11 '16 at 13:57
  • I agree with joan. You can't switch the bus back and forth from master to slave mode. It's a/the master, period. Normal I2C communication does alternate (it's simplex) but because the master writes to and reads from the slave, not because they switch roles. – goldilocks Jul 11 '16 at 13:58
  • I'm not 100% if the information is proprietary as I've been unable to find it publically on the net - but I have expanded the quote to hopefully all include all of the relevant section. – T Kilney Jul 11 '16 at 14:21
  • That doesn't help me I'm afraid. Most datasheets (I've seen) show the detailed I2C messages sent and received in terms of start/stop conditions, address bytes, data bytes, acks, and nacks, Surely more must be available? – joan Jul 11 '16 at 14:28
  • That's as detailed as it gets. I'm not even sure if the 250 should be sent as 0x250 or 250 integer. It sounds like it's not just me that's confused so I'll try and contact the original manufacturer – T Kilney Jul 11 '16 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.