basil4j 1 Posted March 13, 2014 Author Share Posted March 13, 2014 Hi, I found a few QFN32 CM3 devices which would be nice from NXP, downloaded LPCXpresso, installed it and got lost Technically, the MCU's would be more suitable for this application just to ease the workload on the math, but I am finding everything extremely complicated when it comes to learning the programming side of things of ARM devices (regardless of brand). Seeing as we are on the subject, might as well run my thoughts past you just to double check the amount of math I need to do really isnt much Main clock at 20MHz (DCO), with SMCLK doing the timing of the sensor reading interrupts and writing the 256bytes to dataflash (SPI) every 0.05s Most of the math I think I can do in integer math (this is for a rocket altimeter by the way....) Heres my thinking... From Barometer data: -Find pressure ---ADC reading * 0.012 mBar ---easy to do in integer as its a linear relationship (convert mBar to uBar) -Apply temperature and offset adjustments -Calculate altitude --- =((((P0/P)^(1/5.257))-1)*(T+273.15)) / 0.0065...havent got my head around this one yet, cant figure out the best way to do the x^(1/5.257) bit, rest is fixed point math -Calculate velocity from altitude -- Can be done in integer -Calculate acceleration from altitude -- can be done in integer Accelerometer X, Y, Z axis, for each axis: -Convert to G's ---can be done in integer math (multiplication/division) -Apply temperature and offset adjustments For X axis only: -Calculate acceleration - can be done in integer math (addition/division) -Calculate new velocity --can be done in integer math (addition) Gyroscope X, Y, Z axis, for each axis: -Calculate change in angle --- I think this could be done in integer math. -Apply temperature and offset adjustments -Calculate new angle ---again, I think integer math -Combine Y and Z angles to come up with a modifier for the vertical velocity --- sine/ cosine and fixed point mult/div Combined accel X velocity and gyro tilt -Calculate altitude from X Velocity and tilt modifier ---floating point??? Most frequent sample rate is the accelerometer at 400Hz, Gyro at 100Hz and Barometer at 40Hz. And heres how I intend to process everything: Interrupts in order of priority: -Get data from ADC's -----Interrupt on timer at 400Hz -----Interrupt determines if Accel, Gyro and/or Baro needs to be read from based on an incrementing counter (all sample frequencies divide into 400Hz nicely) -----Write to a variable to tell the main routine which math stuff to work on. -Start write block of data to Dataflash (SPI) @ 20Hz (20Hz is the time it takes to fill 256bytes) In main loop, determined by Switch/Case: -Do Accel math -Do Gyro math -Do Baro math If the MSP430 is up to this i'm more than happy to stick with it What do you think? Quote Link to post Share on other sites

jpnorair 340 Posted March 13, 2014 Share Posted March 13, 2014 @@basil4j Here's the deal: Nintendo ran on a square wave circuit, a triangle wave circuit, a video IC, and a piece-of-junk ~17MHz 6502. Yet clever programmers were able to extract amazing performance out of it. In your situation, you can chose to be a clever programmer or a clever architect. With MSP it may get tricky at the late part of your project, and with ARM you have the learning curve at the beginning. So you are going to have to deal with a challenge either way. But it's a million miles away from being an insurmountable challenge. Quote Link to post Share on other sites

basil4j 1 Posted March 13, 2014 Author Share Posted March 13, 2014 Thats true lol Sticking with MSP Sent from my GT-I9300 using Tapatalk Quote Link to post Share on other sites

enl 227 Posted March 13, 2014 Share Posted March 13, 2014 The ^(1/5.2....) has a couple options that I might consider: Lookup table with interpolation (pretty good speed, accuracy ok) Expand a Taylor series for it, optimize the series, and evaluate using Horners method (might be a bit time consuming on MSP430, but, then again, we used to do this kind of stuff on 1MHz 8080 for real time work) Store raw data and decode on the ground. If actual measures are needed in the air, and you know what they are, pre-compute the raw data value so you can compare simply Quote Link to post Share on other sites

## Recommended Posts

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.