AnsweredAssumed Answered

ADXRS450 Initialization Error

Question asked by gomasio on Jul 9, 2012
Latest reply on Jul 11, 2012 by gomasio
Branched to a new discussion


I´m new to analog devices and I´m currently struggling trying to communicate from a ST32 microcontroller with ADXRS450.

When I send the first command (0x20000003), a 0x00000001 should come back as response according to the Datasheet, but I get some

non-sense like 0x5E0A4040.  I already checked with an oscilloscope that the signals are going back and forth (clk, mosi, miso, cs), and

in some way they communicate but I can't just get that "0x01" at the beginning, and needless to say, I cannot read registers from

the Gyro.  Any help will be appreciated! below my initialization routine.

thank you very much..



// Loop while DR register is not empty
  while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_TXE) == RESET);
    GPIOB->BSRR = 0x10000<<12;      // drive the CS line low    
  // Send byte through the SPI2 peripheral
  SPI_I2S_SendData(SPI2, 0x2000);
     while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_TXE) == RESET);
    SPI_I2S_SendData(SPI2, 0x0003);

    //Wait to receive a byte
  while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_RXNE) == RESET);
    rxUpper16Bits = SPI_I2S_ReceiveData(SPI2); 
    while (SPI_I2S_GetFlagStatus(SPI2, SPI_I2S_FLAG_RXNE) == RESET);
    rxLower16Bits = SPI_I2S_ReceiveData(SPI2); 
    GPIOB->BSRR = 0x1<<12;      // drive the CS line high
     // upper and lower 16 bits
    initResult = (rxUpper16Bits << 16) | rxLower16Bits;