Reaction Wheel Actuated Satellite Dynamics Test Platform

Dependencies:   mbed

Diploma Thesis in Aerospace Engineering, January 2014

University of Applied Sciences Munich, Faculty 03

Electronics:

  • 1x mbed NXP LPC 1768 Microcontroller
  • 2x XBee S1 Radios + Sparkfun USB Adapter
  • 1x CHR UM6-lt IMU
  • 4x Graupner BEC 8 Motor Controllers
  • 4x ROXXY 2826/09 Brushless Motors
  • 1x Hacker TopFuel LiPo 1300mAh Battery
  • 1x big Selfmade BreakOutBoard to connect all components
  • 1x small BreakOutBoard to connect IMU

Hardware developed with Catia V5R20

Manufactoring Technology: Rapid Prototyping - EOS Formiga P110

Controlled via text based menu with DockLight

__________________

Committer:
DimitriGruebel
Date:
Wed Jul 09 07:35:50 2014 +0000
Revision:
0:1447d2f773db
Dynamics Test Platform

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DimitriGruebel 0:1447d2f773db 1 /*
DimitriGruebel 0:1447d2f773db 2 Copyright (c) 2010 Andy Kirkham
DimitriGruebel 0:1447d2f773db 3
DimitriGruebel 0:1447d2f773db 4 Permission is hereby granted, free of charge, to any person obtaining a copy
DimitriGruebel 0:1447d2f773db 5 of this software and associated documentation files (the "Software"), to deal
DimitriGruebel 0:1447d2f773db 6 in the Software without restriction, including without limitation the rights
DimitriGruebel 0:1447d2f773db 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
DimitriGruebel 0:1447d2f773db 8 copies of the Software, and to permit persons to whom the Software is
DimitriGruebel 0:1447d2f773db 9 furnished to do so, subject to the following conditions:
DimitriGruebel 0:1447d2f773db 10
DimitriGruebel 0:1447d2f773db 11 The above copyright notice and this permission notice shall be included in
DimitriGruebel 0:1447d2f773db 12 all copies or substantial portions of the Software.
DimitriGruebel 0:1447d2f773db 13
DimitriGruebel 0:1447d2f773db 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
DimitriGruebel 0:1447d2f773db 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
DimitriGruebel 0:1447d2f773db 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
DimitriGruebel 0:1447d2f773db 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
DimitriGruebel 0:1447d2f773db 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
DimitriGruebel 0:1447d2f773db 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
DimitriGruebel 0:1447d2f773db 20 THE SOFTWARE.
DimitriGruebel 0:1447d2f773db 21 */
DimitriGruebel 0:1447d2f773db 22
DimitriGruebel 0:1447d2f773db 23 #include "MODSERIAL.h"
DimitriGruebel 0:1447d2f773db 24 #include "MACROS.h"
DimitriGruebel 0:1447d2f773db 25
DimitriGruebel 0:1447d2f773db 26 namespace AjK {
DimitriGruebel 0:1447d2f773db 27
DimitriGruebel 0:1447d2f773db 28 int
DimitriGruebel 0:1447d2f773db 29 MODSERIAL::__putc(int c, bool block) {
DimitriGruebel 0:1447d2f773db 30
DimitriGruebel 0:1447d2f773db 31 // If no buffer is in use fall back to standard TX FIFO usage.
DimitriGruebel 0:1447d2f773db 32 // Note, we must block in this case and ignore bool "block"
DimitriGruebel 0:1447d2f773db 33 // so as to maintain compat with Mbed Serial.
DimitriGruebel 0:1447d2f773db 34 if (buffer[TxIrq] == (char *)NULL || buffer_size[TxIrq] == 0) {
DimitriGruebel 0:1447d2f773db 35 while (! MODSERIAL_THR_HAS_SPACE) ; // Wait for space in the TX FIFO.
DimitriGruebel 0:1447d2f773db 36 _THR = (uint32_t)c;
DimitriGruebel 0:1447d2f773db 37 return 0;
DimitriGruebel 0:1447d2f773db 38 }
DimitriGruebel 0:1447d2f773db 39
DimitriGruebel 0:1447d2f773db 40 if ( MODSERIAL_THR_HAS_SPACE && MODSERIAL_TX_BUFFER_EMPTY && dmaSendChannel == -1 ) {
DimitriGruebel 0:1447d2f773db 41 _THR = (uint32_t)c;
DimitriGruebel 0:1447d2f773db 42 }
DimitriGruebel 0:1447d2f773db 43 else {
DimitriGruebel 0:1447d2f773db 44 if (block) {
DimitriGruebel 0:1447d2f773db 45 uint32_t ier = _IER; _IER = 1;
DimitriGruebel 0:1447d2f773db 46 while ( MODSERIAL_TX_BUFFER_FULL ) { // Blocks!
DimitriGruebel 0:1447d2f773db 47 // If putc() is called from an ISR then we are stuffed
DimitriGruebel 0:1447d2f773db 48 // because in an ISR no bytes from the TX buffer will
DimitriGruebel 0:1447d2f773db 49 // get transferred to teh TX FIFOs while we block here.
DimitriGruebel 0:1447d2f773db 50 // So, to work around this, instead of sitting in a
DimitriGruebel 0:1447d2f773db 51 // loop waiting for space in the TX buffer (which will
DimitriGruebel 0:1447d2f773db 52 // never happen in IRQ context), check to see if the
DimitriGruebel 0:1447d2f773db 53 // TX FIFO has space available to move bytes from the
DimitriGruebel 0:1447d2f773db 54 // TX buffer to TX FIFO to make space. The easiest way
DimitriGruebel 0:1447d2f773db 55 // to do this is to poll the isr_tx() function while we
DimitriGruebel 0:1447d2f773db 56 // are blocking.
DimitriGruebel 0:1447d2f773db 57 isr_tx(false);
DimitriGruebel 0:1447d2f773db 58 }
DimitriGruebel 0:1447d2f773db 59 _IER = ier;
DimitriGruebel 0:1447d2f773db 60 }
DimitriGruebel 0:1447d2f773db 61 else if( MODSERIAL_TX_BUFFER_FULL ) {
DimitriGruebel 0:1447d2f773db 62 buffer_overflow[TxIrq] = c; // Oh dear, no room in buffer.
DimitriGruebel 0:1447d2f773db 63 _isr[TxOvIrq].call(&this->callbackInfo);
DimitriGruebel 0:1447d2f773db 64 return -1;
DimitriGruebel 0:1447d2f773db 65 }
DimitriGruebel 0:1447d2f773db 66 _IER &= ~2;
DimitriGruebel 0:1447d2f773db 67 buffer[TxIrq][buffer_in[TxIrq]] = c;
DimitriGruebel 0:1447d2f773db 68 __disable_irq();
DimitriGruebel 0:1447d2f773db 69 buffer_count[TxIrq]++;
DimitriGruebel 0:1447d2f773db 70 __enable_irq();
DimitriGruebel 0:1447d2f773db 71 buffer_in[TxIrq]++;
DimitriGruebel 0:1447d2f773db 72 if (buffer_in[TxIrq] >= buffer_size[TxIrq]) {
DimitriGruebel 0:1447d2f773db 73 buffer_in[TxIrq] = 0;
DimitriGruebel 0:1447d2f773db 74 }
DimitriGruebel 0:1447d2f773db 75 _IER |= 2;
DimitriGruebel 0:1447d2f773db 76 }
DimitriGruebel 0:1447d2f773db 77
DimitriGruebel 0:1447d2f773db 78 return 0;
DimitriGruebel 0:1447d2f773db 79 }
DimitriGruebel 0:1447d2f773db 80
DimitriGruebel 0:1447d2f773db 81 }; // namespace AjK ends