-
Notifications
You must be signed in to change notification settings - Fork 1
STM32F4 Discovery Board Getting started
Here, you find the description how to start with the STM32F4 Discovery Board (STM32-DB)
The STM32-DB is an experimental board to do low level C-programming for reading sensors or controlling motors.
To start, you need to update your virtual machine with another cross-compiler:
-
Start your virtual machine and go to your home folder
-
Download the other cross-compiler (not necessary for the Ubuntu 14.04 virtual machine!):
wget http://www.cse.chalmers.se/~bergerc/msv/gcc-arm-none-eabi-4_7-2013q1-20130313-linux.tar.bz2
-
Unpack the file to /opt (not necessary for the Ubuntu 14.04 virtual machine!):
sudo tar -xvjf gcc-arm-none-eabi-4_7-2013q1-20130313-linux.tar.bz2 -C /opt
-
Update your GitHub working directory to get the ChibiOS realtime operating system.
-
Build the STM32-DB host tools:
cd <Your MSV-source tree>/sources/STM32F4/host-tools
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=/opt/msv/<Your group directory> ..
make install
-
Make sure that the USB rule file "49-stlinkv2.rules" has been installed to /etc/udev/rules.d. If not, copy the file from
<Your MSV-source tree>/sources/STM32F4/host-tools/qstlink2/udev/
to/etc/udev/rules.d
manually. -
Restart your virtual machine.
-
Build the STM32-DB Software using your newly installed cross-compiler:
cd <Your MSV-source tree>/sources/STM32F4/embedded/ChibiOS/DiscoveryBoard
PATH=$PATH:/opt/gcc-arm-none-eabi-4_7-2013q1/bin && make
On the Ubuntu 14.04 virtual machine:
`make`
-
If the build succeeded, you can flash the binary ch.bin in directory build to the STM32-DB. Therefore, you need to connect the STM32-DB with the USB-mini cable to your computer (the mini connector is the larger one on the STM32-DB). If you are using the virtual machine, you need to re-route the USB connection to the virtual machine by clicking on the blue USB button in the status bar of VirtualBox and select "STMicroelectronics STM32 STLink [100]" so it is checked. Now, the you should see the device file "/dev/stlinkv2_2".
-
Now, you can open the flash utility:
/opt/msv/<Your group directory>/bin/qstlink2
-
Click on "Connect" and you should get some messages like:
ST Link V2 found!
Status: Core Running
-
Click on "Send" and select the file ch.bin from the directory
<Your MSV-source tree>/sources/STM32F4/embedded/ChibiOS/DiscoveryBoard/build
-
Confirm the flash process by clicking on "Yes". The flashing process takes some time and the LEDs show flash between red and green.
-
Once the flashing process has completed, you should see four LEDs between the two buttons shining depending on the way you move the board around. These LEDs visualize the data from the accelerometer.
-
To "log in" to your STM32-DB, connect a USB-micro cable to the other USB connector.
17.a If you are running on a native Linux installation, you should see now a device /dev/ttyACM0
showing up.
If the above doesn't work, disconnect the device from your computer, cd in to /dev/ and list the directory cd /dev/ && ls
. Connect the device again and perform ls
. Now you can see updated list. Go through the list to see newly added device address (Probably /dev/ttyACMx, x= 0,1,2,3,...)
17.b If you are running in the virtual machine, you need to re-route the new USB device in Virtual Box or connect from your host system to the board. On Mac, you simply start a terminal and run
screen /dev/tty.usbmodem251
-
The device number on your machine might differ. Once you have connected successfully to the board, you should see the prompt "ChibiOS/RT Shell".
-
You can now type commands like "info" to get information about the running software.
-
If you type "pa" you see the values from the accelerometer that are used to dim the LEDs.
Hint: If you are using Mac OS X for your development, it will claim the USB Virtual COM Port automatically and thus, you won't be able to connect to it using the virtual machine. To prevent Mac OS X from claiming the device, do the following:
sudo kextunload -b com.apple.driver.AppleUSBCDC
sudo kextunload -b com.apple.driver.AppleUSBCDCACMControl
sudo kextunload -b com.apple.driver.AppleUSBCDCACMData
sudo kextunload -b com.apple.driver.AppleUSBCDCECMData
Then, you can redirect the USB Virtual COM Port into the virtual machine.