32 bit Arm STM32 port

Post Reply
User avatar
djrm
Posts: 40
Joined: Wed Feb 15, 2012 11:32 pm
Location: North Yorkshire, UK

32 bit Arm STM32 port

Post by djrm »

I am interested in the porting MW onto a 32 bit architecture and see this has already been done successfully here by dongs on his own board.

With this in mind I have bought from ebay a STM32 board complete with 10 DOF sensos, see here: http://www.ebay.co.uk/itm/180847108943?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

For development work I am going to use the free toolchain CooCox IDE and its low cost JTAG board from here: http://www.coocox.org/Index.html

The hardware has not arrived yet so I have not got very far but I have managed to compile the test application which sends the IMU readings down the serial port so I think I'm on the way to success assuming the application works. Here is the schematic of the board it looks as if it will be suitable for a complete flight controller. http://dl.dropbox.com/u/2678548/Arm/STM32_IMU.pdf

Does anybody else find this interesting?
David.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: 32 bit Arm STM32 port

Post by copterrichie »

This should be very interesting! I too have looked at the STM32 boards that are not appearing on Ebay but just have not pulled the trigger on one yet.

Katch
Posts: 280
Joined: Thu Aug 04, 2011 1:44 pm

Re: 32 bit Arm STM32 port

Post by Katch »

I'm loitering around looking at STM32 offerings too - still haven't quite found the board I want.

I don't want onboard IMU to have a little flexibility in what sensors I use - I also haven't seen a board with good pinouts yet.

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: 32 bit Arm STM32 port

Post by timecop »

multiwii has been running on STM32 for a while.
http://code.google.com/p/afrodevices/so ... ight%2Fsrc
I agree with using some RTOS and look forward to your progress. Don't forget to keep the sores GPL if you reuse any of the driver stuff etc.

User avatar
djrm
Posts: 40
Joined: Wed Feb 15, 2012 11:32 pm
Location: North Yorkshire, UK

Re: 32 bit Arm STM32 port

Post by djrm »

Hello,
Thanks dongs for the info and useful reminder to keep the sources under the gpl.
The reason Ive used the Coocox IDE and gcc is to keep the project free rather than use one of the commercial compilers.
I was also attracted to the CoLink jtag adaptor also because of its low cost as well as because it can be apparentley be used with IAR.

Well, the STM32 board arrived this morning and tonight I got the chance to try it. I have not got the Jtag / debug adapter yet so I have had to use the STM32's bootloader with the FlashLoader software to reprogram the device memory. For some strange reason the supplied hitex source converted to work in the CooCox IDE worked first time I built it.

Next job will be to see if I can get any of the 32bit MWC port to work on my board, its looking promising so far.
The demo application reads all the i2c sensors on the board and outputs their data down the boards serial port, like this:
    HMC5883L:115`
    ADXL345:X=-0.093gY=-0.011gZ=+0.885g
    L3G4200D:X=+001Y=+000Z=-000
    BMP085:t=25.9`C p=099.944Kpa
There is a simple free RTOS available from CooCox, I'll have a look at this next.
David.

I have now successfully built MWC and run something on my new board.
The cli and buzzer are working at least, the driver for the gyro still needs work.
[list=]Available commands:
defaults reset to defaults and reboot
exit
feature list or -val or val
help
map mapping of rc channel order
mixer mixer name or list
save save and reboot
set name=value or blank for list
status show system status
version

# status
System Uptime: 66 seconds, Voltage: 10 * 0.1V (2S battery)
Detected sensors: ACC BARO MAG
Cycle Time: 1534, I2C Errors: 0

#
[/list]

The first step of a long journey I expect.

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: 32 bit Arm STM32 port

Post by timecop »

The demo application reads all the i2c sensors on the board and outputs their data down the boards serial port, like this:

Did that come with source? If so, is it available somewhere?

Good to see mwc32 port is working - it shouldn't be hard on similar hardware, just moving port definitions around.

User avatar
djrm
Posts: 40
Joined: Wed Feb 15, 2012 11:32 pm
Location: North Yorkshire, UK

Re: 32 bit Arm STM32 port

Post by djrm »

Hello dongs,

The demo application supplied with the board is not very inspiring, but here it is anyway: http://dl.dropbox.com/u/2678548/Arm/STM32_IMU_main.c If you know how to decode the chinese comments please let me know.

Last night I tried the latest MWC windows gui with the STM port and was pleased to see it working and that the RC inputs are also all working, I shall test the outputs later on today.

I think I'll have to change the baro code or add an interrupt wire on the board, funnily enough it seems to be working without this but the scaling is wrong. I have made a new driver for the gyro but it isnt working properly yet.

I am using this project as an opportunity to learn how to use git, so I'll be sharing the code on bitbucket as soon as I have created the repositry.

Best regards, David.

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: 32 bit Arm STM32 port

Post by timecop »

Just get rid of interrupt code. It's not needed, it's not even properly used by current code (it's only good for doing very closely spaced baro reads and using the interrupt as "its time to read more" flag). If you have enough delays (and mwc32 does) you can just keep reading after conversion is done.

Outputs should work, just adjust OutputTable[] or similar with correct addresses for TIMx->CCRy

User avatar
djrm
Posts: 40
Joined: Wed Feb 15, 2012 11:32 pm
Location: North Yorkshire, UK

Re: 32 bit Arm STM32 port

Post by djrm »

Thanks for the info about the baro reading, I had not studied the code.
However I see I have a conversion complete pin connected on my board and I just need to reassign it.

It turns out that the error in altitude was due to the high pressure at present, this coupled with my home altitude of only about 60m caused the altitude calculation to evaluate to a negative height. I've tweaked the conversion factor so this cannot hapen unless we get really high pressure.
A proper function to correct the altitude could be useful here, perhaps something could be devised using the GPS altitude as a reference.

Today I have made the acc and gyro sensors work and work to the same axis, the gui display looks good.
The PWM outputs are driving a servo so the next thing I'll do is to connect my receiver and check if the PPM system works ok.

David.

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: 32 bit Arm STM32 port

Post by timecop »

Yeah, barometer value (with the current formula, too) cannot be accepted as absolute height, ever.
You can correct it with local pressure data, or correct with GPS height, etc.
I'm also at sea level and I've had pressure readings from -72 to over 60 (by MWC values, which I believe are in cm).

User avatar
djrm
Posts: 40
Joined: Wed Feb 15, 2012 11:32 pm
Location: North Yorkshire, UK

Re: 32 bit Arm STM32 port

Post by djrm »

I opened my bluetooth GPS and had a poke around inside and found some test pads one of which had NMEA sentences at 9600 baud so I soldered some wires on and fed them into the FC board and now the gui shows me my location. I had to switch over to PPM so this was a chance to test my RC receiver and all 7 channels are now displayed in the gui, my spare servo is responding to RC channel aux3 with camera stabilisation which will be useful. I think there is only RC watchdog to get working and I'll have everything I want before I put this on a frame to test properly. The flight response certainly looks smooth in the gui, I'll have to see what the motor vibration does to it. I need to check the cycle time as I think it should be a bit faster than the 3400 displayed, this could be the baro conversion being a bit slow and holding things up, I'm not sure yet.
David.

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: 32 bit Arm STM32 port

Post by msev »

Djrm have you test flown it already? A video would be nice :D

User avatar
djrm
Posts: 40
Joined: Wed Feb 15, 2012 11:32 pm
Location: North Yorkshire, UK

Re: 32 bit Arm STM32 port

Post by djrm »

Unfortunateley I was just about ready to fit it to my frame for testing when I placed it down on my desk and shorted something and it started to smoke. it is completely fried I think the 3v3 shorted to the 12V. Some of the chips went with quite a fuss as it was connected to a lipo at the time. I have a new one on order but it will be a couple of weeks before it arrives. I can tell you I was not overjoyed when it happened, Damn.

miniquad
Posts: 65
Joined: Wed Mar 23, 2011 8:17 pm

Re: 32 bit Arm STM32 port

Post by miniquad »

Quick question to the STM32 developers..what IDE do you use? Is there any open source or free IDE for STM32 debugging and programming? I could not find any related resource on ST's website.

ST is offereing free sample of their STM32F0 discovery board if any of you are interested:

http://www.st.com/internet/evalboard/product/253215.jsp

User avatar
djrm
Posts: 40
Joined: Wed Feb 15, 2012 11:32 pm
Location: North Yorkshire, UK

Re: 32 bit Arm STM32 port

Post by djrm »

For development work I am using the free toolchain CooCox IDE and its low cost JTAG board from here: http://www.coocox.org/Index.html

miniquad
Posts: 65
Joined: Wed Mar 23, 2011 8:17 pm

Re: 32 bit Arm STM32 port

Post by miniquad »

Thanks djrm!


timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: 32 bit Arm STM32 port

Post by timecop »

Yes, and those follow (except buzzer) FreeFlight pinout, so they should be usable with baseflight code as-is.
Only problem is they moved BUZZ pin to SWDIO effectively disabling debugging on board and making it only for flying, as firmware can only be loaded via uart. Still for 50 bucks or wahtever they go for is not a bad deal.

LenzGr
Posts: 166
Joined: Wed Nov 23, 2011 10:50 am
Location: Hamburg, Germany
Contact:

Re: 32 bit Arm STM32 port

Post by LenzGr »

Wondering if this port would also work on the PS3 Move? The sensor support might need some tweaking at least...

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: 32 bit Arm STM32 port

Post by msev »

It would be especially cool, if we could hack a clone of the ps3 move controller..On DX there is one for 17$(don't know if is the actually the move controller or something else)..If it has a suitable stm32 processor and suitable/hackable pcb layout, this could be golden..Is there some other hackable source of these kind of processors (in the spirit of the beginnings of multiwii) :D.

On another note, that board on taobao which is without the imu is interesting for me (I would buy the imu separately)..It has an interesting price, they should put it on ebay for the same price..Taobao is probably hard to buy for us non-chinese..Tc would it run your baseflight out of the box (do you see how is it layed-out on the pcb)?

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: 32 bit Arm STM32 port

Post by timecop »

Yes, it runs baseflight out of the box as long as you have same sensors in same orientation (i.e. make your own imu or adjust sensor orientation in code). snapper1234 posted schematic for the copter.taobao.com boards and its basically freeflight pinout except they fucked up BUZZ pin and offset it by one, but its not like anyone uses buzz.

sliderrix
Posts: 2
Joined: Mon Jun 04, 2012 2:31 am

Re: 32 bit Arm STM32 port

Post by sliderrix »

I have now created my own layout, beep is on PA12 as the FF, SWD added.
added 5V regulator for direct connection to the flight accu ! :!:
I saw in the other circuit diagram for SD Card SPI1 pins used .
The pins on taobao controller circuit for SPI1 but has otherwise used (CH 5+6).
So how to connect the SD card slot now ? :?:
for any improvements to circuit and layout I am always open ! :)

greetz
Attachments
SD.jpg
copter.taobao.com STM32 Protel Schematic.zip
(51.2 KiB) Downloaded 154 times
STM32F103CBT6 Flight Control Board IMU.jpg
STM32F103CBT6 Flight Control Board IMU-sch.jpg
Last edited by sliderrix on Sat Jun 16, 2012 3:02 pm, edited 4 times in total.

Arf
Posts: 22
Joined: Tue May 22, 2012 10:48 pm

Re: 32 bit Arm STM32 port

Post by Arf »

Nice, does it use the Arduino IDE and a compatible bootloader.

bmod
Posts: 2
Joined: Sat Jun 16, 2012 1:51 pm

Re: 32 bit Arm STM32 port

Post by bmod »

The Taobou board is also on GLB if thats easier to get a hold of:
http://www.goodluckbuy.com/kcopter-stm3 ... s5611.html
This has got the best spec'd sensors of any of the integrated boards as far as I can tell.

Post Reply