-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
example for SPI doesn't work. #12
Comments
@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: 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)
@mianqi2016<https://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 GitHub<#12 (comment)>, or unsubscribe<https://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 GitHub<#12 (comment)>, or unsubscribe<https://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 GitHub<#12 (comment)>, or unsubscribe<https://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 GitHub<#12 (comment)>, or unsubscribe<https://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 GitHub<#12 (comment)>, or unsubscribe<https://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 Detecting libraries used... Using library ADXL345_WE at version 2.2.5 in folder: /home/moonriverzf/Arduino/libraries/ADXL345_WE avrdude: Version 6.3-20190619
avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e950f (probably m328p) 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 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. |
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? |
1 similar comment
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. |
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. |
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: |
I tried on Arduino UNO, it was always prompt: ADXL345 not connected.
The text was updated successfully, but these errors were encountered: