OpenGround – Part 13 – switching from the st peripheral lib to libopencm3

Disclosure: This post may contain affiliate links, meaning I get a commission if you decide to make a purchase through my links, at no cost to you.

By | March 3, 2017

I just started to swap the hardware abstraction layer that runs the low level stuff on OpenGround. On modern 32 bit processors you usually get a small abstraction library from the manufacturer. This library maps complex commands such as initializing e.g. the SPI subsystem  to the underlaying low-level register access commands. For the stm32 series you can get a library for that from st, the so called st peripheral library. When I started with OpenGround this was the obvious choice as it came directly from the chip manufacturer. This library is documented to some extend, you find some examples from ST and there are other people on the web that share their experience. The bad thing is that it comes with a very strict license.

I recently stumbled upon libopencm3, an open and LGL licensed library that supports a variety of arm cortex based processors (STM32*, LPC, EFM32, …). It is a bit less documented as the st library but comes with a cleaner interface. It seems like is barely used for STM32F0 processors as we do but my porting progress looks quite good  so far. This library comes under the LGPL license so it can be legally and easy included into the OpenGround git. They also have a git repository so integration using a git submodule is a piece of cake.

So you might think why should one use that one? Well, it’s not that much less documented as the ST library but it comes with an opensource license which I really like. The interface looks even cleaner to me. When I had a look on how to add USB support (Joystick HID) the ST usb library looks quite bloated and to complicated for our simple use. On the other hand, the USB HID implementation of libopencm3 looks quite structured and clean. I must admit that I did not test the USB part of that library yet.

You can find my port under the opencm3 branch of OpenGround. I made some good progress, the following parts are working:

  • everything is ported to the lib
  • linking and basic chip setup is working
  • Screen works
  • ADC + DMA works
  • Buttons work
  • LEDs light up on my command 😉

The flash storage needs some tuning in the linker file and I got stuck at the I2C part for the touchscreen. But this was merely because I was running out of time today 😉

I will continue with that port, if I succeed I will completely switch to libopencm3. Maybe I will do the same in the future for OpenSky, we will see 🙂

7 thoughts on “OpenGround – Part 13 – switching from the st peripheral lib to libopencm3

  1. Harry

    Could you throw in elevon mixing? I also like the idea of the always with me tx, but I was thinking fpv fixed wing in the mountains, hiking up with a small wing and tossing it.

    Reply
  2. Ben

    I love your work mate! I recently got into the hobby and started doing all research and reading up on.. well everything.. .
    I stumbled upon your blog while doing research on the Turnigy Evolution (just ordered one). I really like it even though it has it’s fair share of shortcomings. I was wondering: the stock version of the Evolution only has battery telemetry feedback, with OpenGround would it (eventually) be possible to add other kinds of telemetry as well?
    Anyways, keep it up and i’ll be keeping an eye out for OpenGround!

    Reply
  3. Fernandez

    Hi Simon, you spend lots of efforts in writing a new Tx code hats up! But would it not be more efficient to have a small aftermarket board to run f.i. deviation + 4in1 module to put into a flysky hook up the display and sticks switches ? F.I flysky i6s or Turnigy evolution? As there is big community around all could profit from each other developments? Or maybe a default small arm development board?

    Reply
    1. fishpepper Post author

      The i6s is really nice hardware for that price. Good cpu board and nice form factor.

      Reply
  4. Ryan

    I’m watching your progress very closely! Great project, the i6s is a great multicopter radio!

    The GUI for OpenGround looks sick by the way!

    Reply
  5. Jacob

    Nice work mate! And I think having a full open license is a great thing. I just really hope you can use some of my work with USB HID joystick.

    Reply
    1. fishpepper Post author

      Yes most likely, the low level hal libraries are quite similar. Let’s hope the USB HID part is similar as well 😉

      Reply

Leave a Reply to fishpepper Cancel reply

Your email address will not be published. Required fields are marked *