IIS3DWB read spi help!

For general Flowcode discussion that does not belong in the other sections.
Post Reply
seokgi
Posts: 207
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Flowcode v10 IIS3DWB read spi help!

Post 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.
Attachments
Sensor_SPI.fcfx
(26.36 KiB) Downloaded 23 times

stefan.erni
Valued Contributor
Posts: 1014
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 193 times
Been thanked: 217 times

Re: IIS3DWB read spi help!

Post 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:
Sensor_SPI.fcfx
(26.17 KiB) Downloaded 24 times

seokgi
Posts: 207
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Re: IIS3DWB read spi help!

Post 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?

stefan.erni
Valued Contributor
Posts: 1014
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 193 times
Been thanked: 217 times

Re: IIS3DWB read spi help!

Post 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

seokgi
Posts: 207
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Re: IIS3DWB read spi help!

Post 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.

stefan.erni
Valued Contributor
Posts: 1014
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 193 times
Been thanked: 217 times

Re: IIS3DWB read spi help!

Post 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
2025-03-25_08-27-25.PNG (78.6 KiB) Viewed 2169 times
2025-03-25_08-17-40.PNG
2025-03-25_08-17-40.PNG (32.07 KiB) Viewed 2169 times
Sensor_SPI_no_int.fcfx
(27.25 KiB) Downloaded 29 times

seokgi
Posts: 207
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Re: IIS3DWB read spi help!

Post by seokgi »

CS signal is not generated and Logger does not recognize it as SPI.

I tried changing other options

seokgi
Posts: 207
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Re: IIS3DWB read spi help!

Post by seokgi »

Among the sensors supported by FC10, which 3-axis acceleration sensor can be used without any problems?

seokgi
Posts: 207
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Re: IIS3DWB read spi help!

Post 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:1267:: 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.

Post Reply