UM6-LT SPI Troubles

Home Forums General Discussion UM6-LT SPI Troubles

This topic contains 5 replies, has 2 voices, and was last updated by  Manish Mittal 2 years, 8 months ago.

  • Author
    Posts
  • #821

    Eugene Katsevman

    Hello everybody!
    Not sure where to put it, since you don’t have support forum for the 6.
    I’m trying to connect old UM6-LT to my Arduino UNO with SPI bus. I do get some data, but it is complete gibberish for me. Please, have a look, and tell me what you think about it.

    CODE: SELECT ALL EXPAND
    #include <SPI.h>

    void setup() {
    Serial.begin(9600);

    SPI.begin();

    delay(100);
    }

    void loop() {

    delay(100);
    unsigned char data[6];
    readRegister(0, (unsigned char *)&data);
    for (int i = 0; i < 6; i ++ ){
    Serial.print(data[i]);
    Serial.print(‘ ‘);
    }
    Serial.println();
    }

    void readRegister(byte thisRegister, unsigned char * data) {

    unsigned char tosend[6] = {0,thisRegister,0,0,0,0};
    SPI.beginTransaction(SPISettings(340000, MSBFIRST, SPI_MODE0));
    digitalWrite(SS, LOW);
    delayMicroseconds(100);

    SPI.transfer(tosend, 6);
    for (int i = 0; i< 6; i++)
    data[i] = tosend[i];

    digitalWrite(SS, HIGH);
    SPI.endTransaction();

    }

    void writeRegister(byte thisRegister, byte thisValue) {

    }

    0 0 0 0 0 0
    126 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 8 15
    63 100 221 94 0 0
    0 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 0 0
    0 0 0 0 0 0
    0 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 0 0
    0 0 0 0 8 15
    63 100 221 94 0 0
    0 0 0 0 8 15
    126 0 0 0 8 64
    0 0 0 0 0 0
    0 0 0 0 0 0
    0 0 0 0 8 64
    0 0 0 0 0 0
    0 0 0 0 8 64
    0 0 0 0 8 15
    126 0 0 0 8 15
    126 0 0 0 0 0
    0 0 0 0 8 15
    126 0 0 0 8 15
    63 100 221 94 0 0
    0 0 0 0 0 0
    0 0 0 0 8 64
    0 0 0 0 8 15
    63 100 221 94 0 0

    clock is connected to pin 13, mosi is 11, miso is 12, ss is 10.
    If I change SPI_MODE to 1, output becomes stabilized like that
    0 128 64 128 85 0
    0 128 64 128 85 0
    0 128 64 128 85 0
    0 128 64 128 85 0
    0 128 64 128 85 0
    0 128 64 128 85 0
    0 128 64 128 85 0

  • #822

    Caleb
    Moderator

    What is the logic level of you Arduino Uno? (ie. 3.3V or 5V?)

  • #824

    Eugene Katsevman

    It is 5V, I think, for output pins, but 3.3v could be used and recognized for input.

  • #826

    Eugene Katsevman

    Hello?

  • #827

    Caleb
    Moderator

    Hi Eugene,

    The SPI pins on the UM7 are not 5V tolerant, and operating above their absolute maximum rating could damage them (See page 10 of the datasheet, here: http://www.chrobotics.com/docs/UM7_Datasheet.pdf). The pins do have built-in ESD protection, so they may be OK. But it’s possible that the protection circuitry was burnt out, since they aren’t designed to handle sustained overvoltage conditions.

    Also, make sure that the timing constraints described in the datasheet aren’t being violated. To wit,

    “The maximum SPI clock rate is 10 MHz. However the UM7 needs at least 5 microseconds between bytes to copy the next byte into the SPI transmit register. For high clock rates, this means that a delay must be added between consecutive bytes for correct operation”

  • #839

    Manish Mittal

    Hi Caleb,

    I would really appreciate if you could reply to this post:

    http://www.chrobotics.com/forums/topic/matlab-communication#post-838

    It’s really necessary for my thesis work. I couldn’t find any other way to contact you. Please reply as soon as you can.

    Regards,
    Manish Mittal
    University of Houston

You must be logged in to reply to this topic.