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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.