Discussion:
[libopencm3-devel] Potential SPI example for the STM32F4-Discovery board
Kendrick Shaw
2012-07-14 11:16:57 UTC
Permalink
Dear libopencm3 developers,

Would you be interested in an SPI example for the STM32F4-Discovery
board and/or
additional notes for new users?

We recently worked through the process of communicating with an SPI
device using
the Discovery board via USB. The libopencm3 library proved extremely
useful fo
r this process and we are grateful to have this as a resource.

The SPI examples provided for the f1 and f2 chips were very helpful, but
we stru
ggled with some of the f4 specific configuration. Using the STM32F4
reference d
ocumentation combined with these examples, we were eventually able to
get readin
gs from the accelerometer on the STM32F4-Discovery board via SPI.

As novices to embedded development, it also took us some time to get a
working b
uild and flash process, so we also documented this. Perhaps these notes
might be
useful to future developers new to the STM32F4-Discovery board.

If any of this sounds useful to include in the libopencm3 project, we'd
be happy
to contribute it. Also, we are happy to make changes for easier
upstream inclus
ion.

Our notes, examples, and Makefies currently reside on github:
https://github.com/ericherman/stm32f4-discovery-example

Thank you very much for all of the work on libopencm3,
Kendrick Shaw
Eric Herman
Jason Kotzin
2012-07-14 22:36:06 UTC
Permalink
Thanks so much for sharing. I can say these will help me, but I'm just a user.

Thanks again.

Sincerely,
Jason
Post by Kendrick Shaw
Dear libopencm3 developers,
Would you be interested in an SPI example for the STM32F4-Discovery
board and/or
additional notes for new users?
We recently worked through the process of communicating with an SPI
device using
the Discovery board via USB. The libopencm3 library proved extremely
useful fo
r this process and we are grateful to have this as a resource.
The SPI examples provided for the f1 and f2 chips were very helpful, but
we stru
ggled with some of the f4 specific configuration. Using the STM32F4
reference d
ocumentation combined with these examples, we were eventually able to
get readin
gs from the accelerometer on the STM32F4-Discovery board via SPI.
As novices to embedded development, it also took us some time to get a
working b
uild and flash process, so we also documented this. Perhaps these notes
might be
useful to future developers new to the STM32F4-Discovery board.
If any of this sounds useful to include in the libopencm3 project, we'd
be happy
to contribute it. Also, we are happy to make changes for easier
upstream inclus
ion.
https://github.com/ericherman/stm32f4-discovery-example
Thank you very much for all of the work on libopencm3,
Kendrick Shaw
Eric Herman
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
libopencm3-devel mailing list
https://lists.sourceforge.net/lists/listinfo/libopencm3-devel
Марко Краљевић
2012-07-16 00:40:23 UTC
Permalink
Post by Kendrick Shaw
Dear libopencm3 developers,
Would you be interested in an SPI example for the STM32F4-Discovery
board and/or
additional notes for new users?
We recently worked through the process of communicating with an SPI
device using
the Discovery board via USB. The libopencm3 library proved extremely
useful fo
r this process and we are grateful to have this as a resource.
The SPI examples provided for the f1 and f2 chips were very helpful, but
we stru
ggled with some of the f4 specific configuration. Using the STM32F4
reference d
ocumentation combined with these examples, we were eventually able to
get readin
gs from the accelerometer on the STM32F4-Discovery board via SPI.
As novices to embedded development, it also took us some time to get a
working b
uild and flash process, so we also documented this. Perhaps these notes
might be
useful to future developers new to the STM32F4-Discovery board.
If any of this sounds useful to include in the libopencm3 project, we'd
be happy
to contribute it. Also, we are happy to make changes for easier
upstream inclus
ion.
https://github.com/ericherman/stm32f4-discovery-example
Thank you very much for all of the work on libopencm3,
Kendrick Shaw
Eric Herman
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
libopencm3-devel mailing list
https://lists.sourceforge.net/lists/listinfo/libopencm3-devel
Thanks, I'll try this on my discovery soon!

I've been meaning to play with USB CDC anyway.

Kind of offtopic, but - is there a way to have the USB polling
interrupt driven? I suppose you can just stick usbpoll() in a timer
interrupt, but is there no HW usb interrupt?
Eric Herman
2012-07-16 21:25:46 UTC
Permalink
Post by Марко Краљевић
Thanks, I'll try this on my discovery soon!
Good luck, and if you discover something lacking in the notes or the
example, please let us know.
Post by Марко Краљевић
I've been meaning to play with USB CDC anyway.
Kind of offtopic, but - is there a way to have the USB polling
interrupt driven? I suppose you can just stick usbpoll() in a timer
interrupt, but is there no HW usb interrupt?
If you learn about this, please create an example.


-Eric
--
http://www.freesa.org/ -- mobile: +31 620719662
aim: ericigps -- skype: eric_herman -- jabber: ***@gmail.com
Gareth McMullin
2012-07-17 06:10:04 UTC
Permalink
Post by Eric Herman
Post by Марко Краљевић
Kind of offtopic, but - is there a way to have the USB polling
interrupt driven? I suppose you can just stick usbpoll() in a timer
interrupt, but is there no HW usb interrupt?
If you learn about this, please create an example.
This does work. You need to call usbd_poll from your hardware
interrupt handler.

On the F103 this is usb_lp_can_rx0_isr(), example:
https://github.com/gsmcmullin/blackmagic/blob/master/src/platforms/native/cdcacm.c

On the F4 this is otg_fs_isr(), example:
https://github.com/px4/px4_bootloader/blob/master/cdcacm.c

Cheers,
Gareth
--
Black Sphere Technologies Ltd.

Web: www.blacksphere.co.nz
Mobile: +64 27 777 2182
Tel: +64 9 478 8885
Skype: gareth.mcmullin
LinkedIn: http://nz.linkedin.com/in/gsmcmullin
Loading...