libopencm3-examples icon indicating copy to clipboard operation
libopencm3-examples copied to clipboard

Added LIS3DSH demo example

Open marcorussi opened this issue 8 years ago • 16 comments

Hi, please consider to add a simple demo example of the LIS3DSH accelerometer for STM32F4 Discovery board. Instructions and demo behaviour could be found in the README file. Thanks.

marcorussi avatar Sep 12 '15 14:09 marcorussi

ah, damnit, I had some more here.

please run "make stylecheck" at least against your own submission here please. It's also generally considered nicer to use a common prefix for all the register addresses for a peripheral, not multiple prefixes.

I've not looked at this in any real detail though yet.

karlp avatar Sep 12 '15 15:09 karlp

Hi, regarding the macros, I separated them outside for legibility reasons and to allow people to use them in their own projects where maybe they need to call them several times.

marcorussi avatar Sep 12 '15 17:09 marcorussi

Regarding to stylecheck, I'm going to fix all the resulting issues. Thanks

marcorussi avatar Sep 12 '15 17:09 marcorussi

Hi, I fixed all coding style issues but there 6 which I don't understand what is the problem. Can you please help? Thanks.

marcorussi avatar Sep 12 '15 18:09 marcorussi

Hi, I fixed the remaining style code issues. It should be fine now. Please let me know. Thanks ;)

marcorussi avatar Sep 14 '15 23:09 marcorussi

Hi, is there any problem to merge this request? Thanks.

marcorussi avatar Feb 11 '16 13:02 marcorussi

nothing obvious, mostly just time a the moment. It's still in the queue :)

karlp avatar Feb 11 '16 23:02 karlp

Ah Ok, I understand :) . No prob, I just needed to know if I had to change anything. I'll wait for this, Thanks.

marcorussi avatar Feb 11 '16 23:02 marcorussi

hey , i search the PCB of LIS3DSH ... do you have a article from This compenent thank you

ludoo14 avatar Aug 12 '16 07:08 ludoo14

Hi, after copying the proyect folder in the same folder where libopencm3 is located, I run make , and there is no problem, but when I run make flash I get this error :

FLASH LIS3DSH_demo.hex make: *** [LIS3DSH_demo.flash] Error 127

I'm new at this, could you help me?

chrisyeung333 avatar Nov 09 '16 21:11 chrisyeung333

Hi, is there any other error description? Anyway, make flash implies that you can successfully flash a device through a programmer. Can you confirm that?

Marco.

On 9 November 2016 at 21:46, chrisyeung333 [email protected] wrote:

Hi, after copying the proyect folder in the same folder where libopencm3 is located, I run make , and there is no problem, but when I run make flash I get this error :

FLASH LIS3DSH_demo.hex make: *** [LIS3DSH_demo.flash] Error 127

I'm new at this, could you help me?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/libopencm3/libopencm3-examples/pull/101#issuecomment-259535660, or mute the thread https://github.com/notifications/unsubscribe-auth/AM5vg8gC9wujpD8Z2kiItrYpVEBqFUkFks5q8j8wgaJpZM4F8RQI .

marcorussi avatar Nov 09 '16 22:11 marcorussi

I am running ubuntu 14.04, i have been able to flash the STM32F4 before with another code through the console.

chrisyeung333 avatar Nov 09 '16 22:11 chrisyeung333

OK, open the makefile and be sure that make flash command is compatible with your environment. If you can flash a device in another way, you can build only and then flash it as you can.

On 9 November 2016 at 22:35, chrisyeung333 [email protected] wrote:

I am running ubuntu 14.04, i have been able to flash the STM32F4 before with another code through the console.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/libopencm3/libopencm3-examples/pull/101#issuecomment-259546771, or mute the thread https://github.com/notifications/unsubscribe-auth/AM5vg8-T001-0wzJ2AJRraH1Knvtxd1hks5q8krIgaJpZM4F8RQI .

marcorussi avatar Nov 09 '16 23:11 marcorussi

make V=1 will show the command line used too.

karlp avatar Nov 10 '16 09:11 karlp

Hi again, sorry for replying so late, I have been very busy, I really appreciate your help. I am able to flash the device, but once I flash it nothing happens, am I supposed to change the code in some way? I changed some of the code without really knowing what it was and I got it to turn on some LED's but in a really strange way, I move the device around and the LED's turn on almost randomly, this is the part I changed (once again I don't really know what this does) ` /* LED threshold value in mg / #define LED_TH_MG (10) / 1000mg (1G) */

/* ---------------- Local Macros ----------------- */

/* set read single command. Attention: command must be 0x3F at most / #define SET_READ_SINGLE_CMD(x) 0x3F//(x | 0x3F) / set read multiple command. Attention: command must be 0x3F at most / #define SET_READ_MULTI_CMD(x) 0x3F//(x | 0xC0) / set write single command. Attention: command must be 0x3F at most / #define SET_WRITE_SINGLE_CMD(x) 0x3F//(x & (~(0x3F))) / set write multiple command. Attention: command must be 0x3F at most */ #define SET_WRITE_MULTI_CMD(x) 0x3F//(x & (~(0x80))
x |= 0x40) `

This is my flash.sh file #!/bin/sh make bin st-flash erase st-flash write *.bin 0x8000000

this is my makefile `BINARY = main LDSCRIPT = ../common/stm32f4-discovery.ld

SOURCES = $(filter-out $(BINARY).c, $(wildcard *.c)) OBJS = $(SOURCES:.c=.o)

LIBNAME = opencm3_stm32f4 DEFS += -DSTM32F4

FP_FLAGS ?= -mfloat-abi=hard -mfpu=fpv4-sp-d16 ARCH_FLAGS = -mthumb -mcpu=cortex-m4 $(FP_FLAGS)

include ../common/Makefile.rules`

Thank You

chrisyeung333 avatar Nov 23 '16 15:11 chrisyeung333

Hello, I am very sorry and embarrassed about replying months later but I completely missed your reply last year. I don't know if you are still considering to merge the example but in that case, you should move the board with an edge facing down and see the equivalent LED turning on (the nearest LED to the edge). If the board is positioned up side down then all LEDs go OFF while leaving the board face up then all LEDs go ON. Let me know and sorry again. Cheers.

marcorussi avatar Jun 13 '17 16:06 marcorussi