Home
X-Monkey Software Development Guide
Contents
1. 9 Source Files 5 files C3 common C3 public L ADC 1file CHIMU 1file Events lfile FFT 1 file I2C 2 files IAP IL file Main 2 files mavlink 1 file Memory 2 files PWM 2 files Sensors System 45 files Systick 1 file WARTS SPI 3 files UserComm 3 files Waypoints Lfile t main c 3 0K 4 5K hj MonkeyQuad h h projectconfig h X ti nrniectwarninrs c Figure 4 Open Source Code 3 3 Platform code The platform folder contains files that represent specific platforms i e fixed wing UAV quadcopter platform stabilization etc From within Rowley you can include and exclude different files before compiling This allows you to selectively choose which platform or function you are compiling for while maintaining all the libraries and public code In this manner you are able to have different files with User Main entry points When main c passes control to this function your platform specific code will execute X Monkey Software Development Guide Rev Software Structure a0 3 4 Proprietary helper libraries The proprietary libraries are highlighted here However this is our internal view Your project will only contain the libraries themselves which reside in the Libraries directory and have a a extension The included h files provide access to the compiled code within these libraries C Project Library GNC C Project Library GPS C Project Library InertialSensors E Project Library INS
2. Ryan Mechatronics LLC makes no warranties based on the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice Ryan Mechatronics LLC assumes no liability for damages or otherwise due to use of the information in this document or application of any device described in this document Ryan Mechatronics LLC stresses end user compliance with all applicable laws and regulations when using devices of this nature Use by an end user in violation of any applicable laws is automatic basis for termination of warranty technical support and future sales Ryan Mechatronics LLC reserves all rights to this document and the information contained herein Reproduction use or disclosure to third parties without express permission is strictly prohibited Copyright 2012 Ryan Mechatronics LLC X Monkey Software Development Guide Rev 1 Introduction The Monkey platform provides a high performance basis for mechatronic system control Originally designed for autonomous vehicle control the platform can also be used for advanced data logging industrial control motion control or other mechatronic applications The X Monkey platform is an enhanced version of prior Monkey circuit assemblies The X Monkey includes o Powerful base CPU Cortex M3 ARM7 LPC 1768 CPU o Cortex SWD interface tested with Rowley Crossworks o Hardware based serial boo
3. SDCARD SD StandardLogging TRUE endif time 100ms flag 0 Clear time tick if time_1000ms_flag 1000ms 1 Hz tasks System Check CPU Checks CPU load and puts it into Monkey output message as needed time 1000ms flag 0 Clear time tick V Loop back around Figure 6 Sample User_Main function 6 Common Functions Common used functions in the open source area include but are not limited to To be documented at a later date Functions are numerous For now please browse the reference manual online to see the full set of source code available functions in the Monkey code base X Monkey Software Development Guide Rev Common Functions LN 7 Library Functions Special functions can be found in the libraries These functions are designed in many cases to make it easier to access special hardware functions on the X Monkey Libraries represent proprietary code that you have access to but cannot change or view the source The libraries currently include e UserFunctions a collection of functions that are most commonly used e SDCard functions for accessing the micro SD card file system Some of these functions are repeated in UserFunctions for convenience e INS an inertial navigation system library e nertialSensors for accessing on board MEMS sensor data different than CHIMU access which is in the common source area e GPS handles GPS parsing and module control functions e GNC guidance navigat
4. X Monkey Software Development Guide Rev Introduction E 2 Setup for Software Development Presented in this section are the most common setup and method for programming and coding the X Monkey Please note the Monkey is an open electrical device with no case It has no on board protection from short circuits or accidental electrical damage No system is fool proof and all correct use and planning for events in case of failure are the responsibility of the user Ryan Mechatronics cannot be held responsible for accidental or intentional damage caused by this unit either directly or indirectly 2 1 Hardware Hardware details can be found in the X Monkey User Manual UM5000 found on our website www ryanmechatronics com However shown below is a standard setup for connecting to the unit while debugging AGERET JTAG hardware and SWD adapter m ad SWD cable sau 4 X Monkey target Figure 1 Serial Wire Debug SWD X Monkey setup 2 2 Power The X Monkey requires 4 5 to 28V on its input power connector Typically we use a 5V bench supply to provide this while debugging 5 volts is selected so that if there is an accidental short touch of the power input to the rest of the board there will be limited damage The X Monkey CPU pins are in general 5V tolerant Loss of power to the unit while debugging will stop the debugging of course It may also require disconnect connect of the SWD tools to have your PC recognize them
5. again 2 3 Compiler Integrated Development Environment IDE Rowley Crossworks for ARM This is our preferred tool for compiling code Rowley provides a solid compiler and IDE based on the GCC compiler base and provides both forum and ticketed support for users Licenses start at 150 for personal use X Monkey Software Development Guide Rev Setup for Software Development eo 2 4 Debugging Tools In order to debug using the SWD connector and Rowley Crossworks you will need a JTAG SWD interface and an interface cable Rowley has a list of supported tools on their site We use these two options both are required ARM USB TINY H This is a high speed JTAG debugger that works with the Rowley toolset and costs about 60 Rowley has a JTAG debugger as well the CrossConnect Lite it is just a little more costly at 100 ARM SWD Adapter This is required for the Serial Wire Debug SWD format for ARM Cortex interface It plugs into the debugger above and comes with the cable that plugs directly into Monkey s SWD header X Monkey Software Development Guide Rev Setup for Software Development ANNE 3 Software Structure The project code is structured to allow updates to libraries and common public code independent of user s specific project code The user only needs to provide a user main function in their code and link it appropriately When the X Monkey is done booting it will transfer control to this function and s
6. C Project Library SDCard 7 Project Library UserFunctions E Project X Monkey Sandbox EJ Project Properties Source Files 4 files J common J Platforms t main c h projectconfig h t projectwarnings c amp system LPCT7xx c System Files 3 files SoftwareManualMainP age txt 1 Figure 5 Libraries 4 Global Variables One benefit and sometimes drawback to the X Monkey code is the use of global variables located in globals h Using these variables makes it very easy for users to access the latest information that is typically populated behind the scenes in interrupt service routines or thru the main state machine One major drawback In CrossWorks there is a global variable tab for inspecting global variables If this is selected you will experience dramatic slowdowns during debugging as Rowley updates ALL of these variables To avoid this slowdown while debugging simply look at other watch windows and don t use the global watch display 5 User Main structure User Main is where the users code typically goes It is a pseudo RTOS state machine that executes certain functions based on interval times Full examples are provided with the software but an example is shown below Some significant items are e Task times the task break down consists of 1 msec 5 msec etc tasks Put your required code call into the appropriate section i e don t call it faster t
7. Ryan Mechatromes X Monkey Software Development Guide Project Items Code Data amp Solution X Monkey Sandbox amp J Solution Properties C Project Library GNC C Project Library GPS C Project Library InertialSensors Project Library INS FL Project Library SDCard EF Project Library UserFunctions kg Project Properties Source Files 5 files common C3 public N DADC lfile CHIMU file B Events Ifile FFT Ifile Dc 2files CO IAP Ifile jj Main 2files 3 mavlink 1file Memory 2files 2 PWM 2files 9 Sensors D System 5 files Systick 1 file UARTS SPI 3 files UserComm 3 files J Waypoints 1file F Platforms tJ main c 3 0K 4 5K hj MonkeyQuad h h projectconfig h nrniarctwarninric c E X Monkey Software Development Guide Rev Table of Contents Contents Te 116706 6 q RENE 3 1 Scope of this Software Development Guide seeseeseeseeeeenemnne 4 2 NAO NS ees E A A 4 1 2 1 Precautions and User ReSponsibllity cc cccccccceeceeceeeseeseeseeseeeeeeeeeeeeseeseeseeseeseeaes 4 1 3 mirejecziesiaoaSgieio E 4 LST Startup Conditions Em m 5 2 Setup for Software Development seesssssssssssseseenneeneemne nennen nennen nennen sensn nnns 6 2 1 FAA IVY I ENERO TTE 6 2 2 miei a m 6 2 3 Com
8. e control WDT int Power DeepSleep RTC unsigned int minutes unsigned int seconds Deep Sleep mode control RTC int Power BoostFromLowPower int enabled Boost processing mode control LED Control Functions void Led Control unsigned long led int on LED On Off control for Monkey board void Led Blink unsigned long led int blinks LED Blocking Flash function for Monkey board GPIO Functions int GPIO Configure int channel int direction int pullup int ISRenable int risefall GPIO Configure Required to set GPIO to outputs or return to inputs int GPIO Output int channel int value GPIO Output Sets or clears an output GPIO int GPIO Value int port int pin GPIO Value Returns high low state of any port pin combination Note that all port pins not configured as ADC can be queried this is not limited to P2 12 or P2 13 SD Card Functions int SD Mount void Mount SD Card int SD FileOps char fileptr1 char fileptr2 int cmd SD Card File Operations int SD Log Data char data int btw unsigned int msec unsigned int fsize SD Card Logging Operations UART COM Control Functions void COM BaudRate int com unsigned short baud UART baud rates int COM Putch int com int ch UART Putch unsigned short COM Space int com X Monkey Software Development Guide Rev Library Functions IN UART TX Queue Space const char COM Puts int com const char string UART Puts int COM Write int com c
9. han it needs to or slower e Protected sections if a section is called out as protected it is important to other background functions and should not be removed unless you know you don t need it This is how the Monkey base code operates to provide sensor data and manage com protocols without user intervention X Monkey Software Development Guide Rev Global Variables Lo MN void User Main void Main loop Note that this is the time tasking loop There are protected areas in this section you should leave alone II State machine for task processing by user is in user process if defined CFG SDCARD bLoggerOK sd init Init SD card logger if enabled endif gThruputCnts 0 gLED_Heartbeat 1 Enable heartbeat User_Init Start processing loop while 1 gThruputCnts Pseudo tasking occurs here if tme 1ms flag 1ms 1000 Hz tasks BEGIN PROTECTED DO NOT REMOVE UNIT WILL NOT OPERATE CORRECTLY Handle serial port receipt Main_SerialPort_Process Handles double buffering of input from serial coms Parse now that the interrupts seem over RX FIFO has been emptied SSP1_Parse_CHIMU Parse GPS GPS Parse Process uplinked waypoints Event handler will indicate if there is a complete set waiting for you Waypoint_Process INNS filter processing ifdef CFG INSFILTER INS Filter Process endif ifdef CFG_BMP085 Baro_Process 1000 Updates pressure sensor at a 1
10. her directly or indirectly 1 3 Programming Options X Monkey can use either SWD for detailed debugging programming or can be loaded with code via a serial boot loader The Monkey platform is an excellent prototyping system for users that want or need the power of an ARM Cortex core User application code can be run on the core However the design makes it easy for the on board ARM processor to be reprogrammed by using on board firmware upload capability This allows new Intel HEX formatted code to be uploaded using the serial port A top level view of the usage modes is shown in the following figure X Monkey Software Development Guide Rev Introduction LN Boot Operation per ISP Button state on power up Operational Mode Action TTL Serial Program Reprogram Mode Select Normal Run application operation N a 1 3 1 Startup Conditions The startup condition of the S2 ISP pushbutton on the Monkey dictates what mode the system enters when reset or power is applied On Board ARM CPU running user code For operation in standalone mode user must have code loaded and running on the processor In this case switch S2 is not depressed Reprogramming In order to reprogram the board switch S2 would be depressed before power is applied When power is applied in this state the on board boot loader of the ARM is active Programming steps in this state can be found in Appendix A Serial Port Reprogramming Example
11. ion and control functions access may be limited Many of the commonly used library functions are found in the UserFunctions library A brief description of those functions located in UserFunctions as of release 4 0 is shown in Table 1 This is just a quick example of some of the functions A comprehensive list of all functions defines and variables in the code can be found in our detailed software description Please note that the latest detailed software description can be found in our online software reference manual This manual can be found here http www ryanmechatronics com public files user manuals platforms X Monkey X MonkeySoftwareUserGuide html index html Table 1 Current set of Functions in UserFunction Library GPS Functions int GPS SetDataRate int rate Set GPS Data Rate output rate void GPS SetFilter unsigned char filter Set GPS Filter Type void GPS MessageEnable unsigned char msgid unsigned char enable Enable Disable GPS Messages void GPS ColdStart void Coldstart software reboot of GPS Power Control Functions void Power GPS int poweron Power Management for GPS void Power CHIMU int poweron Power Management for CHIMU void Power Aux3 3V int poweron Power Management for Auxiliary Power int Power Sleep void X Monkey Software Development Guide Rev Library Functions LE Sleep Idle mode control int Power DeepSleep WDT unsigned int minutes unsigned int seconds Deep Sleep mod
12. ll attitude heading reference system AHRS with GPS position velocity and time updates all in one tiny package Application areas include but are not limited to e UAVs AUVs UAS etc e Robotics e Education X Monkey Software Development Guide Rev Introduction es e Rocket science 1 1 Scope of this Software Development Guide This guide provides an overview of software development on the X Monkey platform It is not a comprehensive guide but is intended to help familiarize the user with the core structure on Monkey how you can insert your own code and develop on the platform and provide descriptions and examples of common functions 1 2 Limitations The toolset and project that is provided for Monkey was designed using Rowley Crossworks www rowley co uk This compiler IDE are based on the GCC base It is a very good tool and relatively inexpensive especially for individuals Rowley frequency updates their toolset with the latest core files for the X Monkey series of processor and we adopt the latest after testing 1 2 1 Precautions and User Responsibility The Monkey is an open electrical device with no case It has no on board protection from short circuits or accidental electrical damage No system is fool proof and all correct use and planning for events in case of failure are the responsibility of the user Ryan Mechatronics cannot be held responsible for accidental or intentional damage caused by this unit eit
13. more info v Verify after programming Fill unused Flash Technical on line articles about 8051 and XA programming www esacademwy com fag docs Change COM port to your com port Change path to hex file to where you stored the hex file to download Press the start button it will flash and verify If it fails try pressing the reset button on the Monkey board and try again If it still fails try powering the unit via a USB cable so grounds are common If it still fails drop the baud rate to 5 600 If it still fails cycle power on the Monkey and try again Close FlashMagic Power board down Put CHIMU back on be CAREFUL ABOUT PIN ALIGNMENT Power up without any buttons pressed and verify new code is running 207020090 Example
14. onst char buffer unsigned short count UART Write void COM TxfFlush int com UART TX Flush int COM Getch int com UART Getch SPECIAL System Control Functions void SYSTEM ClockOut int clock int enable System Clock Out int SYSTEM RTC Check Check RTC X Monkey Software Development Guide Rev Library Functions INE 8 Appendix A Serial Port Reprogramming Example oteps to load a new Hex file firmware image into the X Monkey board 1 COND OB WD _ eS Ne ee ee 9 10 11 12 X Monkey Software Development Guide Rev Appendix A Serial Port Reprogramming Download and install the latest version of FlashMagic from this site http www flashmagictool com Power down Monkey Remove CHIMU module if present from Monkey board to be on the safe side Plug USB node or other USB to serial converter into Monkey Press the S2 button on Monkey and KEEP IT HELD DOWN FOR THE NEXT STEP Power up Monkey or press the S1 button and release it Release the S2 button Run FlashMagic and reprogram a Open settings file fms or if fms file is not available select settings shown below Fle ISP Options Tools Help GH ABS COM Port COM 6 Baud Rate 230400 Interface None ISP Erase all Flash Code Rd Prot Oscillator MHz 1 Erase blocks used by Hex File Hex File CACrosswworks Projects4Monkey 2010 SwwD hex Modified Unknown
15. orms h projectconfig h t projectwarnings c amp system LPCT7xx c Cd System Files 3 files SoftwareManualMainPage txt Figure 3 Top level code components The following quick descriptions apply to these items e main c This is the entry point for the C code o After the system is setup and initialized main c calls the function User Main This is the link to the user code located in the Platforms gt UserMode c or similar code This is how your code interfaces into the overall project e projectconfig h this file contains a number of defines that affect the overall project o Items like RS 485 and SD card use can either be enabled or disabled in this file e projectwarnings c contains warnings based on the defines in projectconfig h to try and prevent errors by raising warnings and errors if you choose wrong options e Systemfiles contains startup code assembly specific to this processor 3 2 Common public source code The common public source code expanded is highlighted in the figure below X Monkey Software Development Guide Rev Software Structure I Project tems Code Data amp 1 Solution X Monkey Sandbox EJ Solution Properties E Project Library GNC E Project Library GPS E Project Library InertialSensors Project Library INS 7 Project Library SDCard C Project Library UserFunctions roject A IVIc f HONE roject Properties
16. piler Integrated Development Environment IDE eeeseeseesesese 6 2 4 BWrebselyslfe c T MEME E o e EEE a NER 8 3 1 Top Level Code Components cccceccecceeceeceeteeteececeueceeceetseteeteetaeeaeseusceeceeseetaeteetaeees 8 3 2 Common DUDIC SOURCE COD BL ticecnecsssarsaterenstecureunatereseateuseureanauaienemasterenea teeters 9 io FFU ON COO S semana a satiesetetecansenaeeptigiictelteamind aise taddn asaddculsennuabeusanenaeentnces 10 3 4 Proprietary helper lDrarieS ccc ccc ccceeceeceeceeeceeceeseeceeeeeeecseseeseeeeeesseseeseeseeesgeteeteeeess 11 4 Global Variables cc cceccecceccecceceeeceeceeteeceeeecseceeecsecsetseteeseseeceeeeeecsetseteeseeseceeeeeeeseteesaeeaes 11 2 Uoer Manor er E N ee a ee eee 11 o COMMON 1S ONS ee ETE 13 EE Sec AaUasien eese UU w 14 8 Appendix A Serial Port Reprogramming Example ccccccecceceseeeeeeeeeeeseeceecseeeeaeeeeeeeeees 17 X Monkey Software Development Guide Rev Release Notes Title Monkey Subtitle X Monkey Software Guide Type Manual Document number UM5100 Revision Index Date Name Status Comments Initial Release 4 2012 MR Initial release IMPORTANT DISCLAIMERS This document and the use of any information contained therein is subject to the acceptance of the Ryan Mechatronics terms and conditions They can be downloaded from www ryanmechatronics com
17. second rate Maximum update rate is about 40 msec endif END PROTECTED E SEMPER wi User Process Handles user processing like mode switches etc time 1ms flag 0 Clear time tick if tme 5ms flag 5ms 200 Hz tasks No Tasks time 5ms flag 0 Clear time tick j if tme 10ms flag 10ms 100 Hz tasks No Tasks X Monkey Software Development Guide Rev User Main structure time 10ms flag 0 Clear time tick if time 20ms flag 20 ms 50Hz tasks It Le eR ee oe ee HI ii BEGIN PROTECTED DO NOT REMOVE UNIT WILL NOT OPERATE CORRECTLY Control Process Handle control functions servos at 50Hz ifdef CFG USE MONKEY TELEMETRY TX Com Process Handles output messages endif END PROTECTED xd a ee ee ey I time 20ms flag 0 Clear time tick if tme 100ms flag 100ms 10 Hz tasks A a ae ove a ae E ESN EE E E S E BEGIN PROTECTED DO NOT REMOVE UNIT WILL NOT OPERATE CORRECTLY ADC Process 10 Hz start a burst ADC read Global gADC holds result CHIMU Process END PROTECTED Ju ie et ec ee E ea ee ee ee cs ee nce Deena ui Below is for SD card logging of standard data set if card is present Called at 10 Hz but only writes to disk after 10 entries if defined CFG
18. t loader for easy loading of new software o High performance U Blox LEA 6 GPS Module o Active on board antenna for increased sensitivity and jamming reduction o Autosensing off board GPS antenna switch for external antenna use 3 axis gyro rate sensor 3 axis accelerometer 3 axis magnetometer RS 485 driver on board for spare port Barometric pressure sensor Spare analog and digital I O ports Six 6 Isolated and dedicated PWM servo outputs Four 4 input capture port connector Micro SD Card EEPROM for configuration settings Flash data log for solid state data logging Three status LED s red green blue Interfaces with CHIMU module for attitude estimates and sensor inputs via SPI or UART O O O O O O O O OOOO Monkey has an excellent GPS module on board U Blox series with both on board and off board antenna capability The off board antenna capability is important if the unit is used in conditions where the on board antenna will be blocked by enclosures or other jamming Monkey has on board inertial measurement sensors but is intended to work with the CHIMU AHRS as a plug in module to offload attitude determination The CHIMU includes e 3 axis rate sensors to measure angular rate e 3 axis accelerometers to measure linear acceleration e 3axis magnetometer to measure magnetic flux typically used for compass type heading derivation The combination of all these capabilities with the on board ARM processing power allows a fu
19. till provide access to all functions and libraries on the unit The overall project is called a solution and it contains a number of items The solution structure is shown below tion X Mor ey Sandbox Solution Properties E Project Library GNC E Project Library GPS E Project Library InertialSensors Project Library INS E Project Library SDCard E Project Library UserFunctions Project X Monkey Sandbox EJ Project Properties Source Files 4files J common Platforms t main c hj projectconfig h t projectwarnings c E system LPCT7xx c System Files 3 files SoftwareManualMainP age txt j Figure 2 Solution Structure The solution contains proprietary libraries open source code and settings for the project This section will describe each of the following groups e Top level project code components e Common public code e Platform code for customization e Proprietary helper libraries 3 1 Top Level Code Components The top level code components are highlighted in the figure below X Monkey Software Development Guide Rev Software Structure NEN 9 Solution Properties E Project Library GNC E Project Library GPS E Project Library InertialSensors E Project Library INS E Project Library SDCard E Project Library UserFunctions Project X Monkey Sandbox Ej Project Properties Source Files 4 files J common Platf
Download Pdf Manuals
Related Search
Related Contents
高温用ダイ アフ ラム シール式圧力計取扱説明書 Optibox pony - Users Manual German Patriot Memory DDR2 2GB (2 x 1GB) PC2-9600 Enhanced Latency DIMM Kit INSA DE LYON Référence GALAXIE : 4148 AL-PS-10 User Manual - ALTERA Technologies Sdn. Bhd. Lire ce journal en PDF Copyright © All rights reserved.
Failed to retrieve file