ADXL345_WE
ADXL345_WE copied to clipboard
example for SPI doesn't work.
I tried on Arduino UNO, it was always prompt: ADXL345 not connected.
@mianqi2016 , in a separate e-mail you have told me that you are using Arduino Pin 10 as CS Pin. Have you adjusted my example sketch accordingly? You need to either change: #define CS_PIN 5 to #define CS_PIN 10
Or you take the sketch as is and connect pin 5 to CS.
Before I changed the pin, it prompted: 16:49:21.412 -> Accelerometer Test 16:49:21.459 -> 16:49:21.459 -> Ooops, no ADXL345 detected ... Check your wiring!
After changed it, it prompted as the attachment - all data were ZERO.
I have thought maybe my module doesn't work properly, I bought 2 more expensive ones and tried, it was the same. I found all the tutorials on net used IIC not SPI, is it possible due to ADXL345 itself?
发件人: Wolfgang (Wolle) Ewald @.> 发送时间: 2023年11月10日 11:20 收件人: wollewald/ADXL345_WE @.> 抄送: Mian Qi @.>; Mention @.> 主题: Re: [wollewald/ADXL345_WE] example for SPI doesn't work. (Issue #12)
@mianqi2016https://github.com/mianqi2016 , in a separate e-mail you have told me that you are using Arduino Pin 10 as CS Pin. Have you adjusted my example sketch accordingly? You need to either change: #define CS_PIN 5 to #define CS_PIN 10
Or you take the sketch as is and connect pin 5 to CS.
― Reply to this email directly, view it on GitHubhttps://github.com/wollewald/ADXL345_WE/issues/12#issuecomment-1805541374, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFPCOARJCEVYDTHTFS4KBZDYDYEZPAVCNFSM6AAAAAA7FM2T46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBVGU2DCMZXGQ. You are receiving this because you were mentioned.Message ID: @.***>
Of course there might be different modules out there. But in theory they all should be able to use SPI. My modules look lke one which you find in my blog:
https://wolles-elektronikkiste.de/en/adxl345-the-universal-accelerometer-part-2
What is the label on the IC? And can you provide a photo of your circuit maybe I see something!?
I can only say it works on my side which makes finding the issue difficult
发件人: Wolfgang (Wolle) Ewald @.> 发送时间: 2023年11月22日 13:09 收件人: wollewald/ADXL345_WE @.> 抄送: Mian Qi @.>; Mention @.> 主题: Re: [wollewald/ADXL345_WE] example for SPI doesn't work. (Issue #12)
Of course there might be different modules out there. But in theory they all should be able to use SPI. My modules look lke one which you find in my blog:
https://wolles-elektronikkiste.de/en/adxl345-the-universal-accelerometer-part-2
What is the label on the IC? And can you provide a photo of your circuit maybe I see something!?
Iran only say it works on my side which makes finding the issue difficult
― Reply to this email directly, view it on GitHubhttps://github.com/wollewald/ADXL345_WE/issues/12#issuecomment-1822742176, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFPCOAWMSYXVYWNI3NOD2ITYFX2PXAVCNFSM6AAAAAA7FM2T46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRSG42DEMJXGY. You are receiving this because you were mentioned.Message ID: @.***>
?? Something went wrong with your last comment.
Yes, it's just the copy of the notification of my last comment. I was not sure why you uploaded this as a comment here on GitHub. I thought maybe something has gone lost. But not so important.
Still I would be interested to know the label on the ADXL345 IC on your module and also a photo of your circuit might be helpful, since I have no explanation why it doesen't work. If there would be a general issue with SPI reading you can be sure there would be lots of issues here on GitHub and comments on my blog. Therefore it must be something specific which is different on your side. And I am keen to find out what this could. I like problem solving!
The label: 345B #021 7554 PHIL
The circuit: ADXL345 module Arduino UNO 5v 5v Gnd Gnd CS D10 SCL D13 SDA D11 SDO D12
发件人: Wolfgang (Wolle) Ewald @.> 发送时间: 2023年11月25日 9:59 收件人: wollewald/ADXL345_WE @.> 抄送: Mian Qi @.>; Mention @.> 主题: Re: [wollewald/ADXL345_WE] example for SPI doesn't work. (Issue #12)
Yes, it's just the copy of the notification of my last comment. I was not sure why you uploaded this as a comment here on GitHub. I thought maybe something has gone lost. But not so important.
Still I would be interested to know the label on the ADXL345 IC on your module and also a photo of your circuit might be helpful, since I have no explanation why it doesen't work. If there would be a general issue with SPI reading you can be sure there would be lots of issues here on GitHub and comments on my blog. Therefore it must be something specific which is different on your side. And I am keen to find out what this could. I like problem solving!
— Reply to this email directly, view it on GitHubhttps://github.com/wollewald/ADXL345_WE/issues/12#issuecomment-1826269434, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFPCOARN42AXGUXNS4UDSQLYGG6OVAVCNFSM6AAAAAA7FM2T46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRWGI3DSNBTGQ. You are receiving this because you were mentioned.Message ID: @.***>
I didn't know github now synchronozes between it and MS mailbox before, sorry, I deleted the copied comment.
发件人: Wolfgang (Wolle) Ewald @.> 发送时间: 2023年11月25日 9:59 收件人: wollewald/ADXL345_WE @.> 抄送: Mian Qi @.>; Mention @.> 主题: Re: [wollewald/ADXL345_WE] example for SPI doesn't work. (Issue #12)
Yes, it's just the copy of the notification of my last comment. I was not sure why you uploaded this as a comment here on GitHub. I thought maybe something has gone lost. But not so important.
Still I would be interested to know the label on the ADXL345 IC on your module and also a photo of your circuit might be helpful, since I have no explanation why it doesen't work. If there would be a general issue with SPI reading you can be sure there would be lots of issues here on GitHub and comments on my blog. Therefore it must be something specific which is different on your side. And I am keen to find out what this could. I like problem solving!
― Reply to this email directly, view it on GitHubhttps://github.com/wollewald/ADXL345_WE/issues/12#issuecomment-1826269434, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFPCOARN42AXGUXNS4UDSQLYGG6OVAVCNFSM6AAAAAA7FM2T46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRWGI3DSNBTGQ. You are receiving this because you were mentioned.Message ID: @.***>
I didn't know github now synchronozes between it and MS mailbox, sorry, I deleted the copied comment.
发件人: Wolfgang (Wolle) Ewald @.> 发送时间: 2023年11月25日 9:59 收件人: wollewald/ADXL345_WE @.> 抄送: Mian Qi @.>; Mention @.> 主题: Re: [wollewald/ADXL345_WE] example for SPI doesn't work. (Issue #12)
Yes, it's just the copy of the notification of my last comment. I was not sure why you uploaded this as a comment here on GitHub. I thought maybe something has gone lost. But not so important.
Still I would be interested to know the label on the ADXL345 IC on your module and also a photo of your circuit might be helpful, since I have no explanation why it doesen't work. If there would be a general issue with SPI reading you can be sure there would be lots of issues here on GitHub and comments on my blog. Therefore it must be something specific which is different on your side. And I am keen to find out what this could. I like problem solving!
― Reply to this email directly, view it on GitHubhttps://github.com/wollewald/ADXL345_WE/issues/12#issuecomment-1826269434, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFPCOARN42AXGUXNS4UDSQLYGG6OVAVCNFSM6AAAAAA7FM2T46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRWGI3DSNBTGQ. You are receiving this because you were mentioned.Message ID: @.***>
Still a miracle. "345B" is the correct label. Basically what you and I do can't be so different. I have tried it again and it works fine. Here's a photo of my test circuit:
In the example sketch I have only changed the CS pin from 5 to 10. As a result I see this:
So, all good. Since you tried more than one module we can also exclude this to be the problem. Have checked the cables?
What else you could do is to try another library. I tested this Sparkfun library:
https://github.com/sparkfun/SparkFun_ADXL345_Arduino_Library
and this example:
Example: SparkFun_ADXL345_Example
It worked out of the box without any changes to my circuit. After few seconds you should see "Inactivity" on your monitor. If you want to see the x,y,z values you need to uncomment some lines.
The other thing you could do is show what your Arduino "says" during compiling and upload. Maybe I can see something there. To get the full information you could go into File -> Preferences and apply the following settings:
This could tell me if there's e.g. any interaction with another library.
`FQBN: arduino:avr:uno Using board 'uno' from platform in folder: /home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6 Using core 'arduino' from platform in folder: /home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6
Detecting libraries used... /home/moonriverzf/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/sketch/ADXL345_SPI_basic_data.ino.cpp -o /dev/null Alternatives for ADXL345_WE.h: [[email protected]] ResolveLibrary(ADXL345_WE.h) -> candidates: [[email protected]] /home/moonriverzf/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/moonriverzf/Arduino/libraries/ADXL345_WE/src /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/sketch/ADXL345_SPI_basic_data.ino.cpp -o /dev/null Alternatives for Wire.h: [[email protected]] ResolveLibrary(Wire.h) -> candidates: [[email protected]] /home/moonriverzf/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/moonriverzf/Arduino/libraries/ADXL345_WE/src -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/sketch/ADXL345_SPI_basic_data.ino.cpp -o /dev/null Alternatives for SPI.h: [[email protected]] ResolveLibrary(SPI.h) -> candidates: [[email protected]] /home/moonriverzf/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/moonriverzf/Arduino/libraries/ADXL345_WE/src -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/SPI/src /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/sketch/ADXL345_SPI_basic_data.ino.cpp -o /dev/null Using cached library dependencies for file: /home/moonriverzf/Arduino/libraries/ADXL345_WE/src/ADXL345_WE.cpp Using cached library dependencies for file: /home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/Wire.cpp Using cached library dependencies for file: /home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/utility/twi.c Using cached library dependencies for file: /home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/SPI/src/SPI.cpp Generating function prototypes... /home/moonriverzf/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/moonriverzf/Arduino/libraries/ADXL345_WE/src -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/SPI/src /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/sketch/ADXL345_SPI_basic_data.ino.cpp -o /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/preproc/ctags_target_for_gcc_minus_e.cpp /home/moonriverzf/.arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/preproc/ctags_target_for_gcc_minus_e.cpp Compiling sketch... /home/moonriverzf/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/moonriverzf/Arduino/libraries/ADXL345_WE/src -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src -I/home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/SPI/src /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/sketch/ADXL345_SPI_basic_data.ino.cpp -o /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/sketch/ADXL345_SPI_basic_data.ino.cpp.o Compiling libraries... Compiling library "ADXL345_WE" Using previously compiled file: /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/libraries/ADXL345_WE/ADXL345_WE.cpp.o Compiling library "Wire" Using previously compiled file: /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/libraries/Wire/utility/twi.c.o Using previously compiled file: /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/libraries/Wire/Wire.cpp.o Compiling library "SPI" Using previously compiled file: /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/libraries/SPI/SPI.cpp.o Compiling core... Using precompiled core: /tmp/arduino/cores/arduino_avr_uno_d19ae04455812a0c91928c14c9496ad0/core.a Linking everything together... /home/moonriverzf/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/ADXL345_SPI_basic_data.ino.elf /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/sketch/ADXL345_SPI_basic_data.ino.cpp.o /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/libraries/ADXL345_WE/ADXL345_WE.cpp.o /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/libraries/Wire/Wire.cpp.o /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/libraries/Wire/utility/twi.c.o /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/libraries/SPI/SPI.cpp.o /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/../../cores/arduino_avr_uno_d19ae04455812a0c91928c14c9496ad0/core.a -L/tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44 -lm /home/moonriverzf/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/ADXL345_SPI_basic_data.ino.elf /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/ADXL345_SPI_basic_data.ino.eep /home/moonriverzf/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -R .eeprom /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/ADXL345_SPI_basic_data.ino.elf /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/ADXL345_SPI_basic_data.ino.hex
Using library ADXL345_WE at version 2.2.5 in folder: /home/moonriverzf/Arduino/libraries/ADXL345_WE Using library Wire at version 1.0 in folder: /home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire Using library SPI at version 1.0 in folder: /home/moonriverzf/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/SPI /home/moonriverzf/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-size -A /tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/ADXL345_SPI_basic_data.ino.elf Sketch uses 9714 bytes (30%) of program storage space. Maximum is 32256 bytes. Global variables use 724 bytes (35%) of dynamic memory, leaving 1324 bytes for local variables. Maximum is 2048 bytes. "/home/moonriverzf/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude" "-C/home/moonriverzf/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega328p -carduino "-P/dev/ttyACM0" -b115200 -D "-Uflash:w:/tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/ADXL345_SPI_basic_data.ino.hex:i"
avrdude: Version 6.3-20190619 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/home/moonriverzf/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
User configuration file is "/home/moonriverzf/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyACM0
Using Programmer : arduino
Overriding Baud Rate : 115200
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 4.4
Vtarget : 0.3 V
Varef : 0.3 V
Oscillator : 28.800 kHz
SCK period : 3.3 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e950f (probably m328p) avrdude: reading input file "/tmp/arduino/sketches/D83F640C345AB6B96BC52F5DAB2A3D44/ADXL345_SPI_basic_data.ino.hex" avrdude: writing flash (9714 bytes):
Writing | ################################################## | 100% 1.56s
avrdude: 9714 bytes of flash written
avrdude done. Thank you.`
There is something different: when I uploaded SparkFun_ADXL345_Example.ino, there is ...... *** TAP *** *** FREE FALL *** *** INACTIVITY *** *** ACTIVITY *** *** DOUBLE TAP *** *** TAP *** *** FREE FALL *** *** INACTIVITY *** *** ACTIVITY *** *** DOUBLE TAP *** *** TAP *** *** FREE FALL *** *** INACTIVITY *** *** ACTIVITY *** *** DOUBLE TAP *** *** TAP *** *** FREE FALL *** ......
flashing, it seems that there was interrupt all the way.
All the information that is displayed during compilation and upload looks OK. The relevant parts are identical with mine. The Sparkfun example should only give you *** INACTIVITY*** as long as the ADXL345 is not moved. Since two libs do not work the issue does not seem to be related to the code. I am running out of ideas what the problem could be other than a damaged ADXL345. I assume you have checked the wiring more than once. Do you have the chance to test another ADXL345 module, preferably from another supplier?
ok, I'll try it, your UNO and ADXL345 looks price lower than mine in my market here, maybe I was too caution to have bought the expensive one. :-)
I found a page here - https://electronics.stackexchange.com/questions/94573/getting-adxl345-accelerometer-to-work-over-spi-with-arduino-uno, it has a link - http://wei48221.blogspot.de/2015/06/how-to-use-adxl345-triple-axis.html, could you access it?
It was said "You should not be having any pullups for SPI communication.", while I saw also pullups on your module, why did it work properly?
It was said "You should not be having any pullups for SPI communication.", while I saw also pullups on your module, why did it work properly?
Hi @mianqi2016 , I can't tell you why my modules work. They just do. You have seen my wiring on the photo. And it works with my spi example sketch as is, apart from the CS pin change to 5. I think this kind of module is most common. If there would be a general problem, I think I would have seen more issues here on GitHub. So I have really no idea why it doesn't work on your side. It's difficult to solve a problem when I can't reproduce it.
Hi, I flipped through the datasheet and couldn't find a hint that pull-ups should not be used for SPI. Did you find it?
But I found another thing you could try. Maybe the SPI clock is too fast. You could change the speed from 8000000 to 5000000 here:
https://github.com/wollewald/ADXL345_WE/blob/main/src%2FADXL345_WE.cpp#L31
Not very optimistic that this will help since the sparkfun lib has implemented a clock rate of 5000000, and this lib also does not work, but it's done quickly and, therefore, worth a try.
I tested, this is my module wiring diagram, so I think it would only work in SPI 3-wire mode, how to use your library in this mode?
Sorry, the library does not support the SPI 3-Wire, and I do not intend to implement this mode in foreseeable time. The reason is that no one asked for this, although the lib is in place since 3 years. I need to prioritise my capacity. But I a always happy to have contributers!
Just to add: The problem is the SDO pin. Apart from that my module is module is comparable. SCL and SDA are pulled up with 4.7 kohm, CS is pulled up with 10 kohm. But SDO is pulled down 4.7 kohm on my module and on yours it's directly connected to GND via a 0 ohm resistor which is from my perspective a strange idea. I can't see any advantage in doing this. As I said I won't implement 3-Wire SPI or at least not in the near future. If you don't find a solution a pragmatic solution would be to remove R4 and add an external pull-down resistor. Then it should work. But of course it's on your own risk! Meanwhile I have found such a module that you are using. I have ordered it and will try this "hardware hack". It should arrive end of this week, then I will try and share my experience.
I have received the module which has SDO connected to GND. After removing the 0 ohm resistor R4 SPI worked. I have updated readme accordingly: https://github.com/wollewald/ADXL345_WE#if-spi-does-not-work