read accelerometer(LIS302DL) on STM32F4DISCOVERY ? #613
Replies: 28 comments
-
Posted at 2014-01-15 by @gfwilliams What happens if you place your board is at an angle? Just a thought, but could it be that an SPI1.setup with the correct mosi/mosi/sck pins is required? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-01-15 by JumJum
BTW, testing same with SPI2 gives same result. Is there any way to recognize connected SPI devices ? 2ndBTW, dump returns this(and a lot of other lines) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-01-15 by @gfwilliams I'm not sure about B14 - it's because pin state is read from the device itself, so if it's set that way at reset (could be JTAG) that's what it thinks it should be. could you try shorting A6 to A7 and typing |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-01-15 by JumJum
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-01-15 by @gfwilliams Hmm. looks like an SPI problem on the F4 then. Sorry about that... Maybe you could try the 1v44 from the website? I did some SPI tweaks recently and I guess that could have somehow broken it. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-01-15 by JumJum I checked with 1v44 and it works fine. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-01-16 by @gfwilliams Thanks - yes, that's a huge help. 18th dec is a while ago. Just made a bug for it: espruino/Espruino#181 Just a thought, but does it work if you specify a baud rate?
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-01-16 by JumJum I'm sorry, but the answer is no |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-01-24 by user6350 I read the accelerometer on a STM32F4-DISCOVERY board. print("X= "+accx+" Y= "+accy+" Z= "+accz+" [16bit]" ); accv_start = setInterval(function () { print(getAcc()); }, 25); // 40 Hz As expected the timer behavior was pretty deterministic , having a minimum timer resolution of 1 ms. Are you going to improve the timer's resolution , I say in example to 10 us, in a near future ? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-01-24 by @gfwilliams The timer on the STM32F4 should be pretty good - to below 1us. The issue is the time that it takes to execute JavaScript code. Below 1ms, the JavaScript execution will be getting in the way of the timer. You can however measure times using setWatch very accurately, as no JS is involved until after the event. I'll be looking at increasing JS execution speed - there are many obvious ways to do it, but right now that is not actually a huge priority. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-13 by user6350 May it be that the new upgrade of version 1v51 introduced some bugs: with respect SPI and I2C programming ? This works fine : Added Number.toFixed test056) but this seems to haveSPI or I2C communications no longer working at leads on STm32F4Discovery. Now use jshardware's SPI for SD filesystems - more multi platform. Looking with a scope non signal is sent over the MOSI line, even clocks ar properly generated over the SCK line. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-13 by @gfwilliams Not sure I understand... So at that point, SPI stopped working - but it still sends clocks signals out? How did it stop working - did you stop being able to receive data, or stop being able to send data? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-14 by user6350 I don't want to bother you with stupid problems, but… I checked on two different boards, the behavior was the same. Is there a place in the code were I can easily and immediately check for ? Of course the Javascript code was the same. var avrx=0.0, avry=0.0; var t = setInterval(getAcc, 10); X= 10.342832 Y= -1.9707 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-14 by @gfwilliams Do you ever call On newer versions I guess it might not choose the right pins properly? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-15 by user6350 Same code. Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-15 by user6350 Excuse me I noticed the wrong usage of pin E3. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-15 by user6350 Not working.
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-15 by user6350
Nothing changed at all. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-15 by user6350 I looked at the C code of the two versions 1v41 and 1v51. I was not able to see any errors, but it is evident that something must now go wrong . |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-16 by user6350 STM32F4 DISCOVERY and Version 1v51
Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-16 by @gfwilliams Thanks for doing that testing... I'll have to see what's up. The new irq-based code works fine on the Espruino board so I doubt it's anything very deep rooted in that. The strange thing is that 0s are being returned and not 255. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-17 by user6350 Really an hard to be logically fixed BUG. Mah ??? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-19 by @gfwilliams Hmm. I don't get what changed. It's possible it's actually something on a more physical level - maybe the MISO pin is now not configured properly... I'll try and take a look at this... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-19 by @gfwilliams Right, I just fixed this... The fix will be in 1v51. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-19 by user6350 Thanks a lot for your help. Now the SPI works perfectly well, even I must check what you changed in order to have it working ( MISO pin ? ) and I immediately was able to get data from the accelerometer, but most important from the SD card. Espruino is really a good design. Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-04 by trandi Hi guys, Thank you for your help, |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-04 by trandi Sorry guys, I've actually found the fix. One really need to add the SPI1.setup() line, and by trial and error I've discovered that the 3 below parameters are the mandatory ones: SPI1.setup({sck:A5, miso:A6, mosi:A7}); With them it works all the time, without it only works some times... (which is really strange :) ) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-11-04 by @gfwilliams That is a strange one... I'd have thought it would have defaulted to the lowest numbered SPI1 pins (which are the ones you've used). By the way, you know that's shared with the MEMS sensor - so you have to be sure that it hasn't got enabled. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-01-14 by JumJum
Is there a way to read acceleromter on STM32F4Discovery ?
I tried the example on http://www.espruino.com/LIS302DL,
but it always returns 0 for accx and accy on my board.
Checked it with Espruino version 1.45
Beta Was this translation helpful? Give feedback.
All reactions