Baseflight aka multiwii port to stm32

Post Reply
User avatar
IceWind
Posts: 115
Joined: Fri Mar 25, 2011 2:11 am
Contact:

Re: Baseflight aka multiwii port to stm32

Post by IceWind »

:) Thanks!

The shield doesn't have vreg.
Image
When I tested it I used my tarduino duemilanove, so no need for voltage conversion.
BUT indeed I forgot about the pull=up resistors. damm...

I'll add some reistors (4.7K?? , need to see what I have in SMD format) to act as pull-up and I'll try again.
Last edited by IceWind on Mon May 27, 2013 3:09 pm, edited 1 time in total.

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

Also, can you post the 4 numbers under L883 on the chip? Should be either 21xx, preferably 22xx.

User avatar
IceWind
Posts: 115
Joined: Fri Mar 25, 2011 2:11 am
Contact:

Re: Baseflight aka multiwii port to stm32

Post by IceWind »

It read 2105... is that bad? Problems with drift?

Update: Read a bit and it seems STM32 likes 10K pullups so that's what I added. Still no luck. Only one axis is read. Searching for that reference of the HMC5883 I found little but found some mention to some issues with the inicial batch of Honeywell? Axis order problems???

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

Nah, the axis order stuff was really old batches. And that wouldn't cause no readings at all. If there's no vreg on board, how are you powering it? Are you taking 3.3V from somewhere?

User avatar
IceWind
Posts: 115
Joined: Fri Mar 25, 2011 2:11 am
Contact:

Re: Baseflight aka multiwii port to stm32

Post by IceWind »

I'm taking the 3.3v from the vReg in the FF board.

Image

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

Re: Baseflight aka multiwii port to stm32

Post by copterrichie »

May I ask please how many Motor PWM step resolution does Baseflight generates between 1000-2000ms? I believe the Arduino 8 bits only have 128.

Thank you.

User avatar
polo_fly2
Posts: 34
Joined: Fri Aug 05, 2011 1:12 pm
Location: Munich - Bavaria

Re: Baseflight aka multiwii port to stm32

Post by polo_fly2 »

Hello,

I receveied one Acro Naze 32 from japan the last days. This will be my first 32 bit happy experience. The board is going to take place in
a new tricopter, only for acro flying . To make the board up to date I would like to upload the baseflight release r.304 from May 2. on it.

Timecop : can I use this release ? or is r.304 a very experimental version. ?

Thank you
Georg

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

R288 is latest stable, 304 was actually mistake build, and shouldn't be used, i think it had some bug in it.
Or you can build latest head revision yourself, there are several people flying it without issues.

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

copterrichie wrote:May I ask please how many Motor PWM step resolution does Baseflight generates between 1000-2000ms? I believe the Arduino 8 bits only have 128.

Thank you.


1000, though it can be way higher. baseflightplus had 0.5us resoltuion (2000 steps), and timers can be run at 36MHz, though there's going to be some theoretical limit w/16bit roll over.

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

Re: Baseflight aka multiwii port to stm32

Post by copterrichie »

timecop wrote:
copterrichie wrote:May I ask please how many Motor PWM step resolution does Baseflight generates between 1000-2000ms? I believe the Arduino 8 bits only have 128.

Thank you.


1000, though it can be way higher. baseflightplus had 0.5us resoltuion (2000 steps), and timers can be run at 36MHz, though there's going to be some theoretical limit w/16bit roll over.


Thank you, my theory is, using higher resolution enables the usage of higher KV Motors providing the ESC also has the ability to operate at the higher resolution..

User avatar
polo_fly2
Posts: 34
Joined: Fri Aug 05, 2011 1:12 pm
Location: Munich - Bavaria

Re: Baseflight aka multiwii port to stm32

Post by polo_fly2 »

timecop wrote:R288 is latest stable, 304 was actually mistake build, and shouldn't be used, i think it had some bug in it.
Or you can build latest head revision yourself, there are several people flying it without issues.



OK. I´ll try the R288. For building head revision myself I have first to learn how to do it ? :oops:

Thank you a lot, also for the quick shipment.
Georg

a day later:

had a great fly with 5 packs. I loaded the R288 and everything is fine. At least in acro mode ( maybe today is no wind and I can
set the level mode and test)

Just one or two questions.

I have on the buzzer pins always 1.03 Volt regardless of battery voltage (same with or without connected the battery to the Vbat pins )

Is there a Cli expression needed to activate the buzzer ?

is there any saurce to get a better understanding of the cli parameters ?

I know already some out of mwi, but the cli "language" is a bit different.

thank you
georg

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Mag driver fault

Post by Crashpilot1000 »

Hi!
@TC: Without aligning the Mag correctly in the powerup phase the later reading of the Mag is not correct. It will never match with GPS and TBE occurs, esp if you are integrating acc readouts.
I attached the corrected mag driver here.

Cheers
Kraut Rob

EDIT:
BTW: I also reworked the ms baro driver and detection (bmp085/ms5611). Somehow I think there is an electrical issue as well - not shure but i think there is still something fishy going on. You may have a look here: http://fpv-treff.de/download/file.php?id=5218
Attachments
TCMagstuff.zip
(7.57 KiB) Downloaded 69 times

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

As much as I appreciate the effort, but there's no fucking way any of the stuff you pasted is even remotely close to being usable. I have no idea what .ino is, what has been changed in any of the drivers, or what any of that wrongly indented/formatted stuff is. If you want any patches to actually be included, provide them in regular unified diff format against latest svn trunk/whatnot, and not as a bunch of random files.

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Baseflight aka multiwii port to stm32

Post by Crashpilot1000 »

Well, a simple thank you would have done it. Next time simply make a better copy of the original multiwii code that would be less troublesome.
But you are always welcome.

Cheers
Kraut Rob

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

I did say I appreciate the effort, but unfortunately I can't use the changes in the format you provided them. Sorry about that.

a944734
Posts: 23
Joined: Mon Sep 03, 2012 9:09 pm

Re: Baseflight aka multiwii port to stm32

Post by a944734 »

Now that's sweet. Rob spent weeks debugging the fuck-up in your code and all you do is whine about the format ?
Some people ....

kol
Posts: 5
Joined: Fri Jan 04, 2013 6:11 am

Re: Baseflight aka multiwii port to stm32

Post by kol »

Yes, in every source code occur bugs. Baseflight is very good opensource project placed on svn. Good taste rule to use diff when you post commits.

Without It really difficult to understand the source code changes made by Rob

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

a944734 wrote:Now that's sweet. Rob spent weeks debugging the fuck-up in your code and all you do is whine about the format ?
Some people ....


There was a bug fixed? Well, I wouldn't know because all I got was a zip with ALL files, wrongly formatted, without any comments or etc, and some arduino .ino files with other stuff. What the fuck do you expect me to do with them, guess what was changed?

felixrising
Posts: 244
Joined: Sat Mar 23, 2013 12:34 am
Location: Australia

Re: Baseflight aka multiwii port to stm32

Post by felixrising »

Hi Rob, it would be great if you'd post/work on a live svn repo and be able to push/pull changes and see diffs, especially as baseflight continues to evolve torwards 2.2, it will help you pull down changes as they progress and also any fixes/improvements you make could be easily diff'd for upstream consumption. Further upstream, Multiwii has the same general requirement for code changes/patches as outlined here: https://code.google.com/p/multiwii/sour ... README.txt

@TC: I understand you've previously requested 4 space indentation and a diff -u output with code submissions. Do you have your specific requirements documented somewhere?

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

indent -kr -nut -l400 would be a start.

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

Re: Baseflight aka multiwii port to stm32

Post by copterrichie »

My dog in this fight has long since been removed however, people do not have the same programming skills. Yes, it would be nice and very helpful if everyone did things the same but that just ain't going to happen. I really need to get back onto this 32bit horse because my builds now require the added PWM precision but I am very reluctant. No offense to anything, but we need a bit more tolerance and communication.

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Baseflight aka multiwii port to stm32

Post by Crashpilot1000 »

@TC: Hi!
Did you ever resolve the issue that you found yourself here: http://www.rcgroups.com/forums/showpost ... stcount=78 ??

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

I should probably fix it, yeah.
it doesn't 'affect' anything, but yeah i2c driver var copying can be removed. I'll put it on todo.

User avatar
mr.sneezy
Posts: 109
Joined: Sat Jan 12, 2013 12:00 pm
Location: Adelaide, Australia

Re: Baseflight aka multiwii port to stm32

Post by mr.sneezy »

Heads up on a possible issue in MW2.2 that might effect Baseflight and Harakiri. Please don't shoot me if I'm wrong though, just want to make mention in case it helps the coding guys here.

I've been setting up a HobbyKing MultiWii Mega board FC for a friend in the last few weeks in my spare time . I've had some issues with MW2.2 that I've loaded on this board. The crux of it is that either MW-Wingui or MultWiiConfig software both report on the sensor detection indicators (the green rectangles for each sensor) that a GPS is present, when there is none connected. I noticed this while debugging GPS connection troubles on his board.
It may be a bug in MW2.2 GPS detection routines or something (pure speculation though).

Cheers,
Martin

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Baseflight aka multiwii port to stm32

Post by Crashpilot1000 »

@TC: Thank you very much for cleaning up the I2C driver!! Those rabbit guys will probably notice that as well :) .
Just one little side note: GCC tells me "i" is an unused variable now in "i2cWriteBuffer". Just cosmetic stuff.
Thanks!
Kraut Rob

Truglodite
Posts: 48
Joined: Sat Jun 22, 2013 2:37 am

Re: Baseflight aka multiwii port to stm32

Post by Truglodite »

The instant I arm my copter (baseflight both 288 and 351), the graphs in the GUI go flat until I disarm. Same thing with my KV-OSD; once I arm everything freezes in place until I disarm. Heck, same thing even happens with my bluetooth Andriod app. Is that supposed to happen? Is there code I must edit to keep the telemetry data alive in flight?

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

Did you enable feature telemetry or something?

Truglodite
Posts: 48
Joined: Sat Jun 22, 2013 2:37 am

Re: Baseflight aka multiwii port to stm32

Post by Truglodite »

Thanks for the quick and concise response TC... as a matter of fact I did have telemetry enabled, and now that telemetry is disabled, telemetry stuff works. :?

So, why is the telemetry feature there to begin with?
Also, does baseflight have "soft powermeter" to display mAh used without needing a current shunt?

I'm probably showing my raw newbness with these quesitons. If the power meter were critical I'd just add it to my OSD hardware, but it's not. I just like to tinker and learn new things.

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

feature telemetry is for FrSky, it drops port to 9600 baud and only sends data which FrSky LCD and transmitter can understand. It's not for GUI telemetry.
No, fake power meter is not available. It's not accurate and is just a hack, such hacks (like I2C GPS, LCD "telemetry", etc) have not made it across 8bit transition.

Truglodite
Posts: 48
Joined: Sat Jun 22, 2013 2:37 am

Re: Baseflight aka multiwii port to stm32

Post by Truglodite »

FYI, I had to change line 230 in printf.c from uartTransmitEmpty to isUartTransmitEmpty. Now 354 compiles without errors.

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Baseflight aka multiwii port to stm32

Post by Crashpilot1000 »

@TC: Is it possible to save more than that shabby 1KB Page in EEPROM? I am currently biting my teeth saving 3Kb. Always CRC eor - error.
I changed: #define FLASH_WRITE_ADDR (0x08000000 + (uint32_t)FLASH_PAGE_SIZE * (FLASH_PAGE_COUNT - 3))
and tried to change the stm32_flash.ld file. Maybe it's that bank unlocking stuff. I don't know. Do you have an idea?

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

You should be able to write arbitrary blocks without issue, erasing each one before write.
flash.ld shit is mostly just for gcc to not TRY to put any code in the back flash, but it shouldn't be an issue at all, since code is not reaching anywhere near 120k.

User avatar
mr.sneezy
Posts: 109
Joined: Sat Jan 12, 2013 12:00 pm
Location: Adelaide, Australia

Re: Baseflight aka multiwii port to stm32

Post by mr.sneezy »

Question for anyone here.
I'm 'updating' the three main sensors on my old FF board running Baseflight to the current crop of sensors. I'm wanting to know if I'm correct in thinking that if the mag and acc/gyro sensors are not oriented the same as in the Naze32 (either mag or acc chip will need to fly backwards compared to Naze32) then I can simply change settings in the CLI parameters to setup for my board ?

These would be the align_gyro, align_acc, align_mag settings ?

Thanks. I just want to confirm this understanding is correct before I cut the tracks to the old sensors or remove them altogether...
Martin

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

Yes, the align stuff.
But to understand how it works, you';ll need to read the code.

User avatar
mr.sneezy
Posts: 109
Joined: Sat Jan 12, 2013 12:00 pm
Location: Adelaide, Australia

Re: Baseflight aka multiwii port to stm32

Post by mr.sneezy »

Thanks. I'll cross that hurdle when I get to it.

Another short question. I see you routed the MPU6050 and the HMC5883L interrupts to the MCU in the late board revision. Does Baseflight (or Harakiri) need these lines to be present currently ?

Thanks,
Martin

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

Not right now, though as soon as I get to rewriting some of the stuff MPU int will be used for sure.

whakahere
Posts: 20
Joined: Wed Jan 30, 2013 9:17 pm

Re: Baseflight aka multiwii port to stm32

Post by whakahere »

is the abusemark website down? I can seem to get to the page or a direct link to the manual.

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

Yeah, sorry, raid card shitted itself. Will be down for another 2-3 days while replacement is fedex'd.

User avatar
mr.sneezy
Posts: 109
Joined: Sat Jan 12, 2013 12:00 pm
Location: Adelaide, Australia

Re: Baseflight aka multiwii port to stm32

Post by mr.sneezy »

TC, what's the advantage or disadvantage with the Optional MMA8452 ACC chip on your Rev4 boards, over the MPU6050's own integrated three axis ACC ?
Thanks,
Martin

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

It works better on my wood frames.

User avatar
mr.sneezy
Posts: 109
Joined: Sat Jan 12, 2013 12:00 pm
Location: Adelaide, Australia

Re: Baseflight aka multiwii port to stm32

Post by mr.sneezy »

TC, I'm at a loss with the Mag orientation setting after two nights reading up, thinking and fiddling with it. I need to ask you for some help if you'd humour me.

I've found info about the Mag X,Y,Z orientation defines in MultiWii code in a few places. The MultiWii Wiki for the Config.h file has some info too, and reading the Def.h file with all the board types and Mag types seems useful as well.
I also had a look at the BaseFlight source code in the sensor.c, config.c and cli.c files but didn't make much sense of it I'm afraid.
Putting all information snippets together has sort of helped a bit, but obviously not enough.

From the reading I've done so far it seems to me that as the Mag on my new tacked on IMU is a full 180 degrees opposite of the Naze32 that I'd just need to reverse the sign value of the align_mag_X and Y terms in CLI. However that didn't work like expected. I have a big variation heading when rolling/pitching the airframe. I then tried an array of other combinations, with a Mag Calibration run in between each. Didn't hit the magic set of values.

Two questions, one may negate the need for the other though.
Given the Mag on my board is 180 degrees spun around from the one on the Naze32 can you tell me what the correct align_mag_x, y, z values would be in the CLI set list ?

If not then perhaps knowing more about the range of values possible in the CLI would help me out. I see the range is -3 to +3, seven values total including 0. Can you tell me how the seven possible values relate to the three mag axis's to confirm what I think ?

Thanks, Martin
Attachments
Mag CLI.jpg

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

lol, i saw that question coming a mile away.

The reason you even have to deal with this is multiwii axis orientation is *absolutely fucked*.
It's non standard, its original numbering/etc was based off gyro orientation in a fucking wiimotion or whatever, anyway, its completely random. What's worse, is over time, as more sensors got added, they all got squeezed into this "wiimotion" axis frame of reference, which doens't make things any better. Then of course everyone who made breakout boards for sensors would just rotate chips randomly and declare victory, disregarding their x/y orientation.

tl;dr: you'll never figure out axis alignment.

With that said: what the numbers mean is,
0 = don't touch given axis
1..3 = this is the "new" index+1 of this axis into the multiwii axis array [0..2].
+ or - in any given axis swaps the sign.

... yeah.

User avatar
mr.sneezy
Posts: 109
Joined: Sat Jan 12, 2013 12:00 pm
Location: Adelaide, Australia

Re: Baseflight aka multiwii port to stm32

Post by mr.sneezy »

timecop wrote:lol, i saw that question coming a mile away.
The reason you even have to deal with this is multiwii axis orientation is *absolutely fucked*.
... yeah.
Well I guess I'll try a few combinations first anyway to see if I can fluke it, but the backup plan I've had in mind is just fix it in hardware (hardware is easy for me, software not so much). I'll remove the Mag from the GY-86 and refit the Mag only module I was using before across the I2C bus. That way I can effectively move the Mag even further away from all the electrical systems for some small benefit in lower interference.

There is one other way possibly that occured to me while relying.
I could swing the GY-86 around so the Mag is an orientation match for Naze32 etc, but then alter the six Acc/gyro settings in CLI to suit the then backwards MPU6050.

Is that lot of settings just as f#cked up to get right in your opinion, or is there a clear method to get that right ?

Thanks, Martin

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

That's definitely the way to go, orient MAG same way as on naze, then swap gyro/acc axes since you can at least GUESS which way they're supposed to go. :)

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Baseflight aka multiwii port to stm32

Post by Crashpilot1000 »

Hi!
Since I had not to live through your pain I would suggest a different method. Take the Mag orientation as reference for the boardorientation and just change the orientation of gyro and acc, because they are much easier to find out. Desoldering the mag is also a method...
http://www.multiwii.com/wiki/index.php? ... rientation
http://www.rcgroups.com/forums/showpost ... tcount=323
http://fpv-community.de/showthread.php? ... post276950 (german)
http://www.fdings.de/?q=content/naze-ko ... figurieren (german)

Cheers
Rob

User avatar
mr.sneezy
Posts: 109
Joined: Sat Jan 12, 2013 12:00 pm
Location: Adelaide, Australia

Re: Baseflight aka multiwii port to stm32

Post by mr.sneezy »

Thanks both for your input. OK, rotating the module sounds like a plan, although removing the mag would not be hard either.

One thing though. I did see this note you listed and read it from the MultiWii Config.h wiki page. But I'm not sure that my board and Mag ever conformed to this, because one of the things I did while trying to workout the Mag axis stuff was look at an old screen dump of my reading BEFORE I swapped the to the new sensors, and it's contradictory on the Z axis.

Magnetic sensors orientation
X MAG:
ROLL RIGHT = positive
ROLL LEFT = negative
Y MAG
PITCH FORWARD = positive
PITCH backward = negative
Z MAG
should be positive
not move a lot if the multi remains flat.

See the image of my old sensors. Z is negative while flat on the table which is opposite of the text above. The others are both negative too BUT the copter was facing East anyway so might not count for anything.
Attachments
Realtime Tab-001.jpg

User avatar
Crashpilot1000
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: Baseflight aka multiwii port to stm32

Post by Crashpilot1000 »

Well, like TC said on other posts the sensor orientation and general orientation handling on mwii is a mess. I am glad that the mag calibration is somehow fixed, but digging around in that is no fun so there might be still a problem present. So I would just rotate the whole board or the sensorboard (depending on what is easier) to match the assumed original naze mag position and fiddle with gyro/acc orientation that should be a job of 30 minutes.

User avatar
mr.sneezy
Posts: 109
Joined: Sat Jan 12, 2013 12:00 pm
Location: Adelaide, Australia

Re: Baseflight aka multiwii port to stm32

Post by mr.sneezy »

TC and Rob, a question to clear up my understanding of how the firmware uses the Mag chip.
Is the Compass display seen on the GUI (and I guess the firmwares flight heading reference) ONLY a product of the Magnetometer data, OR is the orientation data from the MPU6050 also used to create the heading (e.g. is the data merged from both chips for compass direction) ?

I hope that made sense.
Thanks.
Martin

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

Re: Baseflight aka multiwii port to stm32

Post by timecop »

Compass is augmented with gyro data.

User avatar
mr.sneezy
Posts: 109
Joined: Sat Jan 12, 2013 12:00 pm
Location: Adelaide, Australia

Re: Baseflight aka multiwii port to stm32

Post by mr.sneezy »

Thanks TC. That partly explains the weird compass stuff, maybe all of it.

OK, I have done the Acc/Gyro reorientation. This image shows the new Acc and Gyro axis settings, might help somebody sometime. Numerically it makes little sense, but on the GUI all is now well, including the compass. Time to fly...
Attachments
reversed MPU6050.jpg
(41.79 KiB) Not downloaded yet

Post Reply