Skip to content

Added LIS3DSH demo example#101

Open
marcorussi wants to merge 3 commits intolibopencm3:masterfrom
marcorussi:master
Open

Added LIS3DSH demo example#101
marcorussi wants to merge 3 commits intolibopencm3:masterfrom
marcorussi:master

Conversation

@marcorussi
Copy link
Copy Markdown

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are only used once, it seems more appropriate (to me at least) to put this sort of thing inside your functions for communicating with the device, rather than separating them out here. Try and refrain from macros for the sake of it, the compiler is generally very good at inlining things where suitable.

@karlp
Copy link
Copy Markdown
Member

karlp commented Sep 12, 2015

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.

@marcorussi
Copy link
Copy Markdown
Author

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
Copy link
Copy Markdown
Author

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

@marcorussi
Copy link
Copy Markdown
Author

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
Copy link
Copy Markdown
Author

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

@marcorussi
Copy link
Copy Markdown
Author

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

@karlp
Copy link
Copy Markdown
Member

karlp commented Feb 11, 2016

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

@marcorussi
Copy link
Copy Markdown
Author

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

@ludoo14
Copy link
Copy Markdown

ludoo14 commented Aug 12, 2016

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

@chrisyeung333
Copy link
Copy Markdown

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?

@marcorussi
Copy link
Copy Markdown
Author

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 notifications@github.com 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
#101 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AM5vg8gC9wujpD8Z2kiItrYpVEBqFUkFks5q8j8wgaJpZM4F8RQI
.

@chrisyeung333
Copy link
Copy Markdown

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

@marcorussi
Copy link
Copy Markdown
Author

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 notifications@github.com 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
#101 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AM5vg8-T001-0wzJ2AJRraH1Knvtxd1hks5q8krIgaJpZM4F8RQI
.

@karlp
Copy link
Copy Markdown
Member

karlp commented Nov 10, 2016

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

@chrisyeung333
Copy link
Copy Markdown

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

@marcorussi
Copy link
Copy Markdown
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants