LEGO MINDSTORMS TUTORIAL - SourceForge

10m ago
8 Views
0 Downloads
1.03 MB
89 Pages
Last View : 14d ago
Last Download : n/a
Upload by : Emanuel Batten
Transcription

LEGO MINDSTORMSTUTORIALESWEEK 2009http://nxtgcc.sf.netModule NXTLEGO MINDSTORMS TUTORIALOutlineESWEEK 2009http://nxtgcc.sf.netRasmus Ulslev Pedersenrup.inf@cbs.dkPlease sit close to the screen: there will be lots of small code shown.NXT.1

Presentation OverviewLEGO MINDSTORMSTUTORIALESWEEK 2009http://nxtgcc.sf.netOverview Non-technical overview ofLEGO c MINDSTORMS c NXT from acommunity and user standpointHW and SW Description of NXT hardware andsoftware from a developer perspectiveExamples (1) Using TinyOS as a firmware,(2) an intelligent algorithmQ & A There will be time for discussion andfuture research ideasLab Drawing for the NXT 2.0 and labexercise using itNote 1: LEGO has sponsored a NXT 2.0 kitNote 2: LEGOr, MINDSTORMSrare trademarks of LEGOr.The tutorial contains pictures from Atmel ARM7documentation, and from LEGO documentation.Note 3: There is additional material included: Many slides aresupplementary and included for future reference.OutlineNXT.2

LEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netModule NXTLEGO MINDSTORMSOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTESWEEK 2009http://nxtgcc.sf.netRasmus Ulslev Pedersenrup.inf@cbs.dkNXT.1

OutlineLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net1 Aim of Tutorial2 IntroductionOutline3 Open SourceAim of TutorialIntroduction4 SensorsOpen SourceSensors5 Inside NXT C 101Inside NXT C 1016 Firmware ProgrammingARM7FirmwareProgrammingNXT Software7 ARM7Debugging NXT8 NXT Software9 Debugging NXTNXT.2

LEGO MINDSTORMSAimESWEEK 2009http://nxtgcc.sf.net How the open source universe around Lego Mindstorms NXT is structuredTalk about a world that stretches from high-schools toadults and from building bricks to programming inassemblerEmphasis on the overview and the programming aspectsParticipants will be able to see where in the NXTprogramming spectrum their interest match mostUse the tutorial to get started with open sourceprogramming on NXTOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.3

IntroductionLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutline Description of open source hardware and software LEGO business models are discussed The old RCX NXT in several (online) communities Overview of how NXT can be programmed in differentenvironmentsAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.4

Some Mindstorms HistoryLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net 10 years since Mindstorms was released First LEGO Mindstorms was the LEGO RCX: Successful LEGO intended it to be a closed source product, but. It was soon hacked:-)OutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101 The open source strategy was pursued even more with thepresent LEGO Mindstorms A Goldplated NXT and a limited edition Black NXT wasproduced in relation to the 10 year anniversaryFirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.5

NXT DevelopmentLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Development of NXT started in the 2004 Initial group was Ralph, Steven, John, and David First prototypes were circulated on a limited number basis inside the current MUP group and a select few outside thatgroupMUP: Jan 2006, 5 peopleMUP II: Nov. 2005, 11 peopleMDP: 2006MCP 2: 31 persons, 100 chosen from 10000 applicantsMCP 3: 2008-2009MCP 4: Next slideOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.6

LEGO Design RoutinesLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Lego has a group of people who has theprivilege of talkingdirectly to LEGO staffUnder non-disclosureagreements (NDA)First group of MCPs(MUP) were a selectgroupUsed as a soundingboard for the ideas thatwent into developing thefirst LEGOMINDSTORMS NXT.MCP 4 is commencingas we speakOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.7

Lego EducationLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Lego has a website for educational activities Strong focus on university segment LEGO MINDSTORMS NXT comes in educational setsOutlineAim of TutorialIntroductionOpen SourceSensors Rechargeable battery and extra building piecesInside NXT C 101 Sold with site licences that accompany the NXTFirmwareProgramming Different sales curve from retail (slow start, longer productARM7life)NXT SoftwareDebugging NXTNXT.8

Mindstorms CommunityLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net MINDSTORMScommunity is large anddiverse Blogs, forums, largeevents, books, the MCPprogram and more NXTStep and theNXTasy blogs Lugnet is a large LEGOfanclubOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.9

SchoolsLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Many schoolsparticipate in FirstLEGO League A tournament wherecurrent theme is playedout The idea is to haveadults lead or mentor ateam of children aged9-14 (16 outside the US) NXT is used to completea challenge put out bythe FLL managementOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.10

Business ModelsLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net LEGO earns money on NXT by selling the kit itself Licences to educational institutions are also revenue sourceFirst version of LEGO MINDSTORMS NXT was releasedin the beginning of 2007A second version appeared in the fall of 2009 (biannualrelease schedule:-)?)NXT 2.0 is shipped with a different set of standard sensors(color sensor)Spring releases at toys fairs which is then ready forChristmas saleOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.11

LEGO SYSTEMSLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net LEGO partly produce and package NXT ontheir factory in BillundStaff around NXTdevelopment is not bigFirmware developmentteam is in control of thesoftware developmentNational Instruments(NI) designs the NXT-GenvironmentThe careful selection ofclose partners makesfor long-time stabilityOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.12

Firmware ReleasesLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutline NXT is a complex product compared to other LEGOproducts Requires focus on quality Updated versions released on the official MINDSTORMSwebsite (http://mindstorms.lego.com) First firmware had the version number 1.1 (or 1.0.) andthe current released version for NXT 2.0 is versioned 1.28Aim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.13

PartnersLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Many institutions, companies, groups, andindividuals have a stakein NXTNational Instruments ispresumably the mostimportantMIT, Tuft, CarnigieMellon, and others arealso activeOthers such asnxtprogramsNumber of large eventsThis includesBrickfestThere has also been aMINDSTORMS NXTSumo CompetitionOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.14

NXT AlternativesLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net NXT is not completely alone.Sun Spots fromSun/OracleFisher-Technic offers anew robot controllerwhich is is based on anARM9 processorrunning at 200MHzVarious evaluation kits:mbed, IAR, etc.However, it is difficult tomatch dealer network,community, and historyof LEGOOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.15

Source and Documents by LEGOLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netNXT Firmware Open Source Complete software for the NXTfirmware, which can be compiled with acompliant C compilerSoftware Developer Kit A kit with software for controlling NXTremotely from a host computer. It includes adescription of the NXT virtual machine.Hardware Developer Kit Description of the possible sensorand actuator interfaces for NXT. This isextensively used by thirdparty sensor vendors.Bluetooth Developer Kit It includes the communication protocolfor controlling NXT over a Bluetooth connection.Demo Show PDF files which are important for firmwarereplacements.OutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.16

SchematicsLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutlineAim of Tutorial Lego published the schematicsIntroduction Can see which pins of the ARM7 MCU is connected toOpen Sourcewhat ports Lego uses Orcad for its schematics, which is a commercialprogramSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.17

Analog/Digital ProtocolsLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net NXT features both analogue and digital interfaces to its sensors.Sensors are based on an analogue to digital conversionSignals are fed into the ARM processor for furtherprocessingDigital sensors are made with an I2C compliant protocolI2C is a two wire protocol that allows for a number ofdevices on the shared busIt can be monitored with a logical probeOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.18

NXT-G BlocksLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net LEGO provides a proprietary programming language for LEGO MINDSTORMS NXT called NXT-GG implies it is a graphical programming languagePlaces NXT-G programming blocks in a sequence thatinvolves the usual programming constructs such as loops,branches and computationsTutorials and small videos with instructions for a given taskShow Robocup NXT-G program in NXT-G.OutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.19

Firmware SourceLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net LEGO MINDSTORMS NXT comes with an open source operating systemOperating system is written in ANSI CSource code fundamentally access the physical layer suchas input and output ports of the ARM processorAnother part provides an abstraction layer to theseservices (Show the HPL, HAL files.)Operating system is a traditional round robin schedulerServices each a number of modulesOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.20

Modules OverviewLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Each module is centered on a logical or a physical unit in NXTExample: the display or the user interfaceThe virtual machine a logical moduleEach time the virtual machine is serviced it can/willexecute a number of bytecodesA 1 ms period (system tick) services all modulesShow scheduler.OutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.21

Fantom PC/Mac InterfaceLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net LEGO has released an interface both for the PC and the MacintoshLinux is not supported at this pointFirmware image in NXT is updated via a USB cableconnectionNXT is programmed from NXT-G either over USB orBluetoothWe will revisit this Fantom DLL when GNU debugger isdiscussedOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.22

Sensor Partners and Independent ManufacturesLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net A limited number of third-party sensorsexistsHitechnic, Mindsensors,and VernierHitecnic produces itssensors in a standardLEGO sensor housingMindsensors make itssensors available indifferent shapes andformsVernier specializes innatural sciencesexperimentsDCPOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7VernierrNXT SoftwareDebugging NXTNXT.23

LEGO MINDSTORMSStandard SensorsESWEEK 2009http://nxtgcc.sf.netOutline Input and output portsfeature a 6-wire RJ12connector Ultrasonic distancemeasurement sensor, alight intensity sensor, asound sensor, a touchsensor, and motorsAim of TutorialIntroductionOpen Source(a) Light(b) Motor(c) SoundSensorsInside NXT C 101FirmwareProgrammingARM7NXT Software(d) Touch(e) Ultra(f) NXT-GDebugging NXTStandard Lego Mindstorms NXTsensors and a NXT-G blockNXT.24

MindsensorsLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Camera Realtime Clock Acceleration (2,3, and 5 axis reading) Dual Infra Red Obstacle Detector Motor Multiplexer for NXT Magnetic compass Pneumatic Pressure SensorOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7 High Precision Infrared distance sensor (short, medium,long range) Various accessories: port splitter, cables, plugs, sensor kit,toolsNXT SoftwareDebugging NXTNXT.25

Selected NXT sensors from MindsensorsLEGO MINDSTORMSESWEEK iccompassOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C reddistanceARM7NXT SoftwareDebugging NXT(k) Sensor building kit(l) TemperatureNXT.26

HitechnicLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Prototype Board GyroOutlineAim of TutorialIntroduction IR seeker Compass Color sensor Acceleration/tilt Sensor and motor multiplexer Accessories: CablesOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.27

LEGO MINDSTORMSSensors from HitechnicESWEEK 2009http://nxtgcc.sf.netOutlineAim of TutorialIntroduction(m) Color(n) GyroOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXT(o) Multiplexer(p) Prototyping boardIf you don’t think "How fast can I get these sensors.", thensomething is wrong:-)"NXT.28

Custom SensorsLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net It is possible to create custom sensorsEAGLE is a CADprogram for creatingspecialized PCBsThe PCBs can befabricated at placessuch as Olimex.Olimex accepts EAGLEfiles (probably easierthan Gerber files)Sensors can beprototyped for under 50OutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.29

EAGLEIt is easy to modify a schematic in EAGLELEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.30

Create a (non-functional.) Demo Temperature SensorLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutline Select componentsAim of Tutorial Take some pin headerIntroduction Search for termistor andadd it Wire it TryFile- Run- bom.ulpOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.31

Create a Temperature SensorLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutlineAim of TutorialIntroductionOpen Source TryFile- Run- bom.ulpSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.32

Create a Temperature SensorLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutlineAim of TutorialIntroductionOpen Source Create the board File- Switch toboardSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.33

Create a Temperature SensorLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Take Tools- Auto. Check the layers(View-Display/hidelayers) Perhaps a littleoverdoing with not usinga single layer board. Resize the board byusing MOVE cornersOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.34

Create a Temperature SensorLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutlineAim of Tutorial Make Gerber filesIntroduction Run excellon.camOpen Sourcefrom the File- CAM Use GerbView (orsimilar to inspect files) or Textpad.SensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.35

NXT C Programming 101LEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netJust to refresh out C programming skills NXT types Function pointers void pointersOutlineAim of YTEModuleName[FILENAME LENGTH 1];void(*cInit)(void* WORDModuleSize;} attribute (( packed )) HEADER; /*nxtgcc converter*/Open SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.36

NXT C Programming 101LEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Pointers *Outline Address of &Aim of Tutorial Dereferencing *IntroductionOpen SourceSensorsULONG* pUL;ULONG someUL;someUL 4;pUL &someUL;*pUL 5;//Now someUL 5Inside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.37

NXT C TypesLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net typedef struct enum #defineOutlineAim of Tutorialtypedefstruct{ULONG VAL1, SOMEENUMVALEND SOMEENUMVAL1,};.ifndefSOME H FILEdefineSOME H FILE// codeendif //SOME H FILEIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.38

Embedded ProgrammingLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutline A central micro processor controls NXT A second small micro processor assisting it Code is compiled to machine instructions which areexecuted one at a time NXT allows for firmware updates, which is the basis foralternative operating systemsAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.39

NXT Firmware NXT actually consists ofLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.nettwo different firmwares The main firmwarecontrols the interactionwith the user, and radiocommunication to otherNXTs An ATmega48generates the pulsewidth modulation(PWM) signals for thethree motors It also provides inputregarding the state ofthe push buttons on theNXT Host side SDK whichallows for interactionwith the NXT via a DLLOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.40

LEGO MINDSTORMSNXT InsideESWEEK 2009http://nxtgcc.sf.net (a) ARM7 MCU (b) ATmega48 MCUOutline (c) CSR BlueCore4 Bluetooth radio(d) SPI bus andtouchpad signals(e) high-speed UARTbehind input port 4(f) output (generallymotor) port(g) USB port, (h)four-button touchpad(i) 100x64 LCD displayAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT with important hardwarehighlightedNXT.41

ARM to AT48 CommunicationLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net AVR to ARM: Buttons, ADC values, and Battery ARM to AVR: Motor control etc. Show m sched.h file.OutlineAim of Tutorialtypedefstruct{UWORDAdValue[NOS OF AVR ctionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwarePower;PwmFreq;PwmValue[NOS OF AVR OUTPUTS];OutputMode;InputPower;Debugging NXTNXT.42

Firmware EnhancementsLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutline Firmware enhancements are possible only because LegoAim of Tutorialreleased the software as open source IAR is a commercial compiler used by LEGO It was recently released in a free version for Mindstorms The other option for programming the existing firmware isto use GCCIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.43

Firmware Replacements A growing number of firmware replacements availableLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Examples: lejos, NQC, pbLua, and RobotC A different example is TinyOS leJOS is based on a small virtual Java machine. It is afirmware replacement that allows for Java programming onLego Mindstorms NXT. There is extensive support in formsof tutorials, well-developed APIs, and Netbeans/Eclipseprogramming IDEs at the leJOS website. Lua is a scripting language (see Lua website). It is said toperform faster than other scripting languages. RalphHempel has ported Lua to Lego Mindstorms NXT andlabeled it pbLua Not eXactly C (NXC) is language similar to C. It issupported on Lego Mindstorms NXT by John C. Hansenand available fromhttp://bricxcc.sourceforge.net/nbc/. It is builton top of the Next Byte Codes (NBC) compiler. It is afirmware replacement.OutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.44

IAR Toolchains and Firmware CompilersLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net The free IAR compiler can be downloaded from IAR’shomepage It is an industry strength programming environment calledEmbedded Workbench It interacts with a JTAG programmer connected to LegoMindstorms NXT via the IAR C-SPY debugger The visualSTATE program interacts with the C-SPYdebugger to give a graphical view of the debuggingsessionOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.45

LEGO MINDSTORMSGCC The GCC compiler can be downloaded from thenxtgcc home pageIt is an arm-elf-gcccompilerThere exists severalgood toolchains such asWinArm, CodeSurgeryetc.Show nxtgcc vaand NGU.javaSource-xx Source copym sched.mapESWEEK 2009http://nxtgcc.sf.netOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.46

GCC Compliance ProcessLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Changes needed to make the source code compile with an arm-elf based GCCSee details in ConvertNxtGcc.java programFirst versions of NXTGCC were error-proneIAR supports, and Lego uses, nested flexible arraymembersGCC does not support thisKey was to change the nested flexible array to become afixed size nested arrayOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.47

LEGO MINDSTORMSNested ArrayESWEEK 2009http://nxtgcc.sf.netShow Display.txt in SourceOrig and in xelsY;/*nxtgcc converter*/UBYTEData[1];}/*nxtgcc converter*/attribute (( packed ))BMPMAP;Aim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.48

ARM7LEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Characterized by a number of modes, exception types, and interruptsAssociated with each mode is a current program statusregister (CPSR)Each exception and interrupt type is associated with apriority6 privileged modes named system, svc, abort, fastinterrupt, interrupt, and undefined modeThey can all modify the CPSRThe unprivileged user mode cannot modify the CPSROutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.49

The Bible: Atmel doc6175.pdfThe ARM7 processor used in NXT is underlined.LEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.50

Periodical Interval TimerThe PIT timer generates the system tick.LEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.51

Memory ControllerLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netThe MC generates the abort exceptionOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.52

MCU Overview ISAM-BA, SPI, TWI, AIC, SSC, etc.LEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.53

MCU Overview IILEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netSAM-BA, SPI, TWI, AIC, SSC, etc.OutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.54

ARM MCU FeaturesLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netJTAG, Thumb, ARMOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.55

ARM MCU Peripherals and Memory MappingsThe Big (Small.) PictureLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.56

ARM MCU Peripherals and Memory MappingsMain memoryLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.57

ARM MCU Peripherals and Memory MappingsLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netMain memory remappingOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.58

ARM MCU Peripherals and Memory MappingsPeripherals such as timersLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.59

ARM MCU Peripherals and Memory MappingsSystem Peripherals such as interrupt controllerLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.netOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.60

ARM7 RegistersLEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net The CPSR defines the characteristics of the current mode It can mask (ie. not allow) interrupts and fast interrupts The CPSR includes a flag whether the ARM7 is executing thumb code or arm codeThere is a register file which includes 37 registersEach register is 32 bit wideEach mode uses 17 registersRegisters R0-R12 are shared between usr, sys, svc,abt, irq, and und modesThe fiq mode has its own banked version of the R8-R12registersAll modes have their own stack pointer and link/returnpointer: R13 and R14The program counter, pc, is placed in R15OutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.61

LEGO MINDSTORMSARM and Thumb Instruction SetsESWEEK 2009http://nxtgcc.sf.net The ARM instruction setis 32 bit Thumb instruction set is16 bit Most of the code in NXTis compiled toward theThumb instruction set Thumb code is moredense than ARM Exception and interrupthandlers are compiledto ARM codeDemo ARM compilation.OutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT schematicsNXT.62

LEGO MINDSTORMSARM PinsShow PDF with ARM.PCBPort/pinESWEEK 2009http://nxtgcc.sf.netARM7 pinARM7 6PA30AD7OutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT Software Port 1 through 4 are mapped to general purpose inputDebugging NXToutput pins Most ARM7 pins are multiplexed Pin 6 on inout port 1-3 both can serve as GPIO pins andas an analog to digital converter (ADC) The Lowspeed module use the GPIO pins to bit-bang anI2C protocolNXT.63

Memory Layout and Dynamics Flash memory is initially mapped to address 0x0000 0000LEGO MINDSTORMSESWEEK 2009http://nxtgcc.sf.net Flash is also accessible at address 0x0010 0000 NXT immediately branches to the reset handler that is defined in CStartup.SIt uses a temporary stack in the RAM areaThe reset handler sets up the stacks for the interrupthandler (IRQ), the undefined instruction handler (UND)stack, and the user stack (USR)The USR stack is used when the normal code executesIRQ stack is obviously used when the IRQ handler isinvoked: it branches to the correct interrupt service routine(ISR)Controlled by writing the address of that ISR into theadvanced interrupt controller (AIC) source vector register(SVR)Example: each of the three timers (TC0, TC1, TC2) havean ID, and that ID is used as index in the AIC SVR vectorNext: Memory LayoutOutlineAim of TutorialIntroductionOpen SourceSensorsInside NXT C 101FirmwareProgrammingARM7NXT SoftwareDebugging NXTNXT.64

LEGO MINDSTORMSMemory LayoutFlash (.text)0x0010 0000Reset interrupt vector (boot)ESWEEK 2009http://nxtgcc.sf.netRAM (.data)Remap0x0000 00000x0020 0000Reset interrupt vector-Undefined instruction vector-Software interrupt vector-Prefetch abort vector-Data abort vectorReservedReserved-IRQ vector-FIQ vectorIRQ handlerAdvanced interrupt controller(IRQ mode)OutlineUndefined instruction handlerUsed as breakpoint entry(Undefined instruction mode)Aim of TutorialReset handlerARM compiled codeReset handler(Supervisor mode)Flash 256 KB.fastrunC code to run in RAMI.e. Interrupt service routines.bssZero initialized variablesIntroductionOpen SourceRAM 64 KBThumb compiled codeSensorsInside NXT C 101FirmwareProgrammingNXT file systemFree spaceARM7User stackNXT SoftwareDescending stacksReset handler stackDebugging NXTUndefined handler stackIRQ handler stackNXT file handlesNXT file version0x F000 0000Memory mapped peripheralsTWI (I2C), SPI, USART, etc.Notes about the NXTGCC memory layout figure:Not drawn to scaleStrikethrough: not used in standard firmwareInterrupt and exceptions is handled in assemblerSome details omitted for clarity0x FFFF FFFFNXT.65

LEGO MINDSTORMSMemory LayoutESWEEK 2009http://nxtgcc.sf.netFlash (.text)Remap0x0000 0000Undefined instruction vector-Software interrupt vector-Prefetch abort vector-Data abort vectorReser

First LEGO Mindstorms was the LEGO RCX: Successful LEGO intended it to be a closed source product, but. It was soon hacked:-) The open source strategy was pursued even more with the present LEGO Mindstorms A Goldplated NXT and a limited edition Blac

Related Documents:

LEGO, the LEGO logo, the minifigure, DUPLO, the SPIKE logo, MINDSTORMS and the MINDSTORMS logo are . Book about astronauts ; LEGO, the LEGO logo, the minifigure, DUPLO, the SPIKE logo, MINDSTORMS and the MINDSTORMS logo are . You may find several ideas for short physical activities for students through a simple web search. Design a .

First LEGO Mindstorms was the LEGO RCX: Successful LEGO intended it to be a closed source product, but. It was soon hacked:-) The open source strategy was pursued even more with the present LEGO Mindstorms A Goldplated NXT and a limited edition Blac

Simulation for LEGO Mindstorms Robotics By Yuan Tian The LEGO MINDSTORMS toolkit can be used to help students learn basic programming and engineering concepts. Software that is widely used with LEGO MINDSTORMS is ROBOLAB , developed by Professor C

2 Lego Mindstorms – A little history Originally launched 1998 The Lego Mindstorms Robot Invention System (RCX “Brick”) Simple visual programming system Reverse engineered Major update 2006 Lego Mindstorms NXT Open source hardware & fi

continued and computers were become smaller, as in 1998 Lego introduced the first Lego Mindstorms and Robotics Invention System. This kit included not only the usual Lego parts, but also a programmable brick, called the RCX. The main component of the RCX is a Hitachi H8 microcontroller. In 2000 Lego relea

LEGO s response to a need for an improved microcontroller system is addressed in t heir new LEGO Mindstorms NXT product. LEGO Mindstorms RCX is already over eight y ears old (introduced in 1998) and LEGO stopped its production and any further developments in favor

LEGO, the LEGO logo, the minifigure, DUPLO, the SPIKE logo, MINDSTORMS and the MINDSTORMS logo are trademarks and/or copyrights of the LEGO . Book about astronauts : Outline of Day Tasks Time Materials : 9:00 - 10:30 Introductions 30 min LEGO bricks . collect ideas. Ideas fo

7 LEGO, the LEGO logo, the minifigure, DUPLO, the SPIKE logo, MINDSTORMS and the MINDSTORMS logo are trademarks and/or copyrights of the LEGO Group, 2020 The LEGO Group.

Hacking Opportunities 49 Summary 49 Chapter 3 Hacking LEGO I: Connections 51 Mindstorms Wires Explained 51 Inside the Mindstorms Wire 52 Hacking Mindstorms Wires 53 Exploring Wireless Options 56 Infrared Sensor and Beacon 56 Bluetooth 57 Hacking Wireless 58 Summary 62 Chapter 4 Project: Remote-Controlled Crane 63 Parts List 64 Building the Crane 65

O'Reilly Network: Lego MindStorms: RCX Programming Page 2 of 3 file://C:\My Documents\O'Reilly Network Lego MindStorms RCX Programming.htm 5/26/00 Other people have built tank-style robots, walking robots (with two, fo

8 Beste Freunde / 8 amis adorables / 8 Amigos Especiales 8 Amigos especiais / 8 Különleges Barát / A Minha Cidade LEGO DUPLO / LEGO DUPLO Város / Meine LEGO DUPLO Stadt / Ma ville LEGO DUPLO / Mi Ciudad LEGO DUPLO Meine LEGO DUPLO Starter-Se

Keywords: LEGO, ROV, MindStorms, RCX ABSTRACT This paper discusses the design and creation of a Remotely Operated Vehicle (ROV) that runs off the LEGO RCX and is primarily made out of standard LEGO components.

In the Fall of 1998, The LEGO Group released the Robotics Invention System (RIS), a set that was part of a new product line called MINDSTORMS . This set entered the world like a lightning bolt—finally, the chance to make LEGO models that moved, sensed, and thought! The LEGO Gr

LEGO, the LEGO ogo, MINDSTORMS and the MINDSTORM logo r trademarks and/o copyrights o th LEGO Group. 2019 2020 h EG roup. TABLE OF CONTENTS. 1 Installation .

62 21142 21144 21141 21139 21143 21138 21140 Expand your LEGO Minecraft world Erweitere deine LEGO Minecraft Welt! Agrandis ton monde LEGO Minecraft Amplia il tuo universo LEGO Minecraft Amplía tu mundo LEGO Minecraft Expande o teu mundo LEGO Minecraft

9580 LEGO Education WeDo Construction Set The 9580 LEGO Education WeDo Construction Set enables students to build LEGO models that attach to the LEGO USB Hub and then control the models using computer programs. The set contains 158 elements including a LEGO Hub, motor, tilt sensor and a motion sensor that add

Super Heroes AGES 4 . AGES 5 LEGO 10 Harry Potter AGES 7 LEGO Creator Expert AGES 12 LEGO Friends AGES 4 LEGO Marvel Super Heroes . This advanced LEGO set provides an immersive and rewarding building experience.

In 1998, the LEGO Company released a new product called the LEGO Mindstorms Robotic Invention Kit that became an instant commercial success. Children and those young at heart could buy the 200 kit— consisting of 717 pieces including LEGO bricks, motors, gears, different senso

Lego MindStorms robots are built around a pro-grammable microcontroller, the RCX. This unit, which looks like an oversized yellow Lego brick, has three ports each to attach sensors and motors, an infrared sender/receiver for communication with the PC, and 32 KB mem

Managing unethical behavior in organizations: The need for a behavioral business ethics approach DAVID DE CREMER * AND WIM VANDEKERCKHOVE ** Abstract Issues of morality and ethics have increasingly become more important in organizations and business settings. Traditionally, these issues of ethics and social responsibility in business settings have been discussed and commented on by .