It's a beautiful day here in Minneapolis, so Danica (my wonderful and extremely project-accomodating wife) and I took a bike ride to check out the near-flood-stage Mississippi:
Yup, they've opened the locks up at St Anthony Falls to let the excess water through. Wettest year on record to date. Glad I live on a hill. In any case, a great outdoor morning made me feel better about spending the afternoon putzing around with my ARM Cortex M4 discovery boards.
I'm following these instructions to set up my development environment; I'm somewhat new to things like 'toolchains' and so forth, so it took a bit of trial and error. The PDF tutorial they linked has good instructions on building the toolchain and getting STLINK up and running. I'll try to outline my steps in detail here.
- I installed a GNU toolchain that supports ARM Cortex chips. The linked file was no longer supported but forwarded me here, and I followed their instructions for Ubuntu 12.04 LTS. Everything seemed to work properly.
- I installed STLINK, the open source program used to debug the discovery board. Pretty easy; clone the git repo and build it out using a few commands. I must have had the required dependencies already because it seemed to work properly!
- I grabbed the latest version of libopencm3, an open-source firmware library for various ARM M-series microcontrollers. Installation was easy with their instructions.
- I started up the GDB server, which is used to interact with the connected STM32 board. My board is an F4, so I've got ST-link/V2. Pretty easy to get this going, as documented in the *.pdf linked above:
- Use the ST-link/V2 command to start the GDB server: ./st-util
- It didn't work! Maybe I don't have the dependencies installed for STLINK; I need libusb-1.0, which I obtained by following the instructions here.
- Man, that didn't work either. libusb wanted libudev. 'sudo apt-get install libudev-dev' fixed that problem.
- Now I can install libusb. Good.
- Still getting the following error: WARN src/stlink-usb.c: Error -3 opening ST-Link/V2 device 003:012. hmmmmmm...
- It didn't work! Maybe I don't have the dependencies installed for STLINK; I need libusb-1.0, which I obtained by following the instructions here.
- Use the ST-link/V2 command to start the GDB server: ./st-util
- Okay, screw it, I'm going to start over and follow the instructions on the blog post also linked in the instructions. We'll see if that works.
- Seems like a great guide. It's a bit old, so a few things have changed:
- The name of the rules files is a bit different. I used v2, since I've got an F board.
- The full discovery board example project zip link isn't right anymore. I found a mirror here.
- 'flash' doesn't exist anymore; now it's 'st-flash'. I followed the instructions in Beneden's comment from 10/9/2013 and changed a few things. AND IT WORKED! I ACTUALLY LOADED A PROGRAM ONTO THE BOARD THAT WORKS!!!
- Seems like a great guide. It's a bit old, so a few things have changed:
- Next up: back to the original instruction sheet. Time to grab ChibiOS/RT and get the demo program online.
- I copied the STM discovery board code into a new directory and modified main.c as suggested on the site, then loaded it onto the board by typing 'make' then 'st-flash write build/ch.bin 0x08000000'. To quote stlink: "Flash written and verified! Jolly good!"
The blurry picture above doesn't look like much, but that blue LED is blinking according to the ChibiOS/RT program detailed on the Recursive Labs blog post. That's a huge hurdle crossed off the list: now that the dev environment works I can start writing code, and ChibiOS/RT has a hardware abstraction layer that will make syntax MUCH SIMPLER.
WOOOOOOOO! Next up: Interfacing to the IMU and figuring out Kalman filtering!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.