Hello ,

I am using 4-wire SPI communication (SOMI, SIMO, CLK, CS[0]). i connected the sensor with arduino Uno (following this tutorial https://github.com/explorelabs/Explore-Labs-3D-Gyroscope-L3GD20H-Breakout-Board/blob/master/Arduino%20Code/SPI-Explore-Labs-3D-Gyroscope-L3GD20H-Breakout-Board/SPI-Explore-Labs-3D-Gyroscope-L3GD20H-Breakout-Board.ino ) and i received the correct device id (0xFFFFFFD7) with x,y,z data.

i am trying to read (Device ID) L3GD20H using hercules Micro-controller (TM570LS1224)
but i keep receiving 0xFFFF as Device ID (TI experts said my configurations and code works as expected no issues from MCU side)

In Halcogen
I enabled the SPI1 driver , check clock polarity (1)and clock phase (0) and SPI frequency (baudrate 312.5 KHZ) . ,In SPI1 Port i enabled each (SIMO[0],SOMI[0],CLK and (SCS[0] ) As spi(functional) )and then i generated the code .

here is my main code.
any help with this sensor

#include "sys_common.h"

#include "spi.h"

uint16 TX_Data_Master[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
uint16 RX_Data_Master[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

int main(void)

    spiDAT1_t dataconfig1_t;

    // The chip select signal is held continuously active during several consecutive data word transfers
    dataconfig1_t.CS_HOLD = TRUE;

    /* After a transaction, WDELAY of the corresponding data format will be loaded into the delay counter.
     No transaction will be performed until the WDELAY counter overflows. The SPISCS pins will be deactivated
     for at least (WDELAY + 2) * VCLK_Period duration. */
    dataconfig1_t.WDEL    = TRUE;

    // Data word format 0 is selected
    dataconfig1_t.DFSEL   = SPI_FMT_0;

    // Chip select number. CSNR defines the chip-select that will be activated during the data transfer (0 in our case).
    dataconfig1_t.CSNR    = 0xFE;


       // for (i = 0; i < DELAY_VALUE; i++);
        TX_Data_Master[0] =0x80|0x0F;  /* USER CODE END */
        spiTransmitAndReceiveData(spiREG1, &dataconfig1_t, 2, TX_Data_Master, RX_Data_Master);

       printf("Device ID = %x\r\n",RX_Data_Master[1]);



Are you using one of our L3GD20H carrier boards? If so, which one?

It sounds like the L3GD20H sensor is working, since you were able to get the correct device address with your Arduino Uno. If you have access to an logic analyzer or oscilloscope, you can look at all the SPI lines and see if there is a difference in the signals between the Arduino Uno and the Hercules microcontroller.

- Amanda