Skip to main content
Visitor II
December 8, 2017
Solved

Receive only 0xFF from LIS3DSH

  • December 8, 2017
  • 3 replies
  • 2572 views
Posted on December 08, 2017 at 06:00

 

 

The original post was too long to process during our migration. Please click on the attachment to read the original post.
    This topic has been closed for replies.
    Best answer by Nijat Hasanov
    Posted on December 11, 2017 at 19:30

    Oh!! Finally, the problem is solved just by 3 lines of code:

    SPI_send(0x25,0x90);

    SPI_send(0x23,0x01);

    SPI_send(0x20,0x67);

    I think 'force reboot'ing solved my problem(first bit of register 0x25). Now it is working even if I comment it out. Strange. Really, I changed nothing else. I have been writing to 0x20 and 0x23 registers but I had not seen anything about 0x25.

    3 replies

    ST Employee
    December 9, 2017
    Posted on December 09, 2017 at 10:39

    Are you able to capture the SPI communication usign scope or logic analyzer?

    It would be very handy to see what os going on the SPI bus.
    Visitor II
    December 9, 2017
    Posted on December 09, 2017 at 18:45

    Hi! I tried to see MOSI and MISO signals. There was something on MOSI line, but MISO line was like pulled up high. I think that's why it gives me ones. Could it be some problem of HAL libraries? I can't seem to find HAL version example for LIS3DSH.

    ST Employee
    December 11, 2017
    Posted on December 11, 2017 at 15:20

    To solve the problem I recommend to investigate more the SPI communication with scope or logic analyzer. First you must be sure that the microcontroler sends correctly the data, only than the slave (sensor) can reply. You can check the most simple read who_am_i procedure, the sensor must respond to this request. If you will share the communication I can check it.

    I suppose the problem is in the SPI configuration or in HW connection.

    Nijat HasanovAuthorAnswer
    Visitor II
    December 11, 2017
    Posted on December 11, 2017 at 19:30

    Oh!! Finally, the problem is solved just by 3 lines of code:

    SPI_send(0x25,0x90);

    SPI_send(0x23,0x01);

    SPI_send(0x20,0x67);

    I think 'force reboot'ing solved my problem(first bit of register 0x25). Now it is working even if I comment it out. Strange. Really, I changed nothing else. I have been writing to 0x20 and 0x23 registers but I had not seen anything about 0x25.

    Visitor II
    May 9, 2018
    Posted on May 09, 2018 at 23:44

    I also have the same problem however my communication with Lis3dsh works fine all the time and suddenly the SPI communication stucks i tried to send reset cmd use the solution given above but still have the same issue until i un-power and power the Lis3dsh again. i tried to slower the clk (i use 2M i tried 1M and even 500K) but no response i always read 0xff if i do not use the hardware reset by unpower and power the Lis3dsh.

    Is there any explication about this issue or is there any software solution for it.I will be thankful if someone help me.

    Visitor II
    May 16, 2018
    Posted on May 16, 2018 at 10:44

    Could someone help me please still have the same issue