Closed emha69 closed 6 months ago
Hello @emha69,
Thank you for the report. Can you please share more details, such as:
With regards.
No, I am using custom board in two different MCU type variants : STM32L562 and STM32L4P5. Both MCUs run (more or less) the same code, and the reset effect is (mostly) same.
Besides that, it is the original STM code, except few functions added (e.g. abstractions for register functions as shown in my example).
MCU config files attached.
Hello,
In fact, there is an example BSP MotionSensor_demo
with STML562E-DK board. I have tested and work fine even with the soft reset, I didn't get an error with the function LSM6DSO_Probe() or LSM6DSO_ReadID().
For information, the example based on I2C not SPI.
I will try to analyze and test with your config.
With regards.
Reading similar reports around the internet, the problem with reading out the ID initially seems to be related to the SPI. Using the chip in high-performance streaming mode requires use of SPI. So, I am looking forward, to see what you find out with SPI.
Hello @emha69,
Unfortunately, the component LSM6DSO on the STM32L562-DK board is driven by I²C, even the connections. Sorry from my side, I cannot test your project or reproduce the issue with SPI.
I found some links related to this topic in our community, maybe it can help you to solve your problem: Link1 Link2
Otherwise, your issue it's related to the product rather than Embedded software. So, you can submit a post to the ST Community.
Since this issue is not directly related to the STM32Cube firmware but rather to our ecosystem, please allow me then to close this thread. Thank you for your comprehension.
With regards.
Hello @KRASTM,
I understand, that you are not willing to change the code, although I think there are ST boards out there that are using SPI with LSM6DSO, since this problem is IMHO not directly related to the STML5 series. However, it is also fine with me, if we have this issue and workaround noted here, if somebody encounters the same problem.
When the hosting CPU is soft reset (e.g. thru HAL_NVIC_SystemReset()) the LSM6DSO_0_Probe() function in lsm6dso.c will fail in the standard 4-wire SPI configuration, since the LSM6DSO_ReadID() in most cases returns 0 (zero) for the device ID.
Working code fix, that has been successfully tested:
In the function int32_t LSM6DSO_RegisterBusIO() the following code should be added, after checking, if the bus is in the 3-wire SPI configuration.
The functions DISABLE_I3C and CHIP RESET used above have been added to the lsm6dso.c
Maybe the same is the case in 3-wire configuration, but I was not able to test it.