I2c repeated start question



  • i am getting funny values when i read back from registers i wrote.

    i am trying to get my accelerometer working and it is somehow kind of working .. i wonder if this could be a problem with micropython

    the datasheet says" The MMA8451Q expects repeated starts to be used to randomly read from specific registers."

    what does that mean? how can it affect normal micropython code?



  • Thanks

    looks like it is doing good now


  • Pybytes Beta

    But first you should send a command to start measuring.
    The data sheet should tell you which one.
    Command in my situation is:

    i2c.writeto(addr, bytearray(b'\x20\x24'))

  • Pybytes Beta

    @iotmaker The library is doing this correctly.
    You don't have to bother about ST, AK, SR, R, NAK and SP things.
    I'am not using the registers and using another I2C device.

    My code looks like this:

    data = i2c.readfrom(addr, 6)


  • 0_1487080788975_py1.png

    0_1487080799917_py2.png

    the datasheet has this diagram when you read a register the master send device address, register address and then a SR repeated start condition..

    i wonder if this is what the I2C library does in micropython?


  • Pybytes Beta

    @iotmaker Are you using clock stretching? This is not supported yet.

    Can you share your code? The information given is not enough to answer your question. 100th of options could cause the issue.


Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.