Ok a couple of things.
Includes of the form #include <libopencm3/stm32/gpio.h>
are the correct form, the variant (F2) in this case is added by the
-DSTM32F2 which shows up in Makefile.include, or you can put it
in your CFLAGS. The .elf target should pick up the correct library from
either the toolchain dir or your copy of Libopencm3 if you're building in
the examples tree.
I would suggest you do initialization in the following order:
1) Clock
2) GPIOs
3) Alternate Function peripherals (usually the UART)
4) timers
5) interrupts.
In your interrupt service routine you might consider gpio_toggle(GPIOC,
GPIO3); which if you look at the implementation uses the setbit/resetbit
address rather than the output data register directly. As written the
read/modify write might have unintended side effects (I'm not sure here,
just noting that other folks tend to use the BSRR/BRRR sort of form. As it
works in polled mode this is likely a red herring.
Reading your code which is pretty straight forward I'm wondering if you've
managed to enable another interrupt that fires and lands in the 'blocking
interrupt' loop (this is the default for ISRs) I rebuilt the code with GPIO
toggle in the blocking loop so that I could put my scope on that pin and if
it got hit the scope would show it.
As for utilities, as you can see from my github repos I've been adding
convienience functions, which work on the f4 but aren't really very
applicable to the other members of the family necessarily. I think the devs
are open to adding new features but it was only recently that things
started moving again.
Lastly, Clive in the Google+ group is an ST Micro field engineer type and
may have additional insights.
--Chuck
On Mon, Jan 13, 2014 at 8:12 PM, skeezix <[email protected]> wrote:
>
> FWIW, I'm still bewildered with regards to the many configu
> options during build and deployment, so I thought I'd "cheat" and perhaps
> this is the issue (or leading to issues..)
>
> - Given libopencm3-examples, I just navigated down to
> stm32/f2/jobygps/miniblink and editted miniblink.c
> - my build script just goes to top level of -examples and runs
> "make V=1", which effects a built
> - my deploy script is hacked up a bit so that it has the 'proper'
> (guessing) board/target type information
>
> This implies that the ld-script uses is appropriate, for example;
> I'm not really 'with it' regarding this yet; I imagine its using this one:
> /* Linker script for Olimex STM32-H103 (STM32F103RBT6, 128K flash, 20K
> RAM). */
>
> /* Define memory regions. */
> MEMORY
> {
> rom (rx) : ORIGIN = 0x08000000, LENGTH = 256K
> ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
> }
>
> /* Include the common ld script. */
> INCLUDE libopencm3_stm32f2.ld
>
> I'm obviously not using an Olimex board.. just a STM32 F205RE
> right on a breadboard, by itself. I think the addresses are right, but the
> rom-size and ram-size are likely incorrect.. I'll fix them.
>
> The deploy script is:
> openocd -f interface/stlink-v2.cfg \
> -f target/stm32f2x_stlink.cfg \
> -c "init" -c "reset init" \
> -c "stm32f2x mass_erase 0" \
> -c "flash write_image miniblink.hex" \
> -c "reset" \
> -c "shutdown" $(NULL)
>
> This is cribbed from existing openocd step, but I modified to use
> the stlink target and interface. I'm not sure if I set the right ones, but
> it seems right. At least, it works..
>
> .. where works means I can blink a LED using a polling timer, but
> not an isr one ;)
>
> Is it possible I'm not including appropriate ISR tables into the
> binary, or other subtlties?
>
> jeff
>
> On Mon, 13 Jan 2014, skeezix wrote:
>
> #
> # Here is the code in question:
> #
> # http://pastebin.com/xTxn5829
> #
> # To summarize -- just polling the timer works fine; but my attempt
> # at enabling the ISR isn't working, so I'm probably missing a register
> # setting somewhere :)
> #
> # If you fine people come up with anything, let me know ;) (theres
> # about a 90% chance I'll figure it out as soon as I hit 'Send', of course.
> # I'm good at foot-in-mouth-mailing-list.)
> #
> # libopencm3 seems good at supplying wrappers for the CMSIS level -
> # so its a good HAL library - but perhaps it could use another layer of
> # convenience functions (though finding the right granularity that doesn't
> # hide the flexiblity, may be impossible. So maybe as-is, with examples, is
> # the way to go, and I need to figure it out and supply an example for this
> # topic :)
> #
> # jeff
> #
> # On Mon, 13 Jan 2014, Jeff Mitchell wrote:
> #
> # #
> # # I've got 3 or 4 different attempts all fragmented together, but I can
> appreciate not being given the whole picture :) Many ways to achieve
> similar goals :)
> # #
> # # I'll fiddle some more after kids go to bed and see if I can come up
> with something; otherwise I'll split them apart and post the whole attempt
> in a cohesive fashion.
> # #
> # # Will also check F4 .. F2 has limited examples :)
> # #
> # # Thanks guys,
> # #
> # # Jeff
> # #
> # # --
> # # Have you played Atari today?
> # #
> # # > On Jan 13, 2014, at 5:53 PM, Chuck McManis <[email protected]>
> wrote:
> # # >
> # # > Hi Jeff,
> # # >
> # # > I'm having a really hard time reading your source code as fragments.
> # # > For example in your timer2_setup there is a "#endif" in the middle of
> # # > it, where is the preceding #if? Did the timer code get compiled in?
> # # >
> # # > It looks like you've got the basic concepts there but it is hard to
> tell.
> # # >
> # # > I only see the 'jobygps' systems as an F2 example system in the
> # # > libopencm3-examples repo but if you look at some of the other
> examples
> # # > they might show you something you missed?
> # # >
> # # > Consider setting up a free github account and pushing a copy of your
> # # > source there so that it can be read in its entirety, then it will be
> # # > easier to talk about things that might help.
> # #
> # #
> ------------------------------------------------------------------------------
> # # CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> # # Learn Why More Businesses Are Choosing CenturyLink Cloud For
> # # Critical Workloads, Development Environments & Everything In Between.
> # # Get a Quote or Start a Free Trial Today.
> # #
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> # # _______________________________________________
> # # libopencm3-devel mailing list
> # # [email protected]
> # # https://lists.sourceforge.net/lists/listinfo/libopencm3-devel
> # #
> #
> # --
> # If everyone would put barbecue sauce on their food, there would be no
> war.
> #
> #
> ------------------------------------------------------------------------------
> # CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> # Learn Why More Businesses Are Choosing CenturyLink Cloud For
> # Critical Workloads, Development Environments & Everything In Between.
> # Get a Quote or Start a Free Trial Today.
> #
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> # _______________________________________________
> # libopencm3-devel mailing list
> # [email protected]
> # https://lists.sourceforge.net/lists/listinfo/libopencm3-devel
> #
>
> --
> If everyone would put barbecue sauce on their food, there would be no war.
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> libopencm3-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libopencm3-devel
>
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
libopencm3-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libopencm3-devel