Monday 16 February 2015

Coocox IDE, STM32F103C8T6, USBSerial

For USB CDC serial communication I used the stm32f103 oscilloscope source from Miniscope. As I do not want to implement ADC, DMA, buzzer I have to delete these lines, header and source files from the code. The Author used the Coocox IDE, which is an Eclipse based IDE and it is easy to use, but I had to use version 1.7.8, because the very fresh 2.0 version was not working for me. The following code sends some text and waits commands from the PC. The commands are very simple, the onboard led is lighted when '1' character is received and the led is turned off when '0' character is received. Please note that the original ST library based CDC_Send_DATA function is called, which is copied back to the hw_config.c The Coocox builds the binary file, which can be flashed directly with the serial adapter and stm32flash utility. My linux kernel sends some error message so after some search I found the solution: Could not grab port (tty/ttyACM0)” To communicate via the USB serial interface I use screen: The whole project can be downloaded from here

Saturday 14 February 2015

STM32FxCxT6 Board V4.02 programming

When I decided to have some experiment with STM32 boards I bought a STM32 board from ebay that is not maple compatible. It is a nice board with a lot of pins, an onboard led and some jumpers. I really want to find a way to use this board. I tried to flash the maple bootloader without success. After some googling I find a good description for STM32F100 MCU at http://www.cs.indiana.edu/~geobrown/book.pdf. This book contains valuable information for Cortex M3 development and I thought F103 is not so different from STM32F100. I follow the books: as the Author wrote I downloaded GNU toolchain (not from sourcery), the STM32 firmware library, and his project template from github: As the STM32F103 MCU has more SRAM I modified the linker script: And I also modified the Makefile.common to point to my GNU ARM installation directory and to my STM32 library directory: TOOLROOT and LIBROOT path. I also defined a 'binary' make option to generate a result.bin file that can be flashed with stm32flash tool. For the referenced board I could not find any proper schematic, so I used a multimeter to find out which pin is connected to onboard blue led. The led is connected to PortC13. My frist project was to blinking that onboard led,so I copied the Demo project and created a Blink project: I modified the main.c: Do not forget to add the following line to Blink project Makefile, after the OBJS= line: To create binary: I am using a cheap USB->serial adapter from eBay to flash the board. The following picture contains all details. I connected only GND, TX, RX pins from the adapter to the board. Be aware that the adapter TXD pin is connected to board's TX1 pin, and RXD pin is connected to board RX1 pin.
To upload the binary, power the board via the USB, connect the adapter and set one of the green jumper to power up the BT0 to 3v3 (move the secound top-left green jumper right with one position, next to the blue wire). Use the stm32flash tool to upload the binary. After upload set the modified jumper to 'normal' position (as you can seen in the picture) and reboot the board. The led should be blinking at the given rate.

Saturday 31 January 2015

Mapple Mini + SSD1306 oled display