Page 1 of 1
IIS3DWB read spi help!
Posted: Mon Mar 24, 2025 8:58 am
by seokgi
Hello?
I want to read data from PIC24FJ512GA606 and IIS3DWB via SPI communication.
The manual says that if I write 0x12 0x01 0x10 0x05 0x0F in order, the value 0x7B should be returned.
When reading data from the sensor, it says that I should give the value of (Sensor Address | 0x08).
However, in the logic analyzer, only the value 0xFF is read without any change.
What is wrong with my project?
Thank you.
Re: IIS3DWB read spi help!
Posted: Mon Mar 24, 2025 9:59 am
by stefan.erni
Hi Seokgi
0x12 0x01 is reset
0x10 0x05 is turn on
0x0F is read who i am
Just do this one time
and after send 0x0F add a read byte
You can use SPI not in softwaremode
Mod program:
Re: IIS3DWB read spi help!
Posted: Mon Mar 24, 2025 11:42 am
by seokgi
tried to run the project you helped me with, but it doesn't work.
And when I use hardware channels, the clock and MISO, CS don't work.
Is there another way?
Re: IIS3DWB read spi help!
Posted: Mon Mar 24, 2025 12:21 pm
by stefan.erni
Hi Seokgi
then I would switch back to software mode.
I only read the sensor once, maybe you can add a read for the senor to the interrupt
Re: IIS3DWB read spi help!
Posted: Mon Mar 24, 2025 10:16 pm
by seokgi
The value does not change even if I give an interrupt signal.
The sensor does not generate an interrupt signal.
Thank you for your interest.
Re: IIS3DWB read spi help!
Posted: Tue Mar 25, 2025 7:28 am
by stefan.erni
Hi Seokgi
Can you measure a clock signal on the B5 with this program?
Can you also measure a few signals on the Mosi signal?
If so, try to change the clockphase, clockpolar, samplepoint.
Also switch off the USE Auto CS

- 2025-03-25_08-27-25.PNG (78.6 KiB) Viewed 2771 times

- 2025-03-25_08-17-40.PNG (32.07 KiB) Viewed 2771 times
Re: IIS3DWB read spi help!
Posted: Tue Mar 25, 2025 8:27 am
by seokgi
CS signal is not generated and Logger does not recognize it as SPI.
I tried changing other options
Re: IIS3DWB read spi help!
Posted: Tue Mar 25, 2025 8:32 am
by seokgi
Among the sensors supported by FC10, which 3-axis acceleration sensor can be used without any problems?
Re: IIS3DWB read spi help!
Posted: Mon Mar 31, 2025 12:42 am
by seokgi
I changed the MCU and sensor to complete this project.
MCU: PIC16F18326
Sensor: LIS3DHTR
But it doesn't run.
When I compile the MCU, the following error occurs.
"C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC\PIC_CAL_String.c

: error: (1250) could not find space (256 bytes) for variable _tempSub"
And when I downgrade PIC\PIC_CAL_String.c from version 6 to version 5, it compiles.
And LIS3DTR uses the library (I2C) supported by FC10, but it doesn't work.
Can you show me an example?
I followed the manual for the sensor for SPI, but the SCLK, MOSI, and CS signals work fine, but the MISO data doesn't come out.
Please help me.
Thank you.