Lopy SPI



  • Hi.
    I am communicating through SPI an adc with integrated SPI with a lopy. My problem is that I receive the correct data most of the time but not all the time, so I used a logical analyzer to see the data frame sent by the lopy, and when I saw it I realized that sometimes the clock gets out of control. Is there any way to make sure that this doesn't happen?

    SPI config:
    from machine import SPI
    spi = SPI(0, mode=SPI.MASTER, baudrate=4000000, polarity=0, phase=1, firstbit=SPI.MSB)
    rbuf = bytearray(4)
    spi.write_readinto(bytes([0xD5, 0x8B, 0xD5, 0x8B]), rbuf)

    Images of the logic analyzer (three data frames):
    The data frame above is the clock and the bottom one is the MOSI. As you can see in the third image, the clock isn't correct in the second and third byte.
    0_1516040839006_1.JPG
    0_1516040942659_2.JPG
    0_1516040946514_3.JPG
    Thank you and sorry about my english.


Log in to reply
 

Pycom on Twitter