<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.emfcamp.org/2014/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Marekventur</id>
	<title>Electromagnetic Field - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.emfcamp.org/2014/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Marekventur"/>
	<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/wiki/Special:Contributions/Marekventur"/>
	<updated>2026-06-25T00:38:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3832</id>
		<title>TiLDA MKe</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3832"/>
		<updated>2015-03-06T21:01:14Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:IMG_0474.jpg|500px|right|thumb|Front]]&lt;br /&gt;
[[File:Badge_Front.png|right|thumb|Front]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/E_(mathematical_constant) Why MKe?]&lt;br /&gt;
&lt;br /&gt;
=EMF 2014 Badge= &lt;br /&gt;
The main aim of the 2014 badge is to give camp attendees an interesting bit of hardware to play with during the camp and experiment with afterwards. We designed an Arduino compatible platform to allow easy reuse and access, and have published all code and design files.&lt;br /&gt;
&lt;br /&gt;
==Battery Warning==&lt;br /&gt;
A very last minute battery (and connector) change on the badge due to a supplier problem meant two issues arose with the badge during EMF:&lt;br /&gt;
&lt;br /&gt;
* '''Always make sure to plug your battery in the right way round!''' The new battery connector allows you to connect it backwards. We did our best to mitigate this, but connecting it incorrectly will destroy the power management controller and prevent the badge from charging or running from the battery. It will still function perfectly using USB power. &amp;quot;Red&amp;quot; and &amp;quot;Black&amp;quot; are written next to the connector - please make sure to plug it in correctly.&lt;br /&gt;
&lt;br /&gt;
* '''Be careful not to short the battery connector wires!''' The new battery connector slightly exposes the wires when the battery is plugged in. If a metal object shorts the two wires, it can result in extreme battery damage. If we'd known this was such an issue before the event we would have applied protective material to it - we suggest covering the exposed connector in tape, sugru, blu-tack, or some other insulating material. Alternatively, simply unplug the battery when your badge is not in use!&lt;br /&gt;
&lt;br /&gt;
==My badge is broken!==&lt;br /&gt;
Due to the aforementioned supplier issues it is possible that you may have received a faulty badge, or it may have been damaged by connecting the battery backwards. If you badge will not turn on when it has been plugged in with a MicroUSB cable (and the power switch on the back is set to &amp;quot;USB&amp;quot;), or something else seems wrong with it, please email [mailto:badge@emfcamp.org badge@emfcamp.org] and we'll try to fix or replace your badge.&lt;br /&gt;
&lt;br /&gt;
==Basic post-event features==&lt;br /&gt;
We made sure that the badge has a few features to play with once the event is over. More will be added over time as attendees submit changes to us.&lt;br /&gt;
&lt;br /&gt;
[[File:Badge_Back.png|right|thumb|Back]]&lt;br /&gt;
* Torch mode - Press the light button next to the screen. It will only light up fully if it's hung upside down to avoid blinding&lt;br /&gt;
* Snake&lt;br /&gt;
* Tetris&lt;br /&gt;
&lt;br /&gt;
But of course the point of the badge is to modify it and use it for other interesting things! The following sections describe how to update the firmware on the badge, how to use it as a simple arduino, and how to write your own code for the main badge firmware.&lt;br /&gt;
&lt;br /&gt;
==Getting help==&lt;br /&gt;
The EMF 2014 badge is a complex piece of hardware and software, however remember that you can just treat it as an Arduino if you find it all too daunting.&lt;br /&gt;
&lt;br /&gt;
If you get stuck and need advice, there's an [http://webchat.freenode.net/?channels=tilda active IRC chatroom] you can join to ask for advice, or if you're really stuck you can email us on [mailto:badge@emfcamp.org badge@emfcamp.org].&lt;br /&gt;
&lt;br /&gt;
=How to update the badge software &amp;amp; program the badge=&lt;br /&gt;
The badge software has been substantially updated since EMF, fixing bugs and removing features that will no longer work now you're away from our radio network. You should update your badge before starting to play with it any further. If you've never used an Arduino before this might be tricky - ask an Arduino-literate friend to help you, or drop by your nearest [http://hackspace.org.uk hackspace] and ask for advice.&lt;br /&gt;
&lt;br /&gt;
The badge is Arudino Due compatible, so [http://arduino.cc/en/Guide/ArduinoDue some of their instructions may help you if you have problems].&lt;br /&gt;
&lt;br /&gt;
==Set up your environment==&lt;br /&gt;
* Plug your badge into your computer via a MicroUSB cable. Make sure the power switch on the back is set to &amp;quot;USB&amp;quot;.&lt;br /&gt;
* Download the newest version of the Arduino IDE from http://arduino.cc/en/main/software&lt;br /&gt;
* Download the TiLDA firmware code from https://github.com/emfcamp/Mk2-Firmware&lt;br /&gt;
* Start the Arduino IDE.&lt;br /&gt;
* Now you have to change the sketchbook-folder to be the folder you just cloned or downloaded. To do this use File -&amp;gt; Preferences -&amp;gt; “Set Sketchbook location”. On MacOS, this is Arduino -&amp;gt; Preferences. &lt;br /&gt;
* Restart the Arduino IDE.&lt;br /&gt;
* Open sketch “EMF2014”.&lt;br /&gt;
* Set Tools -&amp;gt; Board to MKe v0.333 (RTOS Core).&lt;br /&gt;
* Set Tools -&amp;gt; Port to correct port for the Arduino&lt;br /&gt;
** On MacOS this is will start /dev/tty.usbmodem with 4 digits, and change for each port&lt;br /&gt;
** On Linux this is usually /dev/ttyACM0 but may be a higher number if you have other USB Serial devices&lt;br /&gt;
* Hit the upload button&lt;br /&gt;
* Wait&lt;br /&gt;
* Your badge should now be running the latest TiLDA firmware!&lt;br /&gt;
&lt;br /&gt;
==Programming the badge as an Arduino==&lt;br /&gt;
The badge is completely Arduino Due compatible, simply set the board type to &amp;quot;MKe v0.333(Arduino Core)&amp;quot; upload normal Arduino code and the badge will function. However if you want to use any of the more complex hardware on the badge (such as the screen and radio) we recommend programming it using our FreeRTOS framework documented below.&lt;br /&gt;
&lt;br /&gt;
Below is a version of the standard blink sketch that will flash the RX and TX LEDs&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  void setup() {&lt;br /&gt;
    pinMode(PIN_LED_TX, OUTPUT);&lt;br /&gt;
    pinMode(PIN_LED_RX, OUTPUT);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  void loop() {&lt;br /&gt;
      digitalWrite(PIN_LED_TX, HIGH);&lt;br /&gt;
      digitalWrite(PIN_LED_RX, LOW);&lt;br /&gt;
      delay(1000);&lt;br /&gt;
      digitalWrite(PIN_LED_TX, LOW);&lt;br /&gt;
      digitalWrite(PIN_LED_RX, HIGH);&lt;br /&gt;
      delay(1000);&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you do program the badge with simple Arduino code but wish to switch back to our official firmware, simply change the sketch to &amp;quot;EMF2014&amp;quot; (and if needed set the board type back to &amp;quot;MKe v0.333 (RTOS Core)&amp;quot;) and upload again.&lt;br /&gt;
&lt;br /&gt;
To make the badge Arduino shield compatible, follow [https://wiki.emfcamp.org/wiki/TiLDA_MKe#Making_the_badge_Arduino_shield_compatible these instructions].&lt;br /&gt;
&lt;br /&gt;
===Gotchas===&lt;br /&gt;
* Most Arduino code out there use Serial not SerialUSB. On MKe Serial is wired to the SRF radio. When using example code do a find and replace for Serial/SerialUSB this will redirect the Serial traffic of the USB port&lt;br /&gt;
* If you want to send data over the Radio you need to wake it and enable it first, set SRF_SLEEP to LOW using the following two lines of code  &amp;lt;code&amp;gt;pinMode(SRF_SLEEP, OUTPUT); digitalWrite(SRF_SLEEP, LOW);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Programming the badge in FreeRTOS==&lt;br /&gt;
===Your first “Hello world” app===&lt;br /&gt;
There’s a “HelloWorldApp.cpp” file in which you can play around. In order for it to show up on the Homescreen you have to uncomment line 51 in AppManager.cpp and flash the changed code to the badge. Great app pull requests are appreciated!&lt;br /&gt;
&lt;br /&gt;
If you are still using the Arduino IDE at this point, note that it will not let you edit the .cpp and .h files that are needed to create Apps for the badge. To force the IDE to re-compile/re-read any files you've edited using an external editor, make sure to go to the File -&amp;gt; Preferences dialog box, and check the &amp;quot;Use external editor&amp;quot; checkbox.&lt;br /&gt;
&lt;br /&gt;
===Why are things so different from standard Arduino code?===&lt;br /&gt;
We’re using a library called FreeRTOS that allows us to multitask - something that’s normally not possible with standard Arduino code. This allows us to run multiple tasks at the same time. FreeRTOS uses preemptive scheduling to switch between the task. Due to this we have to be very careful about how we do some things. For example we can’t just define interrupts for buttons in every task (imagine the mess!) or write to the serial port directly (your task might stop in the middle of the message). &lt;br /&gt;
&lt;br /&gt;
We’ve also spent quite a lot of time to make the built-in components as easy to use as possible without having every task to write lots of boilerplate code. If you feel like using the build-in components on the badge, chances are we already wrote a wrapper for them that is already used by one of the other tasks. &lt;br /&gt;
&lt;br /&gt;
Have a look at the “Documentation” section in this document for a full list of API functions. You will avoid a lot of headaches if you stick to those.&lt;br /&gt;
&lt;br /&gt;
=== Code structure ===&lt;br /&gt;
* FreeRTOS has the concept of “Tasks” which work like threads. We’ve wrappered them in a class called “Task” (for background stuff) and “Apps” (for foreground, one-at-a-time things)&lt;br /&gt;
* Everything needs to be in the main EMF2014 folder. Subfolders are not allowed. This is an Arduino IDE restriction :(&lt;br /&gt;
&lt;br /&gt;
==Debugging and Gotchas==&lt;br /&gt;
* The USB serial is set up to 115200 baud. There are lots of terminals that can connect to them. See below for how to enable the debug logging.&lt;br /&gt;
* If you can’t revive a badge, or only get the two red programming LEDs when you plug it, in, do a full erase (see below)&lt;br /&gt;
* Avoid busy waiting, use FreeRTOS queues and Tilda::delay() instead&lt;br /&gt;
* Don’t use low level functions like interrupts or serial ports directly unless you really, really know how FreeRTOS will handle them. For general logging you can use Tilda::log()&lt;br /&gt;
* If sending code to the badge using the Arduino IDE &amp;quot;Upload&amp;quot; button fails, even though the /dev/ttyACM0 (linux com port) is there, just retry, twice if neccessary.&lt;br /&gt;
&lt;br /&gt;
==Full erase==&lt;br /&gt;
This is the failsafe process if your badge won't show up over USB.&lt;br /&gt;
&lt;br /&gt;
# Unplug the badge&lt;br /&gt;
# Connect the Erase pins on the back together (two holes down the left hand side next to the battery and under the blue wireless module). You can use a jumper, jump wire, or the leg of a resistor for this.&lt;br /&gt;
# Turn the badge back on with the switch or plug it back in&lt;br /&gt;
# Press the Reset button on the front (bottom centre) and release&lt;br /&gt;
# Wait 15 seconds&lt;br /&gt;
# Unplug the badge or turn it off&lt;br /&gt;
&lt;br /&gt;
When you plug the badge back into a computer it will come back up in programming mode, with a different serial port to the usual one. Open the EMF 2014 sketch in the Arduino IDE, select the Tilda v0.333 (RTOS) programmer, and find the new serial port. The IDE console should show something like this:&lt;br /&gt;
&lt;br /&gt;
 Sketch uses 118,748 bytes (22%) of program storage space. Maximum is 524,288 bytes.&lt;br /&gt;
 Erase flash&lt;br /&gt;
 Write 127668 bytes to flash&lt;br /&gt;
 &lt;br /&gt;
 [                              ] 0% (0/499 pages)&lt;br /&gt;
 [                              ] 2% (10/499 pages)&lt;br /&gt;
 [=                             ] 4% (20/499 pages)&lt;br /&gt;
 [=                             ] 6% (30/499 pages)&lt;br /&gt;
 ...&lt;br /&gt;
 [============================= ] 98% (490/499 pages)&lt;br /&gt;
 [==============================] 100% (499/499 pages)&lt;br /&gt;
 Verify 127668 bytes of flash&lt;br /&gt;
 &lt;br /&gt;
 [                              ] 0% (0/499 pages)&lt;br /&gt;
 [                              ] 2% (10/499 pages)&lt;br /&gt;
 [=                             ] 4% (20/499 pages)&lt;br /&gt;
 [=                             ] 6% (30/499 pages)&lt;br /&gt;
 ...&lt;br /&gt;
 [============================= ] 98% (490/499 pages)&lt;br /&gt;
 [==============================] 100% (499/499 pages)&lt;br /&gt;
 Verify successful&lt;br /&gt;
 Set boot flash true&lt;br /&gt;
 CPU reset.&lt;br /&gt;
&lt;br /&gt;
==Your own wireless badge network==&lt;br /&gt;
[[DIY TiLDA Badge Network]] has instructions on how to setup your own private badge network using a RaspberryPi and two Ciseco radios.&lt;br /&gt;
&lt;br /&gt;
==Contribute==&lt;br /&gt;
Send us a pull request via [https://github.com/emfcamp/Mk2-Firmware GitHub] - We’ll do our best to review and merge the good ones during EMF so others can use them.&lt;br /&gt;
&lt;br /&gt;
=Using the badge hardware=&lt;br /&gt;
The badge has a plethora of hardware built in for you to play with, everything from accelerometers and gyroscopes to hidden ethernet headers! Breaking it all down is too much detail for this document, however we'll call out some things we built in that you might want to play with.&lt;br /&gt;
&lt;br /&gt;
Remember the badge is Arduino Due compatible, and we broke out nearly all the features of the ARM chip so you can access them. [http://arduino.cc/en/Main/ArduinoBoardDue Anything the Due can do], the TiLDA can do!&lt;br /&gt;
&lt;br /&gt;
==Making the badge Arduino shield compatible==&lt;br /&gt;
[[File:Sheild_Headers.JPG|500px|right|thumb|Sheild Headers]]&lt;br /&gt;
To make the badge Arduino shield compatible you'll need to solder simple strips of header pins onto the back of the badge. &lt;br /&gt;
You need the following headers&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Qty !! Type !! Use !! Rapid part&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 2x03 Male || SPI ||&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 1x08 Female || Power, Analog pins ||&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 1x10 Female || Digital pins ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 2x08 Male || Ethernet ||&lt;br /&gt;
|}&lt;br /&gt;
The picture to the right shows the placement.&lt;br /&gt;
&lt;br /&gt;
==Interesting things to play with==&lt;br /&gt;
Most of the interesting things are on the back of the badge. They're clearly marked in white. [https://wiki.emfcamp.org/w/images/b/bd/Badge_Back.png This diagram of the back] should allow you to locate them. Some of the following require extra parts to be added to your badge.&lt;br /&gt;
&lt;br /&gt;
* Full Arduino R3 shield compatible pins (Requires soldering the headers on the back of the badge)&lt;br /&gt;
* Pins either side of the lanyard holes for conductive thread (D19, D18, GND, 3V3)&lt;br /&gt;
* Infrared transmitter on the front (Pin shortcut IR_TX_PWM)&lt;br /&gt;
* Infrared receiver on the front (Pin shortcut IR_RX, Part Vishay TSOP75238TT available from digikey and Farnell )&lt;br /&gt;
* Piezo buzzer (Pin shortcut PIEZO or PIEZO_PWM)&lt;br /&gt;
* On-board ethernet (not available on the Due) - requires breakout module (eBay: Elechouse Taijiuino Ethernet PHY DM9161 Module)&lt;br /&gt;
* [http://www.invensense.com/mems/gyro/mpu6050.html MPU-6050] 3-axis Accelerometer and 3-axis gyro (IMUTask.cpp and the MPU6050 library)&lt;br /&gt;
* 128x64 pixel backlit LCD display (JHD12864, see [https://github.com/emfcamp/Mk2-Documentation/tree/master/LCD%20JHD12864 here for docs])&lt;br /&gt;
* [http://shop.ciseco.co.uk/srf-wireless-rf-radio-surface-mount/ Ciseco SRF Radio]&lt;br /&gt;
* [http://shop.ciseco.co.uk/powerpod-ncp1402-5v0/ PowerPOD NCP1402] interface, used to generate 5V from 3V3 battery supply power (needed for some shields)&lt;br /&gt;
* MicroSD adapter breakout (Molex 1050270001 available from digikey)&lt;br /&gt;
* Compass (magnetometer) breakout (HMC HMC5883L-TR available from digikey and Farnell)&lt;br /&gt;
* Reprogramming headers for the 868Mhz [http://www.ti.com/product/cc1110f32 CC1110 radio module]&lt;br /&gt;
* 1 megabit flash module (Part S25FL216K0PMFI011)&lt;br /&gt;
* SPI breakout&lt;br /&gt;
* 2x RGB LEDs on the front &lt;br /&gt;
* FTDI header (shared with SRF Radio)&lt;br /&gt;
* JTAG header (Part M50-3500542 available form Farnell&lt;br /&gt;
&lt;br /&gt;
==Included hardware==&lt;br /&gt;
&lt;br /&gt;
The following hardware has been included on the badge.&lt;br /&gt;
&lt;br /&gt;
* [http://www.atmel.com/products/microcontrollers/arm/sam3x.aspx Atmel ATSAM3X8E]&lt;br /&gt;
** This is the same chip as the [http://arduino.cc/en/Main/ArduinoBoardDue Arduino Due] and gives us the base platform for the badge&lt;br /&gt;
** 32bit ARM Cortex M3 * 84MHz&lt;br /&gt;
** 512KBytes Flash RAM&lt;br /&gt;
** 96KBytes of SRAM&lt;br /&gt;
* A 128x64 pixel monochrome LCD display&lt;br /&gt;
* [http://shop.ciseco.co.uk/srf-wireless-rf-radio-surface-mount/ Ciseco SRF Radio]&lt;br /&gt;
** 868Mhz RF Transceiver&lt;br /&gt;
** Simple UART interface&lt;br /&gt;
** Low power sleep mode&lt;br /&gt;
* [http://www.invensense.com/mems/gyro/mpu6050.html MPU-6050] 3-axis Accelerometer and 3-axis gyro&lt;br /&gt;
** I2C interface&lt;br /&gt;
** Tri-Axis angular rate sensor (gyro) with a sensitivity up to 131 LSBs/dps and a full-scale range of ±250, ±500, ±1000, and ±2000dps&lt;br /&gt;
** Tri-Axis accelerometer with a programmable full scale range of ±2g, ±4g, ±8g and ±16g&lt;br /&gt;
** Digital Motion Processing™ (DMP™) engine offloads complex MotionFusion, sensor timing synchronisation and gesture detection&lt;br /&gt;
* PMIC &amp;amp; LiPo&lt;br /&gt;
* Joystick, 4 way with click&lt;br /&gt;
* Buttons&lt;br /&gt;
* RGB LEDs&lt;br /&gt;
* IR Transmitter&lt;br /&gt;
* Arduino Headers&lt;br /&gt;
* Pads for wearable tech&lt;br /&gt;
&lt;br /&gt;
=Useful Hacks!=&lt;br /&gt;
==3d printable &amp;amp; laser-cuttable badge case==&lt;br /&gt;
Draft 3d print-able and laser-able case files [http://www.thingiverse.com/thing:436815 here]&lt;br /&gt;
==Convert images to TiLDA bitmap format==&lt;br /&gt;
* A Python script (via [https://twitter.com/trotmaster99 @trotmaster99]) that converts a monochrome bitmap image into a format suitable for the Tilda can be found [http://pastebin.com/8XeazQjT here].&lt;br /&gt;
* A similar script in Perl to create TiLDA MKe fullscreen bitmaps from XBM: -&lt;br /&gt;
&amp;lt;div style =&amp;quot;height:200px;overflow-x:hidden;overflow-y:auto;border: 4px solid orange;&amp;quot;&amp;gt;&lt;br /&gt;
'''xbm2mke.pl by [[User:Msemtd]]'''&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!perl -w&lt;br /&gt;
use strict;&lt;br /&gt;
# Little script to convert a regular XBM to TiLDA MKe bitmap&lt;br /&gt;
# only tested with fullscreen bitmaps!&lt;br /&gt;
# Hot file handle magic...&lt;br /&gt;
select((select(STDERR), $| = 1)[0]);&lt;br /&gt;
select((select(STDOUT), $| = 1)[0]);&lt;br /&gt;
sub t(@);&lt;br /&gt;
sub d($);&lt;br /&gt;
sub chug($);&lt;br /&gt;
my $f = shift;&lt;br /&gt;
#~ $f = 'blankish.xbm' if not $f;&lt;br /&gt;
if(not defined $f or not $f =~ /^(.*)\.xbm$/i){&lt;br /&gt;
    die &amp;quot;Usage: gimme an XBM file dude!\n&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
my $name = $1;&lt;br /&gt;
t &amp;quot;Reading file '$f'...&amp;quot;;&lt;br /&gt;
my $data = chug($f);&lt;br /&gt;
t &amp;quot;OK&amp;quot;;&lt;br /&gt;
my @lines = split /^/, $data;&lt;br /&gt;
@lines = grep{chomp; s/^\s+//; s/\s+$//; length;} @lines;&lt;br /&gt;
#~ t d \@lines;&lt;br /&gt;
my($width, $height) = (0,0);&lt;br /&gt;
my @head = @lines[0..5];&lt;br /&gt;
foreach(@head){&lt;br /&gt;
    if(/_width\s+(\d+)/){$width = $1;}&lt;br /&gt;
    if(/_height\s+(\d+)/){$height = $1;}&lt;br /&gt;
}&lt;br /&gt;
t &amp;quot;width x height = $width x $height&amp;quot;;&lt;br /&gt;
my @k;&lt;br /&gt;
foreach(@lines){ push @k, split /,/; }&lt;br /&gt;
@k = grep { s/^.*(0x[0-9A-Fa-f]{1,2}).*$/$1/o; /(0x[0-9A-Fa-f]{1,2})/o } @k;&lt;br /&gt;
#~ t d \@k;&lt;br /&gt;
my $bc = scalar(@k);&lt;br /&gt;
t &amp;quot;Pulled out $bc hex bytes&amp;quot;;&lt;br /&gt;
if($bc != $width * $height / 8) {&lt;br /&gt;
    die &amp;quot;byte count $bc does not match that expected for w x h&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
t &amp;quot;OK - reorder bytes for MKe bitmap&amp;quot;;&lt;br /&gt;
my $wb = int($width/8) + (($width &amp;amp; 0x07) ? 1: 0);&lt;br /&gt;
t &amp;quot;width in whole bytes for $width pixels = $wb&amp;quot;;&lt;br /&gt;
my @mke;&lt;br /&gt;
for(my $col = 0; $col &amp;lt; $wb; $col++){&lt;br /&gt;
    for(my $row = $height - 1; $row &amp;gt;= 0; $row--){&lt;br /&gt;
        my $idx = ($row * $wb) + $col;&lt;br /&gt;
        my $val = $k[$idx];&lt;br /&gt;
        #~ t &amp;quot;Column $col + Row $row = idx $idx = $val&amp;quot;;&lt;br /&gt;
        push @mke, $val;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
my $out = &amp;quot;static const uint8_t &amp;quot;.uc($name).&amp;quot;_BM[] = {\n&amp;quot;&lt;br /&gt;
	.&amp;quot;    $width, // width\n&amp;quot;&lt;br /&gt;
	.&amp;quot;    $height , // height\n&amp;quot;;&lt;br /&gt;
#~ $out .= join(&amp;quot;, &amp;quot;, @mke);&lt;br /&gt;
while(scalar @mke){&lt;br /&gt;
	$out .= join(&amp;quot;, &amp;quot;, splice(@mke, 0, 16)).&amp;quot;,\n&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
$out .= &amp;quot;};\n&amp;quot;;&lt;br /&gt;
# meh, just print it out&lt;br /&gt;
t $out;&lt;br /&gt;
&lt;br /&gt;
sub t(@) {&lt;br /&gt;
    foreach (@_) {&lt;br /&gt;
       print STDOUT &amp;quot;$_\n&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
sub d($) {&lt;br /&gt;
    require Data::Dumper;&lt;br /&gt;
    my $s = $_[0];&lt;br /&gt;
    my $d = Data::Dumper::Dumper($s);&lt;br /&gt;
    $d =~ s/^\$VAR1 =\s*//;&lt;br /&gt;
    $d =~ s/;$//;&lt;br /&gt;
    chomp $d;&lt;br /&gt;
    return $d;&lt;br /&gt;
}&lt;br /&gt;
sub chug($) {&lt;br /&gt;
  my $filename = shift;&lt;br /&gt;
  local *F;&lt;br /&gt;
  open F, &amp;quot;&amp;lt; $filename&amp;quot; or die &amp;quot;Couldn't open `$filename': $!&amp;quot;;&lt;br /&gt;
  local $/ = undef;&lt;br /&gt;
  return &amp;lt;F&amp;gt;;&lt;br /&gt;
}  # F automatically closed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;span id=github&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Source =&lt;br /&gt;
&lt;br /&gt;
All the source code and designs are on openly available on Github:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Hardware Hardware] - the full board design&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Documentation Documentation] - a dump of relevant parts datasheets&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Firmware Firmware] - source code for the badge software&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Software Software] - server-side software for the network&lt;br /&gt;
&lt;br /&gt;
If you want to help, point your IRC client to #tilda on Freenode.&lt;br /&gt;
&lt;br /&gt;
= Firmware Documentation =&lt;br /&gt;
== Debugging ==&lt;br /&gt;
===Enabling the USB serial debug log messages===&lt;br /&gt;
To enable the debug logging you must uncomment the following line in [https://github.com/emfcamp/Mk2-Firmware/blob/master/hardware/emfcamp/sam/libraries/debug/debug.h#L42 hardware/emfcamp/sam/libraries/debug/debug.h]&lt;br /&gt;
&lt;br /&gt;
 // Enable debug task and output&lt;br /&gt;
 // #define DEBUG 1&lt;br /&gt;
&lt;br /&gt;
===Tilda::log(String text)===&lt;br /&gt;
&lt;br /&gt;
This logs “text” to the serial console. To read it connect to it via the Arduino IDE Serial Monitor. Don’t use “SerialUSB.println” or similar -- it’s not thread-safe and you might end up with utter nonsense.&lt;br /&gt;
&lt;br /&gt;
===Debugging using the JTAG interface===&lt;br /&gt;
The JTAG interface on the board provides powerful debugging facilities like breakpoints, backtraces, dumping memory, inspecting variables, checking task states, catching exeptions etc. To make this to work requires additional hardware and software, see [[TiLDA Debugging using JTAG]].&lt;br /&gt;
&lt;br /&gt;
== Buttons ==&lt;br /&gt;
The badge has 8 buttons: Up, Down, Left, Right, Center (on the joystick), A, B and Light. You can use arduino-style “digitalRead(BUTTON_RIGHT)” to read the current status of any button, but you can’t define your own interrupt (because we already did that). This doesn’t mean you can’t wait for a certain button to be pressed, it just means you have to approach it slightly differently:&lt;br /&gt;
&lt;br /&gt;
Example: A simple app displaying the button code&lt;br /&gt;
 void ButtonApp::task() {&lt;br /&gt;
     ButtonSubscription allButtons = Tilda::createButtonSubscription(LIGHT | A | B | UP | DOWN | LEFT | RIGHT | CENTER);&lt;br /&gt;
 &lt;br /&gt;
     while(true) {&lt;br /&gt;
         Button button = allButtons.waitForPress(1000);&lt;br /&gt;
         if (button == A) {&lt;br /&gt;
             debug::log(“You pressed button A”);&lt;br /&gt;
         } else if (button == LEFT) {&lt;br /&gt;
             debug::log(“You pressed LEFT”);&lt;br /&gt;
         } else if (button == NONE) {&lt;br /&gt;
             debug::log(“No button has been pressed in 1000ms”); &lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription Tilda::createButtonSubscription(&amp;lt;buttons&amp;gt;)===&lt;br /&gt;
&lt;br /&gt;
Registers a subscriptions for a defined set of buttons and returns a ButtonSubscription. Multiple Buttons can be combined via “|” (see example above). One button can not be subscribed by more than 10 subscriptions (which shouldn’t really happen, but keep it in mind). &lt;br /&gt;
&lt;br /&gt;
Don’t use this function in a constructor, it requires FreeRTOS to be running. Using it inside the task() function is the only safe place for it.&lt;br /&gt;
&lt;br /&gt;
===Button ButtonSubscription::waitForPress(TimeInTicks timeout)===&lt;br /&gt;
&lt;br /&gt;
This is normally called in a loop. It causes the task to block until one of the buttons has been pressed. If the timeout occurs before any button has been pressed “NONE” will be returned. &lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::waitForPress()===&lt;br /&gt;
&lt;br /&gt;
The same as above, but without the timeout.&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::clear()===&lt;br /&gt;
&lt;br /&gt;
This should be called after an App has been suspended, just before it’s going to be resumed. It causes the Queue to be cleared which could otherwise lead to buttons being reported that have been pressed while other apps were in the foreground. Have a look at the FlashLightApp for an example.&lt;br /&gt;
&lt;br /&gt;
==LEDs==&lt;br /&gt;
===Tilda::setLedColor(Led led, Color color);===&lt;br /&gt;
===Tilde::setLedColor(Color color);===&lt;br /&gt;
&lt;br /&gt;
Sets the color of all or one led. Color is an object that takes red, green and blue as a value between 0 and 255 each. If no led is defined both leds will be set to the same color.&lt;br /&gt;
&lt;br /&gt;
Example: A simple color-changing task&lt;br /&gt;
 void ColorfulTask::task() {&lt;br /&gt;
     while(true) {&lt;br /&gt;
         Tilda::setLedColor(LED1, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::setLedColor(LED2, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Display==&lt;br /&gt;
&lt;br /&gt;
The Display Library is based on GLCDv3 (http://playground.arduino.cc/Code/GLCDks0108), docs (http://code.google.com/p/glcd-arduino/source/browse/trunk/glcd/doc/GLCD_Documentation.pdf) but adapted to support our screen.  The Init routine is called in the setup, and the LCDTask takes care of ensuring the screen is updated every 40ms if required (Unlike the original GLCD library, screen updates are decoupled from the graphics routines.)&lt;br /&gt;
&lt;br /&gt;
Also available is M2tklib (https://code.google.com/p/m2tklib/) which is a nice toolkit library.  Further details on using this will come later, but expect the main loop to be handled for you, and just passing the menu structure you require for your app.&lt;br /&gt;
&lt;br /&gt;
Right now, you can call the GLCD functions directly with GLCD.DrawBitmap() for example.  This is going to change to be accessed through the GUITask class in the near future, to ensure only one task at a time writes to the screen.  Expect this to be simply GUITask in place of GLCD, along with a registering a redraw call back to GUITask. The bitmap format, by the way, is rather unconventional but there are a couple of utility scripts to convert popular formats down in the hacking section below - you can grab the SponsorsApp.h as an example and swap out the bitmap array with one of your choosing.&lt;br /&gt;
&lt;br /&gt;
Extra features that are included, GLCD.SetRotation() will handle rotation of the screen for you, and GLCD.CurrentWidth() and GLCD.CurrentHeight will give you the correct Width and Height for the current orientation.  GLCD.Width and GLCD.Height constants are not available, and the GLCD predefined Text areas will not be rotated for you, if you require this define your own text areas.&lt;br /&gt;
&lt;br /&gt;
Note that one function was not ported to the badge version of GLCD, &amp;quot;Printf&amp;quot;, you'll have to cope without it.&lt;br /&gt;
&lt;br /&gt;
== Sound == &lt;br /&gt;
There's a fully working Piezo on board!&lt;br /&gt;
&lt;br /&gt;
== IMU ==&lt;br /&gt;
=== Tilda::getOrientation ===&lt;br /&gt;
returns &amp;quot; ORIENTATION_HELD&amp;quot;, &amp;quot;ORIENTATION_RIGHT&amp;quot; (joystick to the right of the screen), &amp;quot;ORIENTATION_HUNG&amp;quot; or &amp;quot;ORIENTATION_LEFT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Flash Storage ==&lt;br /&gt;
We have 2mb of flash storage, but we're not using it in the main firmware - Please get this working!&lt;br /&gt;
== Data: Schedule ==&lt;br /&gt;
===Tilda::getDataStore().getSchedule(day, location) ===&lt;br /&gt;
== Date: Weather Forecast ==&lt;br /&gt;
===Tilda::getDataStore().getWeatherForecast()===&lt;br /&gt;
== Radio ==&lt;br /&gt;
There's no way of sending messages in the current version of the firmware, sorry :(&lt;br /&gt;
&lt;br /&gt;
== Time ==&lt;br /&gt;
&lt;br /&gt;
=== Tilda::delay(uint16_t delayInMs) === &lt;br /&gt;
&lt;br /&gt;
Works like Arduino’s delay(), but is FreeRTOS-safe. It’s safe to use this function before FreeRTOS has started.&lt;br /&gt;
&lt;br /&gt;
=== tilda::getClock() ===&lt;br /&gt;
&lt;br /&gt;
Returns an instance of https://github.com/MarkusLange/Arduino-Due-RTC-Library/blob/master/rtc_clock.h&lt;br /&gt;
&lt;br /&gt;
==Settings==&lt;br /&gt;
===uint16_t tilda::getBadgeId()===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Battery==&lt;br /&gt;
===float TiLDA::getBatteryVoltage()===&lt;br /&gt;
Returns the current voltage as a float&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getBatteryPercent()===&lt;br /&gt;
Returns the current voltage as a percentage&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getChargeState()===&lt;br /&gt;
Returns the charge state&lt;br /&gt;
&lt;br /&gt;
0 Charging&lt;br /&gt;
1 Not Charging&lt;br /&gt;
&lt;br /&gt;
[[Category: Badges]]&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_Debugging_using_JTAG&amp;diff=3764</id>
		<title>TiLDA Debugging using JTAG</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_Debugging_using_JTAG&amp;diff=3764"/>
		<updated>2014-10-01T23:42:38Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: /* Running GDB */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA badge has a JTAG port which can be used to perform remote firmware debugging. With the right hardware and software you can use this to run a GDB session on your development machine to insert breakpoints, inspect memory and poke around with the firmware running on the badge just like it was a local process running on your machine. &lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
''I started the list below with the parts that worked for me. Feel free to add alternatives if you know they work for you.''&lt;br /&gt;
* X86-64 Linux machine for building the firmware and running GDB&lt;br /&gt;
* TiLDA badge&lt;br /&gt;
** Plus micro USB cable for connecting TiLDA to development machine&lt;br /&gt;
* JTAG header, 10 way (2 x 5 pins) 0.05&amp;quot; (or 1.27mm) through hole&lt;br /&gt;
** e.g. Samtec FTS-105-01-L-D&lt;br /&gt;
** or Harwin M50-3500542 (part number from the TiLDA schematic)&lt;br /&gt;
* Fine tipped soldering iron&lt;br /&gt;
* [https://www.olimex.com/Products/ARM/JTAG/ARM-USB-TINY-H/ Olimex ARM-USB-TINY-H] USB JTAG Interface&lt;br /&gt;
** Plus USB type A to B cable (the original &amp;amp; large square plug)&lt;br /&gt;
* [https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-20-10/ Olimex ARM-JTAG-20-10] 20pin to 10pin adapter&lt;br /&gt;
* [http://openocd.sourceforge.net/ OpenOCD] software.&lt;br /&gt;
** This can control the Olimex JTAG interface and implements the GDB remote server protocol to talk with the debugger&lt;br /&gt;
* GDB&lt;br /&gt;
** I used gdb-7.7.1-18.fc20.x86_64.&lt;br /&gt;
* Arduino 1.5.7 tools&lt;br /&gt;
** For building &amp;amp; installing the firmware image&lt;br /&gt;
&lt;br /&gt;
== Attach JTAG Header to badge ==&lt;br /&gt;
The header must be attached on the correct side of the board otherwise it won't work. The pins on the two sides of the header are slightly different, one side is tin coated and appears silver/grey. These are the ones you should be soldering. The gold plated side should to be used by the connector.&lt;br /&gt;
&lt;br /&gt;
[[File:jtag-header.jpg|150px|thumb|center|text-top|JTAG header before being soldered on to the board]]&lt;br /&gt;
[[File:jtag-header-in-place-highlight.jpg|300px|thumb|center|text-top|TiLDA with new JTAG header highlighted]]&lt;br /&gt;
&lt;br /&gt;
Flip the board upside down and solder pins from the LCD side. The pitch is only 1.27mm (0.05&amp;quot;) which is half the size of most normal connectors so you need a steady hand. After you have soldered the pins it is a good idea to test for any short circuits before you power it on. &lt;br /&gt;
&lt;br /&gt;
[[File:jtag-header-solder-side.jpg|200px|thumb|center|text-top|Header soldered on LCD side of the board]]&lt;br /&gt;
&lt;br /&gt;
== Olimex adapter and USB-TINY-H ==&lt;br /&gt;
The cable from the Olimex adaper should be connected to the header so that the cable runs away from the board. Once again you may wish to check the connections appear to be the right way around, e.g. pin 1 on the adapter board connects to the 3v3 test point on the TiLDA. Connect the 20 pin side of the adapter into the main USB-TINY, this is keyed so it only fits one way around.&lt;br /&gt;
&lt;br /&gt;
[[File:board-with-adapter.jpg|300px|thumb|center|text-top|TiLDA connected to Olimex TINY-Y]]&lt;br /&gt;
&lt;br /&gt;
Plug the USB-TINY into a USB port on your machine. The 'dmesg' output should report something like:&lt;br /&gt;
&lt;br /&gt;
 usb 2-2: new high-speed USB device number 111 using ehci-pci&lt;br /&gt;
 usb 2-2: New USB device found, idVendor=15ba, idProduct=002a&lt;br /&gt;
 usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3&lt;br /&gt;
 usb 2-2: Product: Olimex OpenOCD JTAG ARM-USB-TINY-H&lt;br /&gt;
 usb 2-2: SerialNumber: OLXxxxxx&lt;br /&gt;
&lt;br /&gt;
== Atmel ICE Basic ==&lt;br /&gt;
If you use an Atmel ICE then the cable needs to be connected so that it runs over the top of the board. The red stripe indicates pin 1. &lt;br /&gt;
[[File:CIMG1383.JPG|300pix|thumb|center|text-top|TiLDA connected to Atmel ICE Basic]]&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[jburgess@shark openocd]$ sudo openocd -f interface/cmsis-dap.cfg -f target/at91sam3XXX.cfg &lt;br /&gt;
Open On-Chip Debugger 0.9.0-dev-00161-g9c47dc9-dirty (2014-09-30-23:42)&lt;br /&gt;
Licensed under GNU GPL v2&lt;br /&gt;
For bug reports, read&lt;br /&gt;
        http://openocd.sourceforge.net/doc/doxygen/bugs.html&lt;br /&gt;
Info : only one transport option; autoselect 'cmsis-dap'&lt;br /&gt;
adapter speed: 500 kHz&lt;br /&gt;
adapter_nsrst_delay: 100&lt;br /&gt;
cortex_m reset_config sysresetreq&lt;br /&gt;
Info : CMSIS-DAP: SWD  Supported&lt;br /&gt;
Info : CMSIS-DAP: JTAG Supported&lt;br /&gt;
Info : CMSIS-DAP: Interface Initialised (SWD)&lt;br /&gt;
Info : CMSIS-DAP: FW Version = 01.00.0021&lt;br /&gt;
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 0 nTRST = 0 nRESET = 1&lt;br /&gt;
Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0)&lt;br /&gt;
Info : CMSIS-DAP: Interface ready&lt;br /&gt;
Info : clock speed 500 kHz&lt;br /&gt;
Info : IDCODE 0x2ba01477&lt;br /&gt;
Info : sam3.cpu: hardware has 6 breakpoints, 4 watchpoints&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Install OpenOCD ==&lt;br /&gt;
I started with the current version available in the Fedora package repository (openocd-0.7.0-3.fc20.x86_64). Other Linux distros are likely to have packaged too. &lt;br /&gt;
&lt;br /&gt;
=== OpenOCD stack pointer bug ===&lt;br /&gt;
After I got everything running I noticed that the GDB backtraces would show the current function (PC) and the caller (LR) but all further stack entries were missing. After some debugging I found that OpenOCD was incorrectly calculating the stack pointer when it tried to align it. I applied a quick fix to disable the broken alignment code:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
--- openocd-0.7.0/src/rtos/rtos.c.bak   2014-09-14 17:28:10.000000000 +0100&lt;br /&gt;
+++ openocd-0.7.0/src/rtos/rtos.c       2014-09-14 17:29:39.000000000 +0100&lt;br /&gt;
@@ -454,12 +454,16 @@&lt;br /&gt;
        tmp_str_ptr = *hex_reg_list;&lt;br /&gt;
        new_stack_ptr = stack_ptr - stacking-&amp;gt;stack_growth_direction *&lt;br /&gt;
                stacking-&amp;gt;stack_registers_size;&lt;br /&gt;
+#if 0&lt;br /&gt;
+       // This code gives bad results for already aligned pointers&lt;br /&gt;
+       // and negative stack growth&lt;br /&gt;
        if (stacking-&amp;gt;stack_alignment != 0) {&lt;br /&gt;
                /* Align new stack pointer to x byte boundary */&lt;br /&gt;
                new_stack_ptr =&lt;br /&gt;
                        (new_stack_ptr &amp;amp; (~((int64_t) stacking-&amp;gt;stack_alignment - 1))) +&lt;br /&gt;
                        ((stacking-&amp;gt;stack_growth_direction == -1) ? stacking-&amp;gt;stack_alignment : 0);&lt;br /&gt;
        }&lt;br /&gt;
+#endif&lt;br /&gt;
        for (i = 0; i &amp;lt; stacking-&amp;gt;num_output_registers; i++) {&lt;br /&gt;
                int j;&lt;br /&gt;
                for (j = 0; j &amp;lt; stacking-&amp;gt;register_offsets[i].width_bits/8; j++) {&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I reported the bug to the OpenOCD developers and proper fix will hopefully arrive in the trunk code soon: http://openocd.zylin.com/#/c/2301/ (an initial fix was committed but has since been reverted because it was broken for a different case).&lt;br /&gt;
&lt;br /&gt;
====Alternative (Debian/Ubuntu) ====&lt;br /&gt;
&lt;br /&gt;
To do this you can download the code from http://sourceforge.net/projects/openocd/files/openocd/0.8.0/ and apply this patch http://openocd.zylin.com/#/c/2301/3/src/rtos/rtos.c,cm . &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
sudo apt-get install libusb-dev libusb-1.0-0-dev&lt;br /&gt;
./configure --enable-armjtagew&lt;br /&gt;
make &lt;br /&gt;
sudo make install&lt;br /&gt;
./configure &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== OpenOCD configuration file ==&lt;br /&gt;
OpenOCD requires a set of configuration commands describing both the JTAG adapter and the target CPU/board. Copy this into a file called tilda.cfg:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
# Recommended for OpenOCD-0.7&lt;br /&gt;
# script interface/olimex-arm-usb-tiny-h.cfg&lt;br /&gt;
&lt;br /&gt;
# Recommended for OpenOCD-0.8&lt;br /&gt;
script interface/ftdi/olimex-arm-usb-tiny-h.cfg&lt;br /&gt;
&lt;br /&gt;
# script for ATMEL sam3, a CORTEX-M3 chip&lt;br /&gt;
script target/at91sam3XXX.cfg&lt;br /&gt;
&lt;br /&gt;
$_TARGETNAME configure -rtos FreeRTOS&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Run OpenOCD ===&lt;br /&gt;
OpenOCD uses libusb to access the device and may need to run with sudo for it to work. If everything is connected together and the badge is powered on then you should see it detecting the CPU core as shown below:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ sudo openocd -f tilda.cfg&lt;br /&gt;
Open On-Chip Debugger 0.8.0 (2014-09-17-20:52)&lt;br /&gt;
Licensed under GNU GPL v2&lt;br /&gt;
For bug reports, read&lt;br /&gt;
        http://openocd.sourceforge.net/doc/doxygen/bugs.html&lt;br /&gt;
Info : only one transport option; autoselect 'jtag'&lt;br /&gt;
adapter speed: 500 kHz&lt;br /&gt;
adapter_nsrst_delay: 100&lt;br /&gt;
jtag_ntrst_delay: 100&lt;br /&gt;
cortex_m reset_config sysresetreq&lt;br /&gt;
Info : clock speed 500 kHz&lt;br /&gt;
Info : JTAG tap: sam3.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)&lt;br /&gt;
Info : sam3.cpu: hardware has 6 breakpoints, 4 watchpoints&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CMSIS DAP ===&lt;br /&gt;
If you us an an CMSIS DAP compliant adapter such as the [[http://uk.farnell.com/atmel/atatmel-ice-basic/debugger-atmel-arm-avr-basic-kit/dp/2407172 Atmel ICE]] then OpenOCD can be run with &amp;lt;code&amp;gt;interface/cmsis-dap.cfg&amp;lt;/code&amp;gt; e.g.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ sudo openocd -f interface/cmsis-dap.cfg -f target/at91sam3XXX.cfg&lt;br /&gt;
Open On-Chip Debugger 0.9.0-dev-00161-g9c47dc9-dirty (2014-09-30-23:42)&lt;br /&gt;
Licensed under GNU GPL v2&lt;br /&gt;
For bug reports, read&lt;br /&gt;
        http://openocd.sourceforge.net/doc/doxygen/bugs.html&lt;br /&gt;
Info : only one transport option; autoselect 'cmsis-dap'&lt;br /&gt;
adapter speed: 500 kHz&lt;br /&gt;
adapter_nsrst_delay: 100&lt;br /&gt;
cortex_m reset_config sysresetreq&lt;br /&gt;
Info : CMSIS-DAP: SWD  Supported&lt;br /&gt;
Info : CMSIS-DAP: JTAG Supported&lt;br /&gt;
Info : CMSIS-DAP: Interface Initialised (SWD)&lt;br /&gt;
Info : CMSIS-DAP: FW Version = 01.00.0021&lt;br /&gt;
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 0 nTRST = 0 nRESET = 1&lt;br /&gt;
Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0)&lt;br /&gt;
Info : CMSIS-DAP: Interface ready&lt;br /&gt;
Info : clock speed 500 kHz&lt;br /&gt;
Info : IDCODE 0x2ba01477&lt;br /&gt;
Info : sam3.cpu: hardware has 6 breakpoints, 4 watchpoints&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
This seems to be a little slower at single-stepping the code than the Olimex adapter but is a little cheaper and in theory provides a more flexible debug interface (SWD).&lt;br /&gt;
&lt;br /&gt;
== Patch TiLDA firmware for OpenOCD FreeRTOS detection ==&lt;br /&gt;
The OpenOCD code knows how to find the FreeRTOS tasks and can use this to make each task running on the badge as a different thread in GDB. To make this work you need to apply a small patch to the TiLDA code. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
diff --git a/EMF2014/TiLDATask.cpp b/EMF2014/TiLDATask.cpp&lt;br /&gt;
index 2cdc08d..701f940 100644&lt;br /&gt;
--- a/EMF2014/TiLDATask.cpp&lt;br /&gt;
+++ b/EMF2014/TiLDATask.cpp&lt;br /&gt;
@@ -58,6 +58,8 @@&lt;br /&gt;
 #include &amp;quot;logo.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;TiLDA_64x128.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
+// Hack to make FreeRTOS support work in OpenOCD&lt;br /&gt;
+unsigned portBASE_TYPE uxTopUsedPriority;&lt;br /&gt;
 &lt;br /&gt;
 TiLDATask::TiLDATask() {&lt;br /&gt;
 &lt;br /&gt;
@@ -68,6 +70,10 @@ String TiLDATask::getName() const {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TiLDATask::task() {&lt;br /&gt;
+&lt;br /&gt;
+    // Hack to make FreeRTOS support work in OpenOCD&lt;br /&gt;
+    uxTopUsedPriority = configMAX_PRIORITIES - 1;&lt;br /&gt;
+&lt;br /&gt;
     Tilda::_realTimeClock = new RTC_clock(RC);&lt;br /&gt;
     Tilda::_appManager = new AppManager;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This adds a variable that the OpenOCD expects to be able to read from the target to determine how many queues are being used by the FreeRTOS scheduler. This was present in older FreeRTOS release but has since been removed.&lt;br /&gt;
&lt;br /&gt;
== Build and flash the badge firmware ==&lt;br /&gt;
To make the debugger work you must be sure that the firmware running on the badge exactly matches the source code and binary objects that you have locally on your development machine. I recommend you apply the patch from the previous section, build the TiLDA firmware and upload it to your badge before you go any further.&lt;br /&gt;
&lt;br /&gt;
In the Arduino IDE you should build firmware (EMF2014 sketch) and upload it via the USB port on the TiLDA badge. (I have not attempted to upload firmware via the JTAG interface but that should be possible as well). The IDE writes a copy of the object files and the final executable to a directory in /tmp whenever you build the code. The firmware image file is &amp;lt;code&amp;gt;EMF2014.cpp.elf&amp;lt;/code&amp;gt; and you want to find the most recently built one, e.g.&lt;br /&gt;
&lt;br /&gt;
 [jburgess@shark]$ ls -lt /tmp/build*/EMF2014.cpp.elf | head -n 1&lt;br /&gt;
 -rwxrwxr-x. 1 jburgess jburgess 1475463 Sep 14 22:53 /tmp/build9091009552223609902.tmp/EMF2014.cpp.elf&lt;br /&gt;
&lt;br /&gt;
== Running GDB ==&lt;br /&gt;
First locate the EMF2014.cpp.elf file mentioned in the previous section. Run gdb with this file and with any luck it should be able to load it:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[jburgess@shark tmp]$ gdb /tmp/build9091009552223609902.tmp/EMF2014.cpp.elf&lt;br /&gt;
GNU gdb (GDB) Fedora 7.7.1-18.fc20&lt;br /&gt;
Copyright (C) 2014 Free Software Foundation, Inc.&lt;br /&gt;
License GPLv3+: GNU GPL version 3 or later &amp;lt;http://gnu.org/licenses/gpl.html&amp;gt;&lt;br /&gt;
This is free software: you are free to change and redistribute it.&lt;br /&gt;
There is NO WARRANTY, to the extent permitted by law.  Type &amp;quot;show copying&amp;quot;&lt;br /&gt;
and &amp;quot;show warranty&amp;quot; for details.&lt;br /&gt;
This GDB was configured as &amp;quot;x86_64-redhat-linux-gnu&amp;quot;.&lt;br /&gt;
Type &amp;quot;show configuration&amp;quot; for configuration details.&lt;br /&gt;
For bug reporting instructions, please see:&lt;br /&gt;
&amp;lt;http://www.gnu.org/software/gdb/bugs/&amp;gt;.&lt;br /&gt;
Find the GDB manual and other documentation resources online at:&lt;br /&gt;
&amp;lt;http://www.gnu.org/software/gdb/documentation/&amp;gt;.&lt;br /&gt;
For help, type &amp;quot;help&amp;quot;.&lt;br /&gt;
Type &amp;quot;apropos word&amp;quot; to search for commands related to &amp;quot;word&amp;quot;...&lt;br /&gt;
Reading symbols from /tmp/build9091009552223609902.tmp/EMF2014.cpp.elf...done.&lt;br /&gt;
(gdb) &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Check debug symbols ===&lt;br /&gt;
Next try some simple commands to see whether GDB knows where symbols are located in the binary and source:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) info line main&lt;br /&gt;
Line 43 of &amp;quot;/home/jburgess/Documents/emf/Mk2-Firmware/hardware/emfcamp/sam/cores/rtos/main.cpp&amp;quot; starts at address 0x8fe78 &amp;lt;main()&amp;gt; and ends at 0x8fe7a &amp;lt;main()+2&amp;gt;.&lt;br /&gt;
(gdb) list main&lt;br /&gt;
38&lt;br /&gt;
39      /*&lt;br /&gt;
40       * \brief Main entry point of Arduino application&lt;br /&gt;
41       */&lt;br /&gt;
42      int main( void )&lt;br /&gt;
43      {&lt;br /&gt;
44              init();&lt;br /&gt;
45&lt;br /&gt;
46              initVariant();&lt;br /&gt;
47&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If something goes wrong at this point you could try using the copy of GDB provided with the arduino tools instead, e.g. &amp;lt;code&amp;gt;arduino-1.5.7/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-gdb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Attach GDB to OpenOCD ===&lt;br /&gt;
The OpenOCD supports a couple of different interfaces. Before we try GDB we should first stop the CPU using the basic control interface and tell it to halt the CPU:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ telnet localhost 4444&lt;br /&gt;
Trying 127.0.0.1...&lt;br /&gt;
Connected to localhost.&lt;br /&gt;
Escape character is '^]'.&lt;br /&gt;
Open On-Chip Debugger&lt;br /&gt;
&amp;gt; halt&lt;br /&gt;
target state: halted&lt;br /&gt;
target halted due to debug-request, current mode: Thread &lt;br /&gt;
xPSR: 0x61000000 pc: 0x000870ba psp: 0x20074a30&lt;br /&gt;
&amp;gt; &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To continue execution you can run &amp;quot;resume&amp;quot;. Make sure you run &amp;quot;halt&amp;quot; to leave the target in the stopped before attaching GDB. Normally when GDB attaches it should stop the target automatically but this isn't working at the moment. If the target is running then you may when GDB attaches then you may see some odd behaviour.&lt;br /&gt;
&lt;br /&gt;
The OpenOCD software runs a target server on localhost:3333 which we can ask GDB to attach to:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) target extended-remote localhost:3333&lt;br /&gt;
Remote debugging using localhost:3333&lt;br /&gt;
0x000870ba in prvCheckTasksWaitingTermination () at /home/jburgess/Documents/emf/Mk2-Firmware/hardware/emfcamp/sam/libraries/FreeRTOS_ARM/utility/tasks.c:2839&lt;br /&gt;
2839                    while( uxTasksDeleted &amp;gt; ( UBaseType_t ) 0U )&lt;br /&gt;
(gdb) &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you get &amp;quot;warning: Architecture rejected target-supplied description&amp;quot; try using &amp;quot;hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-gdb&amp;quot; from Arduino's folder instead of whatever gdb you're distro has installed.&lt;br /&gt;
&lt;br /&gt;
=== List FreeRTOS tasks ===&lt;br /&gt;
To list the running tasks you can use &amp;quot;info threads&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) info threads&lt;br /&gt;
[New Thread 537348080]&lt;br /&gt;
[New Thread 537396632]&lt;br /&gt;
[New Thread 537402416]&lt;br /&gt;
[New Thread 537394216]&lt;br /&gt;
[New Thread 537405232]&lt;br /&gt;
[New Thread 537393096]&lt;br /&gt;
[New Thread 537348848]&lt;br /&gt;
[New Thread 537398824]&lt;br /&gt;
[New Thread 537400224]&lt;br /&gt;
[New Thread 537346984]&lt;br /&gt;
[New Thread 537403512]&lt;br /&gt;
[New Thread 537397728]&lt;br /&gt;
[New Thread 537395312]&lt;br /&gt;
  Id   Target Id         Frame &lt;br /&gt;
  14   Thread 537395312 (MessageCh) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  13   Thread 537397728 (RadioTran) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  12   Thread 537403512 (IMUTask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  11   Thread 537346984 (TiLDATask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  10   Thread 537400224 (GUI) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  9    Thread 537398824 (LCD) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  8    Thread 537348848 (Tmr Svc) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  7    Thread 537393096 (RGBTask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  6    Thread 537405232 (HomeScree) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  5    Thread 537394216 (BatterySa) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  4    Thread 537402416 (PMICTask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  3    Thread 537396632 (RadioRece) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  2    Thread 537348080 (IDLE :  : Running) 0x000870ba in prvCheckTasksWaitingTermination ()&lt;br /&gt;
    at emfcamp/sam/libraries/FreeRTOS_ARM/utility/tasks.c:2839&lt;br /&gt;
* 1    Thread 537401320 (AppOpener) 0x000870ba in prvCheckTasksWaitingTermination ()&lt;br /&gt;
    at emfcamp/sam/libraries/FreeRTOS_ARM/utility/tasks.c:2839&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Most threads should claim to be in &amp;quot;vPortYield()&amp;quot; which is one of the OS routines that a task will call when it wants to sleep for a while.Select a task and you can obtain its backtrace:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) thread 6&lt;br /&gt;
[Switching to thread 6 (Thread 537405232)]&lt;br /&gt;
#0  0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
385             __asm volatile( &amp;quot;isb&amp;quot; );&lt;br /&gt;
(gdb) bt&lt;br /&gt;
#0  0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
#1  0x00085c60 in xEventGroupWaitBits (xEventGroup=0x20082b78, uxBitsToWaitFor=1, xClearOnExit=0, xWaitForAllBits=0, xTicksToWait=&amp;lt;optimized out&amp;gt;)&lt;br /&gt;
    at emfcamp/sam/libraries/FreeRTOS_ARM/utility/event_groups.c:357&lt;br /&gt;
#2  0x0008453e in HomeScreenApp::task (this=0x20082710) at /tmp/build9091009552223609902.tmp/HomeScreenApp.cpp:157&lt;br /&gt;
#3  0x000818b4 in Task::taskCaller (this=0x20082710) at /tmp/build9091009552223609902.tmp/Task.cpp:78&lt;br /&gt;
#4  0x00081906 in Task::_task (self=&amp;lt;optimized out&amp;gt;) at /tmp/build9091009552223609902.tmp/Task.cpp:87&lt;br /&gt;
#5  0x00086768 in ulPortSetInterruptMask () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:423&lt;br /&gt;
Backtrace stopped: previous frame identical to this frame (corrupt stack?)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Known issues ==&lt;br /&gt;
* &amp;lt;strike&amp;gt;Normally when you hit a breakpoint GDB will automatically switch to the thread that hit it. This is not happening at the moment. If you interrupt the code or hit a breakpoint you may have to manually switch threads. The 'info threads' puts &amp;quot;Running&amp;quot; next to task being executed and this is probably the one you need to switch to.&amp;lt;/strike&amp;gt;&lt;br /&gt;
** Fixed by applying this patch to OpenOCD http://openocd.zylin.com/#/c/2303/&lt;br /&gt;
* When you attach and detach GDB doesn't automatically halt/resume the target. You can do this manually using the interface on port 3333 or just tell GDB to continue, then interrupt to stop it.&lt;br /&gt;
* GDB hits an assert if you detach the target and asks whether you want a core dump.&lt;br /&gt;
** This appears to be: https://sourceware.org/bugzilla/show_bug.cgi?id=12228&lt;br /&gt;
* I had a problem where the badge kept stopping at a breakpoint that I set in a previous GDB session and I was unable to fix it without power cycling the badge and restarting GDB &amp;amp; OpenOCD.&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_Debugging_using_JTAG&amp;diff=3756</id>
		<title>TiLDA Debugging using JTAG</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_Debugging_using_JTAG&amp;diff=3756"/>
		<updated>2014-10-01T22:00:00Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: /* Install OpenOCD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA badge has a JTAG port which can be used to perform remote firmware debugging. With the right hardware and software you can use this to run a GDB session on your development machine to insert breakpoints, inspect memory and poke around with the firmware running on the badge just like it was a local process running on your machine. &lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
''I started the list below with the parts that worked for me. Feel free to add alternatives if you know they work for you.''&lt;br /&gt;
* X86-64 Linux machine for building the firmware and running GDB&lt;br /&gt;
* TiLDA badge&lt;br /&gt;
** Plus micro USB cable for connecting TiLDA to development machine&lt;br /&gt;
* JTAG header, 10 way (2 x 5 pins) 0.05&amp;quot; (or 1.27mm) through hole&lt;br /&gt;
** e.g. Samtec FTS-105-01-L-D&lt;br /&gt;
** or Harwin M50-3500542 (part number from the TiLDA schematic)&lt;br /&gt;
* Fine tipped soldering iron&lt;br /&gt;
* [https://www.olimex.com/Products/ARM/JTAG/ARM-USB-TINY-H/ Olimex ARM-USB-TINY-H] USB JTAG Interface&lt;br /&gt;
** Plus USB type A to B cable (the original &amp;amp; large square plug)&lt;br /&gt;
* [https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-20-10/ Olimex ARM-JTAG-20-10] 20pin to 10pin adapter&lt;br /&gt;
* [http://openocd.sourceforge.net/ OpenOCD] software.&lt;br /&gt;
** This can control the Olimex JTAG interface and implements the GDB remote server protocol to talk with the debugger&lt;br /&gt;
* GDB&lt;br /&gt;
** I used gdb-7.7.1-18.fc20.x86_64.&lt;br /&gt;
* Arduino 1.5.7 tools&lt;br /&gt;
** For building &amp;amp; installing the firmware image&lt;br /&gt;
&lt;br /&gt;
== Attach JTAG Header to badge ==&lt;br /&gt;
The header must be attached on the correct side of the board otherwise it won't work. The pins on the two sides of the header are slightly different, one side is tin coated and appears silver/grey. These are the ones you should be soldering. The gold plated side should to be used by the connector.&lt;br /&gt;
&lt;br /&gt;
[[File:jtag-header.jpg|150px|thumb|center|text-top|JTAG header before being soldered on to the board]]&lt;br /&gt;
[[File:jtag-header-in-place-highlight.jpg|300px|thumb|center|text-top|TiLDA with new JTAG header highlighted]]&lt;br /&gt;
&lt;br /&gt;
Flip the board upside down and solder pins from the LCD side. The pitch is only 1.27mm (0.05&amp;quot;) which is half the size of most normal connectors so you need a steady hand. After you have soldered the pins it is a good idea to test for any short circuits before you power it on. &lt;br /&gt;
&lt;br /&gt;
[[File:jtag-header-solder-side.jpg|200px|thumb|center|text-top|Header soldered on LCD side of the board]]&lt;br /&gt;
&lt;br /&gt;
== Olimex adapter and USB-TINY-H ==&lt;br /&gt;
The cable from the Olimex adaper should be connected to the header so that the cable runs away from the board. Once again you may wish to check the connections appear to be the right way around, e.g. pin 1 on the adapter board connects to the 3v3 test point on the TiLDA. Connect the 20 pin side of the adapter into the main USB-TINY, this is keyed so it only fits one way around.&lt;br /&gt;
&lt;br /&gt;
[[File:board-with-adapter.jpg|300px|thumb|center|text-top|TiLDA connected to Olimex TINY-Y]]&lt;br /&gt;
&lt;br /&gt;
Plug the USB-TINY into a USB port on your machine. The 'dmesg' output should report something like:&lt;br /&gt;
&lt;br /&gt;
 usb 2-2: new high-speed USB device number 111 using ehci-pci&lt;br /&gt;
 usb 2-2: New USB device found, idVendor=15ba, idProduct=002a&lt;br /&gt;
 usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3&lt;br /&gt;
 usb 2-2: Product: Olimex OpenOCD JTAG ARM-USB-TINY-H&lt;br /&gt;
 usb 2-2: SerialNumber: OLXxxxxx&lt;br /&gt;
&lt;br /&gt;
== Install OpenOCD ==&lt;br /&gt;
I started with the current version available in the Fedora package repository (openocd-0.7.0-3.fc20.x86_64). Other Linux distros are likely to have packaged too. &lt;br /&gt;
&lt;br /&gt;
=== OpenOCD stack pointer bug ===&lt;br /&gt;
After I got everything running I noticed that the GDB backtraces would show the current function (PC) and the caller (LR) but all further stack entries were missing. After some debugging I found that OpenOCD was incorrectly calculating the stack pointer when it tried to align it. I applied a quick fix to disable the broken alignment code:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
--- openocd-0.7.0/src/rtos/rtos.c.bak   2014-09-14 17:28:10.000000000 +0100&lt;br /&gt;
+++ openocd-0.7.0/src/rtos/rtos.c       2014-09-14 17:29:39.000000000 +0100&lt;br /&gt;
@@ -454,12 +454,16 @@&lt;br /&gt;
        tmp_str_ptr = *hex_reg_list;&lt;br /&gt;
        new_stack_ptr = stack_ptr - stacking-&amp;gt;stack_growth_direction *&lt;br /&gt;
                stacking-&amp;gt;stack_registers_size;&lt;br /&gt;
+#if 0&lt;br /&gt;
+       // This code gives bad results for already aligned pointers&lt;br /&gt;
+       // and negative stack growth&lt;br /&gt;
        if (stacking-&amp;gt;stack_alignment != 0) {&lt;br /&gt;
                /* Align new stack pointer to x byte boundary */&lt;br /&gt;
                new_stack_ptr =&lt;br /&gt;
                        (new_stack_ptr &amp;amp; (~((int64_t) stacking-&amp;gt;stack_alignment - 1))) +&lt;br /&gt;
                        ((stacking-&amp;gt;stack_growth_direction == -1) ? stacking-&amp;gt;stack_alignment : 0);&lt;br /&gt;
        }&lt;br /&gt;
+#endif&lt;br /&gt;
        for (i = 0; i &amp;lt; stacking-&amp;gt;num_output_registers; i++) {&lt;br /&gt;
                int j;&lt;br /&gt;
                for (j = 0; j &amp;lt; stacking-&amp;gt;register_offsets[i].width_bits/8; j++) {&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I reported the bug to the OpenOCD developers and proper fix will hopefully arrive in the trunk code soon: http://openocd.zylin.com/#/c/2301/ (an initial fix was committed but has since been reverted because it was broken for a different case).&lt;br /&gt;
&lt;br /&gt;
====Alternative (Debian/Ubuntu) ====&lt;br /&gt;
&lt;br /&gt;
To do this you can download the code from http://sourceforge.net/projects/openocd/files/openocd/0.8.0/ and apply this patch http://openocd.zylin.com/#/c/2301/3/src/rtos/rtos.c,cm . &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
sudo apt-get install libusb-dev libusb-1.0-0-dev&lt;br /&gt;
./configure --enable-armjtagew&lt;br /&gt;
make &lt;br /&gt;
sudo make install&lt;br /&gt;
./configure &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== OpenOCD configuration file ==&lt;br /&gt;
OpenOCD requires a set of configuration commands describing both the JTAG adapter and the target CPU/board. Copy this into a file called tilda.cfg:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
# Recommended for OpenOCD-0.7&lt;br /&gt;
# script interface/olimex-arm-usb-tiny-h.cfg&lt;br /&gt;
&lt;br /&gt;
# Recommended for OpenOCD-0.8&lt;br /&gt;
script interface/ftdi/olimex-arm-usb-tiny-h.cfg&lt;br /&gt;
&lt;br /&gt;
# script for ATMEL sam3, a CORTEX-M3 chip&lt;br /&gt;
script target/at91sam3XXX.cfg&lt;br /&gt;
&lt;br /&gt;
$_TARGETNAME configure -rtos FreeRTOS&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Run OpenOCD ===&lt;br /&gt;
OpenOCD uses libusb to access the device and may need to run with sudo for it to work. If everything is connected together and the badge is powered on then you should see it detecting the CPU core as shown below:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ sudo openocd -f tilda.cfg&lt;br /&gt;
Open On-Chip Debugger 0.8.0 (2014-09-17-20:52)&lt;br /&gt;
Licensed under GNU GPL v2&lt;br /&gt;
For bug reports, read&lt;br /&gt;
        http://openocd.sourceforge.net/doc/doxygen/bugs.html&lt;br /&gt;
Info : only one transport option; autoselect 'jtag'&lt;br /&gt;
adapter speed: 500 kHz&lt;br /&gt;
adapter_nsrst_delay: 100&lt;br /&gt;
jtag_ntrst_delay: 100&lt;br /&gt;
cortex_m reset_config sysresetreq&lt;br /&gt;
Info : clock speed 500 kHz&lt;br /&gt;
Info : JTAG tap: sam3.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)&lt;br /&gt;
Info : sam3.cpu: hardware has 6 breakpoints, 4 watchpoints&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Patch TiLDA firmware for OpenOCD FreeRTOS detection ==&lt;br /&gt;
The OpenOCD code knows how to find the FreeRTOS tasks and can use this to make each task running on the badge as a different thread in GDB. To make this work you need to apply a small patch to the TiLDA code. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
diff --git a/EMF2014/TiLDATask.cpp b/EMF2014/TiLDATask.cpp&lt;br /&gt;
index 2cdc08d..701f940 100644&lt;br /&gt;
--- a/EMF2014/TiLDATask.cpp&lt;br /&gt;
+++ b/EMF2014/TiLDATask.cpp&lt;br /&gt;
@@ -58,6 +58,8 @@&lt;br /&gt;
 #include &amp;quot;logo.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;TiLDA_64x128.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
+// Hack to make FreeRTOS support work in OpenOCD&lt;br /&gt;
+unsigned portBASE_TYPE uxTopUsedPriority;&lt;br /&gt;
 &lt;br /&gt;
 TiLDATask::TiLDATask() {&lt;br /&gt;
 &lt;br /&gt;
@@ -68,6 +70,10 @@ String TiLDATask::getName() const {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TiLDATask::task() {&lt;br /&gt;
+&lt;br /&gt;
+    // Hack to make FreeRTOS support work in OpenOCD&lt;br /&gt;
+    uxTopUsedPriority = configMAX_PRIORITIES - 1;&lt;br /&gt;
+&lt;br /&gt;
     Tilda::_realTimeClock = new RTC_clock(RC);&lt;br /&gt;
     Tilda::_appManager = new AppManager;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This adds a variable that the OpenOCD expects to be able to read from the target to determine how many queues are being used by the FreeRTOS scheduler. This was present in older FreeRTOS release but has since been removed.&lt;br /&gt;
&lt;br /&gt;
== Build and flash the badge firmware ==&lt;br /&gt;
To make the debugger work you must be sure that the firmware running on the badge exactly matches the source code and binary objects that you have locally on your development machine. I recommend you apply the patch from the previous section, build the TiLDA firmware and upload it to your badge before you go any further.&lt;br /&gt;
&lt;br /&gt;
In the Arduino IDE you should build firmware (EMF2014 sketch) and upload it via the USB port on the TiLDA badge. (I have not attempted to upload firmware via the JTAG interface but that should be possible as well). The IDE writes a copy of the object files and the final executable to a directory in /tmp whenever you build the code. The firmware image file is &amp;lt;code&amp;gt;EMF2014.cpp.elf&amp;lt;/code&amp;gt; and you want to find the most recently built one, e.g.&lt;br /&gt;
&lt;br /&gt;
 [jburgess@shark]$ ls -lt /tmp/build*/EMF2014.cpp.elf | head -n 1&lt;br /&gt;
 -rwxrwxr-x. 1 jburgess jburgess 1475463 Sep 14 22:53 /tmp/build9091009552223609902.tmp/EMF2014.cpp.elf&lt;br /&gt;
&lt;br /&gt;
== Running GDB ==&lt;br /&gt;
First locate the EMF2014.cpp.elf file mentioned in the previous section. Run gdb with this file and with any luck it should be able to load it:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[jburgess@shark tmp]$ gdb /tmp/build9091009552223609902.tmp/EMF2014.cpp.elf&lt;br /&gt;
GNU gdb (GDB) Fedora 7.7.1-18.fc20&lt;br /&gt;
Copyright (C) 2014 Free Software Foundation, Inc.&lt;br /&gt;
License GPLv3+: GNU GPL version 3 or later &amp;lt;http://gnu.org/licenses/gpl.html&amp;gt;&lt;br /&gt;
This is free software: you are free to change and redistribute it.&lt;br /&gt;
There is NO WARRANTY, to the extent permitted by law.  Type &amp;quot;show copying&amp;quot;&lt;br /&gt;
and &amp;quot;show warranty&amp;quot; for details.&lt;br /&gt;
This GDB was configured as &amp;quot;x86_64-redhat-linux-gnu&amp;quot;.&lt;br /&gt;
Type &amp;quot;show configuration&amp;quot; for configuration details.&lt;br /&gt;
For bug reporting instructions, please see:&lt;br /&gt;
&amp;lt;http://www.gnu.org/software/gdb/bugs/&amp;gt;.&lt;br /&gt;
Find the GDB manual and other documentation resources online at:&lt;br /&gt;
&amp;lt;http://www.gnu.org/software/gdb/documentation/&amp;gt;.&lt;br /&gt;
For help, type &amp;quot;help&amp;quot;.&lt;br /&gt;
Type &amp;quot;apropos word&amp;quot; to search for commands related to &amp;quot;word&amp;quot;...&lt;br /&gt;
Reading symbols from /tmp/build9091009552223609902.tmp/EMF2014.cpp.elf...done.&lt;br /&gt;
(gdb) &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Check debug symbols ===&lt;br /&gt;
Next try some simple commands to see whether GDB knows where symbols are located in the binary and source:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) info line main&lt;br /&gt;
Line 43 of &amp;quot;/home/jburgess/Documents/emf/Mk2-Firmware/hardware/emfcamp/sam/cores/rtos/main.cpp&amp;quot; starts at address 0x8fe78 &amp;lt;main()&amp;gt; and ends at 0x8fe7a &amp;lt;main()+2&amp;gt;.&lt;br /&gt;
(gdb) list main&lt;br /&gt;
38&lt;br /&gt;
39      /*&lt;br /&gt;
40       * \brief Main entry point of Arduino application&lt;br /&gt;
41       */&lt;br /&gt;
42      int main( void )&lt;br /&gt;
43      {&lt;br /&gt;
44              init();&lt;br /&gt;
45&lt;br /&gt;
46              initVariant();&lt;br /&gt;
47&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If something goes wrong at this point you could try using the copy of GDB provided with the arduino tools instead, e.g. &amp;lt;code&amp;gt;arduino-1.5.7/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-gdb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Attach GDB to OpenOCD ===&lt;br /&gt;
The OpenOCD supports a couple of different interfaces. Before we try GDB we should first stop the CPU using the basic control interface and tell it to halt the CPU:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ telnet localhost 4444&lt;br /&gt;
Trying 127.0.0.1...&lt;br /&gt;
Connected to localhost.&lt;br /&gt;
Escape character is '^]'.&lt;br /&gt;
Open On-Chip Debugger&lt;br /&gt;
&amp;gt; halt&lt;br /&gt;
target state: halted&lt;br /&gt;
target halted due to debug-request, current mode: Thread &lt;br /&gt;
xPSR: 0x61000000 pc: 0x000870ba psp: 0x20074a30&lt;br /&gt;
&amp;gt; &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To continue execution you can run &amp;quot;resume&amp;quot;. Make sure you run &amp;quot;halt&amp;quot; to leave the target in the stopped before attaching GDB. Normally when GDB attaches it should stop the target automatically but this isn't working at the moment. If the target is running then you may when GDB attaches then you may see some odd behaviour.&lt;br /&gt;
&lt;br /&gt;
The OpenOCD software runs a target server on localhost:3333 which we can ask GDB to attach to:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) target extended-remote localhost:3333&lt;br /&gt;
Remote debugging using localhost:3333&lt;br /&gt;
0x000870ba in prvCheckTasksWaitingTermination () at /home/jburgess/Documents/emf/Mk2-Firmware/hardware/emfcamp/sam/libraries/FreeRTOS_ARM/utility/tasks.c:2839&lt;br /&gt;
2839                    while( uxTasksDeleted &amp;gt; ( UBaseType_t ) 0U )&lt;br /&gt;
(gdb) &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== List FreeRTOS tasks ===&lt;br /&gt;
To list the running tasks you can use &amp;quot;info threads&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) info threads&lt;br /&gt;
[New Thread 537348080]&lt;br /&gt;
[New Thread 537396632]&lt;br /&gt;
[New Thread 537402416]&lt;br /&gt;
[New Thread 537394216]&lt;br /&gt;
[New Thread 537405232]&lt;br /&gt;
[New Thread 537393096]&lt;br /&gt;
[New Thread 537348848]&lt;br /&gt;
[New Thread 537398824]&lt;br /&gt;
[New Thread 537400224]&lt;br /&gt;
[New Thread 537346984]&lt;br /&gt;
[New Thread 537403512]&lt;br /&gt;
[New Thread 537397728]&lt;br /&gt;
[New Thread 537395312]&lt;br /&gt;
  Id   Target Id         Frame &lt;br /&gt;
  14   Thread 537395312 (MessageCh) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  13   Thread 537397728 (RadioTran) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  12   Thread 537403512 (IMUTask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  11   Thread 537346984 (TiLDATask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  10   Thread 537400224 (GUI) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  9    Thread 537398824 (LCD) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  8    Thread 537348848 (Tmr Svc) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  7    Thread 537393096 (RGBTask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  6    Thread 537405232 (HomeScree) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  5    Thread 537394216 (BatterySa) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  4    Thread 537402416 (PMICTask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  3    Thread 537396632 (RadioRece) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  2    Thread 537348080 (IDLE :  : Running) 0x000870ba in prvCheckTasksWaitingTermination ()&lt;br /&gt;
    at emfcamp/sam/libraries/FreeRTOS_ARM/utility/tasks.c:2839&lt;br /&gt;
* 1    Thread 537401320 (AppOpener) 0x000870ba in prvCheckTasksWaitingTermination ()&lt;br /&gt;
    at emfcamp/sam/libraries/FreeRTOS_ARM/utility/tasks.c:2839&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Most threads should claim to be in &amp;quot;vPortYield()&amp;quot; which is one of the OS routines that a task will call when it wants to sleep for a while.Select a task and you can obtain its backtrace:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) thread 6&lt;br /&gt;
[Switching to thread 6 (Thread 537405232)]&lt;br /&gt;
#0  0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
385             __asm volatile( &amp;quot;isb&amp;quot; );&lt;br /&gt;
(gdb) bt&lt;br /&gt;
#0  0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
#1  0x00085c60 in xEventGroupWaitBits (xEventGroup=0x20082b78, uxBitsToWaitFor=1, xClearOnExit=0, xWaitForAllBits=0, xTicksToWait=&amp;lt;optimized out&amp;gt;)&lt;br /&gt;
    at emfcamp/sam/libraries/FreeRTOS_ARM/utility/event_groups.c:357&lt;br /&gt;
#2  0x0008453e in HomeScreenApp::task (this=0x20082710) at /tmp/build9091009552223609902.tmp/HomeScreenApp.cpp:157&lt;br /&gt;
#3  0x000818b4 in Task::taskCaller (this=0x20082710) at /tmp/build9091009552223609902.tmp/Task.cpp:78&lt;br /&gt;
#4  0x00081906 in Task::_task (self=&amp;lt;optimized out&amp;gt;) at /tmp/build9091009552223609902.tmp/Task.cpp:87&lt;br /&gt;
#5  0x00086768 in ulPortSetInterruptMask () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:423&lt;br /&gt;
Backtrace stopped: previous frame identical to this frame (corrupt stack?)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
== Known issues ==&lt;br /&gt;
* &amp;lt;strike&amp;gt;Normally when you hit a breakpoint GDB will automatically switch to the thread that hit it. This is not happening at the moment. If you interrupt the code or hit a breakpoint you may have to manually switch threads. The 'info threads' puts &amp;quot;Running&amp;quot; next to task being executed and this is probably the one you need to switch to.&amp;lt;/strike&amp;gt;&lt;br /&gt;
** Fixed by applying this patch to OpenOCD http://openocd.zylin.com/#/c/2303/&lt;br /&gt;
* When you attach and detach GDB doesn't automatically halt/resume the target. You can do this manually using the interface on port 3333 or just tell GDB to continue, then interrupt to stop it.&lt;br /&gt;
* GDB hits an assert if you detach the target and asks whether you want a core dump.&lt;br /&gt;
** This appears to be: https://sourceware.org/bugzilla/show_bug.cgi?id=12228&lt;br /&gt;
* I had a problem where the badge kept stopping at a breakpoint that I set in a previous GDB session and I was unable to fix it without power cycling the badge and restarting GDB &amp;amp; OpenOCD.&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_Debugging_using_JTAG&amp;diff=3755</id>
		<title>TiLDA Debugging using JTAG</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_Debugging_using_JTAG&amp;diff=3755"/>
		<updated>2014-10-01T21:59:40Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: /* Alternative (Debian/Ubuntu) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA badge has a JTAG port which can be used to perform remote firmware debugging. With the right hardware and software you can use this to run a GDB session on your development machine to insert breakpoints, inspect memory and poke around with the firmware running on the badge just like it was a local process running on your machine. &lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
''I started the list below with the parts that worked for me. Feel free to add alternatives if you know they work for you.''&lt;br /&gt;
* X86-64 Linux machine for building the firmware and running GDB&lt;br /&gt;
* TiLDA badge&lt;br /&gt;
** Plus micro USB cable for connecting TiLDA to development machine&lt;br /&gt;
* JTAG header, 10 way (2 x 5 pins) 0.05&amp;quot; (or 1.27mm) through hole&lt;br /&gt;
** e.g. Samtec FTS-105-01-L-D&lt;br /&gt;
** or Harwin M50-3500542 (part number from the TiLDA schematic)&lt;br /&gt;
* Fine tipped soldering iron&lt;br /&gt;
* [https://www.olimex.com/Products/ARM/JTAG/ARM-USB-TINY-H/ Olimex ARM-USB-TINY-H] USB JTAG Interface&lt;br /&gt;
** Plus USB type A to B cable (the original &amp;amp; large square plug)&lt;br /&gt;
* [https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-20-10/ Olimex ARM-JTAG-20-10] 20pin to 10pin adapter&lt;br /&gt;
* [http://openocd.sourceforge.net/ OpenOCD] software.&lt;br /&gt;
** This can control the Olimex JTAG interface and implements the GDB remote server protocol to talk with the debugger&lt;br /&gt;
* GDB&lt;br /&gt;
** I used gdb-7.7.1-18.fc20.x86_64.&lt;br /&gt;
* Arduino 1.5.7 tools&lt;br /&gt;
** For building &amp;amp; installing the firmware image&lt;br /&gt;
&lt;br /&gt;
== Attach JTAG Header to badge ==&lt;br /&gt;
The header must be attached on the correct side of the board otherwise it won't work. The pins on the two sides of the header are slightly different, one side is tin coated and appears silver/grey. These are the ones you should be soldering. The gold plated side should to be used by the connector.&lt;br /&gt;
&lt;br /&gt;
[[File:jtag-header.jpg|150px|thumb|center|text-top|JTAG header before being soldered on to the board]]&lt;br /&gt;
[[File:jtag-header-in-place-highlight.jpg|300px|thumb|center|text-top|TiLDA with new JTAG header highlighted]]&lt;br /&gt;
&lt;br /&gt;
Flip the board upside down and solder pins from the LCD side. The pitch is only 1.27mm (0.05&amp;quot;) which is half the size of most normal connectors so you need a steady hand. After you have soldered the pins it is a good idea to test for any short circuits before you power it on. &lt;br /&gt;
&lt;br /&gt;
[[File:jtag-header-solder-side.jpg|200px|thumb|center|text-top|Header soldered on LCD side of the board]]&lt;br /&gt;
&lt;br /&gt;
== Olimex adapter and USB-TINY-H ==&lt;br /&gt;
The cable from the Olimex adaper should be connected to the header so that the cable runs away from the board. Once again you may wish to check the connections appear to be the right way around, e.g. pin 1 on the adapter board connects to the 3v3 test point on the TiLDA. Connect the 20 pin side of the adapter into the main USB-TINY, this is keyed so it only fits one way around.&lt;br /&gt;
&lt;br /&gt;
[[File:board-with-adapter.jpg|300px|thumb|center|text-top|TiLDA connected to Olimex TINY-Y]]&lt;br /&gt;
&lt;br /&gt;
Plug the USB-TINY into a USB port on your machine. The 'dmesg' output should report something like:&lt;br /&gt;
&lt;br /&gt;
 usb 2-2: new high-speed USB device number 111 using ehci-pci&lt;br /&gt;
 usb 2-2: New USB device found, idVendor=15ba, idProduct=002a&lt;br /&gt;
 usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3&lt;br /&gt;
 usb 2-2: Product: Olimex OpenOCD JTAG ARM-USB-TINY-H&lt;br /&gt;
 usb 2-2: SerialNumber: OLXxxxxx&lt;br /&gt;
&lt;br /&gt;
== Install OpenOCD ==&lt;br /&gt;
I started with the current version available in the Fedora package repository (openocd-0.7.0-3.fc20.x86_64). Other Linux distros are likely to have packaged too. &lt;br /&gt;
&lt;br /&gt;
=== OpenOCD stack pointer bug ===&lt;br /&gt;
After I got everything running I noticed that the GDB backtraces would show the current function (PC) and the caller (LR) but all further stack entries were missing. After some debugging I found that OpenOCD was incorrectly calculating the stack pointer when it tried to align it. I applied a quick fix to disable the broken alignment code:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
--- openocd-0.7.0/src/rtos/rtos.c.bak   2014-09-14 17:28:10.000000000 +0100&lt;br /&gt;
+++ openocd-0.7.0/src/rtos/rtos.c       2014-09-14 17:29:39.000000000 +0100&lt;br /&gt;
@@ -454,12 +454,16 @@&lt;br /&gt;
        tmp_str_ptr = *hex_reg_list;&lt;br /&gt;
        new_stack_ptr = stack_ptr - stacking-&amp;gt;stack_growth_direction *&lt;br /&gt;
                stacking-&amp;gt;stack_registers_size;&lt;br /&gt;
+#if 0&lt;br /&gt;
+       // This code gives bad results for already aligned pointers&lt;br /&gt;
+       // and negative stack growth&lt;br /&gt;
        if (stacking-&amp;gt;stack_alignment != 0) {&lt;br /&gt;
                /* Align new stack pointer to x byte boundary */&lt;br /&gt;
                new_stack_ptr =&lt;br /&gt;
                        (new_stack_ptr &amp;amp; (~((int64_t) stacking-&amp;gt;stack_alignment - 1))) +&lt;br /&gt;
                        ((stacking-&amp;gt;stack_growth_direction == -1) ? stacking-&amp;gt;stack_alignment : 0);&lt;br /&gt;
        }&lt;br /&gt;
+#endif&lt;br /&gt;
        for (i = 0; i &amp;lt; stacking-&amp;gt;num_output_registers; i++) {&lt;br /&gt;
                int j;&lt;br /&gt;
                for (j = 0; j &amp;lt; stacking-&amp;gt;register_offsets[i].width_bits/8; j++) {&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I reported the bug to the OpenOCD developers and proper fix will hopefully arrive in the trunk code soon: http://openocd.zylin.com/#/c/2301/ (an initial fix was committed but has since been reverted because it was broken for a different case).&lt;br /&gt;
&lt;br /&gt;
====Alternative (Debian/Ubuntu) ====&lt;br /&gt;
&lt;br /&gt;
To do this you can download the code from http://sourceforge.net/projects/openocd/files/openocd/0.8.0/ and apply this patch http://openocd.zylin.com/#/c/2301/3/src/rtos/rtos.c,cm . &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
sudo apt-get install libusb-dev libusb-1.0-0-dev&lt;br /&gt;
./configure --enable-armjtagew&lt;br /&gt;
make &lt;br /&gt;
sudo make install&lt;br /&gt;
./configure &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== OpenOCD configuration file ==&lt;br /&gt;
OpenOCD requires a set of configuration commands describing both the JTAG adapter and the target CPU/board. Copy this into a file called tilda.cfg:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
# Recommended for OpenOCD-0.7&lt;br /&gt;
# script interface/olimex-arm-usb-tiny-h.cfg&lt;br /&gt;
&lt;br /&gt;
# Recommended for OpenOCD-0.8&lt;br /&gt;
script interface/ftdi/olimex-arm-usb-tiny-h.cfg&lt;br /&gt;
&lt;br /&gt;
# script for ATMEL sam3, a CORTEX-M3 chip&lt;br /&gt;
script target/at91sam3XXX.cfg&lt;br /&gt;
&lt;br /&gt;
$_TARGETNAME configure -rtos FreeRTOS&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Run OpenOCD ===&lt;br /&gt;
OpenOCD uses libusb to access the device and may need to run with sudo for it to work. If everything is connected together and the badge is powered on then you should see it detecting the CPU core as shown below:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ sudo openocd -f tilda.cfg&lt;br /&gt;
Open On-Chip Debugger 0.8.0 (2014-09-17-20:52)&lt;br /&gt;
Licensed under GNU GPL v2&lt;br /&gt;
For bug reports, read&lt;br /&gt;
        http://openocd.sourceforge.net/doc/doxygen/bugs.html&lt;br /&gt;
Info : only one transport option; autoselect 'jtag'&lt;br /&gt;
adapter speed: 500 kHz&lt;br /&gt;
adapter_nsrst_delay: 100&lt;br /&gt;
jtag_ntrst_delay: 100&lt;br /&gt;
cortex_m reset_config sysresetreq&lt;br /&gt;
Info : clock speed 500 kHz&lt;br /&gt;
Info : JTAG tap: sam3.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)&lt;br /&gt;
Info : sam3.cpu: hardware has 6 breakpoints, 4 watchpoints&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Patch TiLDA firmware for OpenOCD FreeRTOS detection ==&lt;br /&gt;
The OpenOCD code knows how to find the FreeRTOS tasks and can use this to make each task running on the badge as a different thread in GDB. To make this work you need to apply a small patch to the TiLDA code. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
diff --git a/EMF2014/TiLDATask.cpp b/EMF2014/TiLDATask.cpp&lt;br /&gt;
index 2cdc08d..701f940 100644&lt;br /&gt;
--- a/EMF2014/TiLDATask.cpp&lt;br /&gt;
+++ b/EMF2014/TiLDATask.cpp&lt;br /&gt;
@@ -58,6 +58,8 @@&lt;br /&gt;
 #include &amp;quot;logo.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;TiLDA_64x128.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
+// Hack to make FreeRTOS support work in OpenOCD&lt;br /&gt;
+unsigned portBASE_TYPE uxTopUsedPriority;&lt;br /&gt;
 &lt;br /&gt;
 TiLDATask::TiLDATask() {&lt;br /&gt;
 &lt;br /&gt;
@@ -68,6 +70,10 @@ String TiLDATask::getName() const {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TiLDATask::task() {&lt;br /&gt;
+&lt;br /&gt;
+    // Hack to make FreeRTOS support work in OpenOCD&lt;br /&gt;
+    uxTopUsedPriority = configMAX_PRIORITIES - 1;&lt;br /&gt;
+&lt;br /&gt;
     Tilda::_realTimeClock = new RTC_clock(RC);&lt;br /&gt;
     Tilda::_appManager = new AppManager;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This adds a variable that the OpenOCD expects to be able to read from the target to determine how many queues are being used by the FreeRTOS scheduler. This was present in older FreeRTOS release but has since been removed.&lt;br /&gt;
&lt;br /&gt;
== Build and flash the badge firmware ==&lt;br /&gt;
To make the debugger work you must be sure that the firmware running on the badge exactly matches the source code and binary objects that you have locally on your development machine. I recommend you apply the patch from the previous section, build the TiLDA firmware and upload it to your badge before you go any further.&lt;br /&gt;
&lt;br /&gt;
In the Arduino IDE you should build firmware (EMF2014 sketch) and upload it via the USB port on the TiLDA badge. (I have not attempted to upload firmware via the JTAG interface but that should be possible as well). The IDE writes a copy of the object files and the final executable to a directory in /tmp whenever you build the code. The firmware image file is &amp;lt;code&amp;gt;EMF2014.cpp.elf&amp;lt;/code&amp;gt; and you want to find the most recently built one, e.g.&lt;br /&gt;
&lt;br /&gt;
 [jburgess@shark]$ ls -lt /tmp/build*/EMF2014.cpp.elf | head -n 1&lt;br /&gt;
 -rwxrwxr-x. 1 jburgess jburgess 1475463 Sep 14 22:53 /tmp/build9091009552223609902.tmp/EMF2014.cpp.elf&lt;br /&gt;
&lt;br /&gt;
== Running GDB ==&lt;br /&gt;
First locate the EMF2014.cpp.elf file mentioned in the previous section. Run gdb with this file and with any luck it should be able to load it:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[jburgess@shark tmp]$ gdb /tmp/build9091009552223609902.tmp/EMF2014.cpp.elf&lt;br /&gt;
GNU gdb (GDB) Fedora 7.7.1-18.fc20&lt;br /&gt;
Copyright (C) 2014 Free Software Foundation, Inc.&lt;br /&gt;
License GPLv3+: GNU GPL version 3 or later &amp;lt;http://gnu.org/licenses/gpl.html&amp;gt;&lt;br /&gt;
This is free software: you are free to change and redistribute it.&lt;br /&gt;
There is NO WARRANTY, to the extent permitted by law.  Type &amp;quot;show copying&amp;quot;&lt;br /&gt;
and &amp;quot;show warranty&amp;quot; for details.&lt;br /&gt;
This GDB was configured as &amp;quot;x86_64-redhat-linux-gnu&amp;quot;.&lt;br /&gt;
Type &amp;quot;show configuration&amp;quot; for configuration details.&lt;br /&gt;
For bug reporting instructions, please see:&lt;br /&gt;
&amp;lt;http://www.gnu.org/software/gdb/bugs/&amp;gt;.&lt;br /&gt;
Find the GDB manual and other documentation resources online at:&lt;br /&gt;
&amp;lt;http://www.gnu.org/software/gdb/documentation/&amp;gt;.&lt;br /&gt;
For help, type &amp;quot;help&amp;quot;.&lt;br /&gt;
Type &amp;quot;apropos word&amp;quot; to search for commands related to &amp;quot;word&amp;quot;...&lt;br /&gt;
Reading symbols from /tmp/build9091009552223609902.tmp/EMF2014.cpp.elf...done.&lt;br /&gt;
(gdb) &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Check debug symbols ===&lt;br /&gt;
Next try some simple commands to see whether GDB knows where symbols are located in the binary and source:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) info line main&lt;br /&gt;
Line 43 of &amp;quot;/home/jburgess/Documents/emf/Mk2-Firmware/hardware/emfcamp/sam/cores/rtos/main.cpp&amp;quot; starts at address 0x8fe78 &amp;lt;main()&amp;gt; and ends at 0x8fe7a &amp;lt;main()+2&amp;gt;.&lt;br /&gt;
(gdb) list main&lt;br /&gt;
38&lt;br /&gt;
39      /*&lt;br /&gt;
40       * \brief Main entry point of Arduino application&lt;br /&gt;
41       */&lt;br /&gt;
42      int main( void )&lt;br /&gt;
43      {&lt;br /&gt;
44              init();&lt;br /&gt;
45&lt;br /&gt;
46              initVariant();&lt;br /&gt;
47&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If something goes wrong at this point you could try using the copy of GDB provided with the arduino tools instead, e.g. &amp;lt;code&amp;gt;arduino-1.5.7/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-gdb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Attach GDB to OpenOCD ===&lt;br /&gt;
The OpenOCD supports a couple of different interfaces. Before we try GDB we should first stop the CPU using the basic control interface and tell it to halt the CPU:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ telnet localhost 4444&lt;br /&gt;
Trying 127.0.0.1...&lt;br /&gt;
Connected to localhost.&lt;br /&gt;
Escape character is '^]'.&lt;br /&gt;
Open On-Chip Debugger&lt;br /&gt;
&amp;gt; halt&lt;br /&gt;
target state: halted&lt;br /&gt;
target halted due to debug-request, current mode: Thread &lt;br /&gt;
xPSR: 0x61000000 pc: 0x000870ba psp: 0x20074a30&lt;br /&gt;
&amp;gt; &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To continue execution you can run &amp;quot;resume&amp;quot;. Make sure you run &amp;quot;halt&amp;quot; to leave the target in the stopped before attaching GDB. Normally when GDB attaches it should stop the target automatically but this isn't working at the moment. If the target is running then you may when GDB attaches then you may see some odd behaviour.&lt;br /&gt;
&lt;br /&gt;
The OpenOCD software runs a target server on localhost:3333 which we can ask GDB to attach to:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) target extended-remote localhost:3333&lt;br /&gt;
Remote debugging using localhost:3333&lt;br /&gt;
0x000870ba in prvCheckTasksWaitingTermination () at /home/jburgess/Documents/emf/Mk2-Firmware/hardware/emfcamp/sam/libraries/FreeRTOS_ARM/utility/tasks.c:2839&lt;br /&gt;
2839                    while( uxTasksDeleted &amp;gt; ( UBaseType_t ) 0U )&lt;br /&gt;
(gdb) &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== List FreeRTOS tasks ===&lt;br /&gt;
To list the running tasks you can use &amp;quot;info threads&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) info threads&lt;br /&gt;
[New Thread 537348080]&lt;br /&gt;
[New Thread 537396632]&lt;br /&gt;
[New Thread 537402416]&lt;br /&gt;
[New Thread 537394216]&lt;br /&gt;
[New Thread 537405232]&lt;br /&gt;
[New Thread 537393096]&lt;br /&gt;
[New Thread 537348848]&lt;br /&gt;
[New Thread 537398824]&lt;br /&gt;
[New Thread 537400224]&lt;br /&gt;
[New Thread 537346984]&lt;br /&gt;
[New Thread 537403512]&lt;br /&gt;
[New Thread 537397728]&lt;br /&gt;
[New Thread 537395312]&lt;br /&gt;
  Id   Target Id         Frame &lt;br /&gt;
  14   Thread 537395312 (MessageCh) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  13   Thread 537397728 (RadioTran) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  12   Thread 537403512 (IMUTask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  11   Thread 537346984 (TiLDATask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  10   Thread 537400224 (GUI) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  9    Thread 537398824 (LCD) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  8    Thread 537348848 (Tmr Svc) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  7    Thread 537393096 (RGBTask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  6    Thread 537405232 (HomeScree) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  5    Thread 537394216 (BatterySa) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  4    Thread 537402416 (PMICTask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  3    Thread 537396632 (RadioRece) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  2    Thread 537348080 (IDLE :  : Running) 0x000870ba in prvCheckTasksWaitingTermination ()&lt;br /&gt;
    at emfcamp/sam/libraries/FreeRTOS_ARM/utility/tasks.c:2839&lt;br /&gt;
* 1    Thread 537401320 (AppOpener) 0x000870ba in prvCheckTasksWaitingTermination ()&lt;br /&gt;
    at emfcamp/sam/libraries/FreeRTOS_ARM/utility/tasks.c:2839&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Most threads should claim to be in &amp;quot;vPortYield()&amp;quot; which is one of the OS routines that a task will call when it wants to sleep for a while.Select a task and you can obtain its backtrace:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) thread 6&lt;br /&gt;
[Switching to thread 6 (Thread 537405232)]&lt;br /&gt;
#0  0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
385             __asm volatile( &amp;quot;isb&amp;quot; );&lt;br /&gt;
(gdb) bt&lt;br /&gt;
#0  0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
#1  0x00085c60 in xEventGroupWaitBits (xEventGroup=0x20082b78, uxBitsToWaitFor=1, xClearOnExit=0, xWaitForAllBits=0, xTicksToWait=&amp;lt;optimized out&amp;gt;)&lt;br /&gt;
    at emfcamp/sam/libraries/FreeRTOS_ARM/utility/event_groups.c:357&lt;br /&gt;
#2  0x0008453e in HomeScreenApp::task (this=0x20082710) at /tmp/build9091009552223609902.tmp/HomeScreenApp.cpp:157&lt;br /&gt;
#3  0x000818b4 in Task::taskCaller (this=0x20082710) at /tmp/build9091009552223609902.tmp/Task.cpp:78&lt;br /&gt;
#4  0x00081906 in Task::_task (self=&amp;lt;optimized out&amp;gt;) at /tmp/build9091009552223609902.tmp/Task.cpp:87&lt;br /&gt;
#5  0x00086768 in ulPortSetInterruptMask () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:423&lt;br /&gt;
Backtrace stopped: previous frame identical to this frame (corrupt stack?)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
== Known issues ==&lt;br /&gt;
* &amp;lt;strike&amp;gt;Normally when you hit a breakpoint GDB will automatically switch to the thread that hit it. This is not happening at the moment. If you interrupt the code or hit a breakpoint you may have to manually switch threads. The 'info threads' puts &amp;quot;Running&amp;quot; next to task being executed and this is probably the one you need to switch to.&amp;lt;/strike&amp;gt;&lt;br /&gt;
** Fixed by applying this patch to OpenOCD http://openocd.zylin.com/#/c/2303/&lt;br /&gt;
* When you attach and detach GDB doesn't automatically halt/resume the target. You can do this manually using the interface on port 3333 or just tell GDB to continue, then interrupt to stop it.&lt;br /&gt;
* GDB hits an assert if you detach the target and asks whether you want a core dump.&lt;br /&gt;
** This appears to be: https://sourceware.org/bugzilla/show_bug.cgi?id=12228&lt;br /&gt;
* I had a problem where the badge kept stopping at a breakpoint that I set in a previous GDB session and I was unable to fix it without power cycling the badge and restarting GDB &amp;amp; OpenOCD.&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_Debugging_using_JTAG&amp;diff=3754</id>
		<title>TiLDA Debugging using JTAG</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_Debugging_using_JTAG&amp;diff=3754"/>
		<updated>2014-10-01T21:59:23Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: /* Install OpenOCD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA badge has a JTAG port which can be used to perform remote firmware debugging. With the right hardware and software you can use this to run a GDB session on your development machine to insert breakpoints, inspect memory and poke around with the firmware running on the badge just like it was a local process running on your machine. &lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
''I started the list below with the parts that worked for me. Feel free to add alternatives if you know they work for you.''&lt;br /&gt;
* X86-64 Linux machine for building the firmware and running GDB&lt;br /&gt;
* TiLDA badge&lt;br /&gt;
** Plus micro USB cable for connecting TiLDA to development machine&lt;br /&gt;
* JTAG header, 10 way (2 x 5 pins) 0.05&amp;quot; (or 1.27mm) through hole&lt;br /&gt;
** e.g. Samtec FTS-105-01-L-D&lt;br /&gt;
** or Harwin M50-3500542 (part number from the TiLDA schematic)&lt;br /&gt;
* Fine tipped soldering iron&lt;br /&gt;
* [https://www.olimex.com/Products/ARM/JTAG/ARM-USB-TINY-H/ Olimex ARM-USB-TINY-H] USB JTAG Interface&lt;br /&gt;
** Plus USB type A to B cable (the original &amp;amp; large square plug)&lt;br /&gt;
* [https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-20-10/ Olimex ARM-JTAG-20-10] 20pin to 10pin adapter&lt;br /&gt;
* [http://openocd.sourceforge.net/ OpenOCD] software.&lt;br /&gt;
** This can control the Olimex JTAG interface and implements the GDB remote server protocol to talk with the debugger&lt;br /&gt;
* GDB&lt;br /&gt;
** I used gdb-7.7.1-18.fc20.x86_64.&lt;br /&gt;
* Arduino 1.5.7 tools&lt;br /&gt;
** For building &amp;amp; installing the firmware image&lt;br /&gt;
&lt;br /&gt;
== Attach JTAG Header to badge ==&lt;br /&gt;
The header must be attached on the correct side of the board otherwise it won't work. The pins on the two sides of the header are slightly different, one side is tin coated and appears silver/grey. These are the ones you should be soldering. The gold plated side should to be used by the connector.&lt;br /&gt;
&lt;br /&gt;
[[File:jtag-header.jpg|150px|thumb|center|text-top|JTAG header before being soldered on to the board]]&lt;br /&gt;
[[File:jtag-header-in-place-highlight.jpg|300px|thumb|center|text-top|TiLDA with new JTAG header highlighted]]&lt;br /&gt;
&lt;br /&gt;
Flip the board upside down and solder pins from the LCD side. The pitch is only 1.27mm (0.05&amp;quot;) which is half the size of most normal connectors so you need a steady hand. After you have soldered the pins it is a good idea to test for any short circuits before you power it on. &lt;br /&gt;
&lt;br /&gt;
[[File:jtag-header-solder-side.jpg|200px|thumb|center|text-top|Header soldered on LCD side of the board]]&lt;br /&gt;
&lt;br /&gt;
== Olimex adapter and USB-TINY-H ==&lt;br /&gt;
The cable from the Olimex adaper should be connected to the header so that the cable runs away from the board. Once again you may wish to check the connections appear to be the right way around, e.g. pin 1 on the adapter board connects to the 3v3 test point on the TiLDA. Connect the 20 pin side of the adapter into the main USB-TINY, this is keyed so it only fits one way around.&lt;br /&gt;
&lt;br /&gt;
[[File:board-with-adapter.jpg|300px|thumb|center|text-top|TiLDA connected to Olimex TINY-Y]]&lt;br /&gt;
&lt;br /&gt;
Plug the USB-TINY into a USB port on your machine. The 'dmesg' output should report something like:&lt;br /&gt;
&lt;br /&gt;
 usb 2-2: new high-speed USB device number 111 using ehci-pci&lt;br /&gt;
 usb 2-2: New USB device found, idVendor=15ba, idProduct=002a&lt;br /&gt;
 usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3&lt;br /&gt;
 usb 2-2: Product: Olimex OpenOCD JTAG ARM-USB-TINY-H&lt;br /&gt;
 usb 2-2: SerialNumber: OLXxxxxx&lt;br /&gt;
&lt;br /&gt;
== Install OpenOCD ==&lt;br /&gt;
I started with the current version available in the Fedora package repository (openocd-0.7.0-3.fc20.x86_64). Other Linux distros are likely to have packaged too. &lt;br /&gt;
&lt;br /&gt;
=== OpenOCD stack pointer bug ===&lt;br /&gt;
After I got everything running I noticed that the GDB backtraces would show the current function (PC) and the caller (LR) but all further stack entries were missing. After some debugging I found that OpenOCD was incorrectly calculating the stack pointer when it tried to align it. I applied a quick fix to disable the broken alignment code:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
--- openocd-0.7.0/src/rtos/rtos.c.bak   2014-09-14 17:28:10.000000000 +0100&lt;br /&gt;
+++ openocd-0.7.0/src/rtos/rtos.c       2014-09-14 17:29:39.000000000 +0100&lt;br /&gt;
@@ -454,12 +454,16 @@&lt;br /&gt;
        tmp_str_ptr = *hex_reg_list;&lt;br /&gt;
        new_stack_ptr = stack_ptr - stacking-&amp;gt;stack_growth_direction *&lt;br /&gt;
                stacking-&amp;gt;stack_registers_size;&lt;br /&gt;
+#if 0&lt;br /&gt;
+       // This code gives bad results for already aligned pointers&lt;br /&gt;
+       // and negative stack growth&lt;br /&gt;
        if (stacking-&amp;gt;stack_alignment != 0) {&lt;br /&gt;
                /* Align new stack pointer to x byte boundary */&lt;br /&gt;
                new_stack_ptr =&lt;br /&gt;
                        (new_stack_ptr &amp;amp; (~((int64_t) stacking-&amp;gt;stack_alignment - 1))) +&lt;br /&gt;
                        ((stacking-&amp;gt;stack_growth_direction == -1) ? stacking-&amp;gt;stack_alignment : 0);&lt;br /&gt;
        }&lt;br /&gt;
+#endif&lt;br /&gt;
        for (i = 0; i &amp;lt; stacking-&amp;gt;num_output_registers; i++) {&lt;br /&gt;
                int j;&lt;br /&gt;
                for (j = 0; j &amp;lt; stacking-&amp;gt;register_offsets[i].width_bits/8; j++) {&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I reported the bug to the OpenOCD developers and proper fix will hopefully arrive in the trunk code soon: http://openocd.zylin.com/#/c/2301/ (an initial fix was committed but has since been reverted because it was broken for a different case).&lt;br /&gt;
&lt;br /&gt;
====Alternative (Debian/Ubuntu) ====&lt;br /&gt;
&lt;br /&gt;
To do this you can download the code from http://sourceforge.net/projects/openocd/files/openocd/0.8.0/ and apply this patch http://openocd.zylin.com/#/c/2301/3/src/rtos/rtos.c,cm . &lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
sudo apt-get install libusb-dev libusb-1.0-0-dev&lt;br /&gt;
./configure --enable-armjtagew&lt;br /&gt;
make &lt;br /&gt;
sudo make install&lt;br /&gt;
./configure &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== OpenOCD configuration file ==&lt;br /&gt;
OpenOCD requires a set of configuration commands describing both the JTAG adapter and the target CPU/board. Copy this into a file called tilda.cfg:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
# Recommended for OpenOCD-0.7&lt;br /&gt;
# script interface/olimex-arm-usb-tiny-h.cfg&lt;br /&gt;
&lt;br /&gt;
# Recommended for OpenOCD-0.8&lt;br /&gt;
script interface/ftdi/olimex-arm-usb-tiny-h.cfg&lt;br /&gt;
&lt;br /&gt;
# script for ATMEL sam3, a CORTEX-M3 chip&lt;br /&gt;
script target/at91sam3XXX.cfg&lt;br /&gt;
&lt;br /&gt;
$_TARGETNAME configure -rtos FreeRTOS&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Run OpenOCD ===&lt;br /&gt;
OpenOCD uses libusb to access the device and may need to run with sudo for it to work. If everything is connected together and the badge is powered on then you should see it detecting the CPU core as shown below:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ sudo openocd -f tilda.cfg&lt;br /&gt;
Open On-Chip Debugger 0.8.0 (2014-09-17-20:52)&lt;br /&gt;
Licensed under GNU GPL v2&lt;br /&gt;
For bug reports, read&lt;br /&gt;
        http://openocd.sourceforge.net/doc/doxygen/bugs.html&lt;br /&gt;
Info : only one transport option; autoselect 'jtag'&lt;br /&gt;
adapter speed: 500 kHz&lt;br /&gt;
adapter_nsrst_delay: 100&lt;br /&gt;
jtag_ntrst_delay: 100&lt;br /&gt;
cortex_m reset_config sysresetreq&lt;br /&gt;
Info : clock speed 500 kHz&lt;br /&gt;
Info : JTAG tap: sam3.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)&lt;br /&gt;
Info : sam3.cpu: hardware has 6 breakpoints, 4 watchpoints&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Patch TiLDA firmware for OpenOCD FreeRTOS detection ==&lt;br /&gt;
The OpenOCD code knows how to find the FreeRTOS tasks and can use this to make each task running on the badge as a different thread in GDB. To make this work you need to apply a small patch to the TiLDA code. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
diff --git a/EMF2014/TiLDATask.cpp b/EMF2014/TiLDATask.cpp&lt;br /&gt;
index 2cdc08d..701f940 100644&lt;br /&gt;
--- a/EMF2014/TiLDATask.cpp&lt;br /&gt;
+++ b/EMF2014/TiLDATask.cpp&lt;br /&gt;
@@ -58,6 +58,8 @@&lt;br /&gt;
 #include &amp;quot;logo.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;TiLDA_64x128.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
+// Hack to make FreeRTOS support work in OpenOCD&lt;br /&gt;
+unsigned portBASE_TYPE uxTopUsedPriority;&lt;br /&gt;
 &lt;br /&gt;
 TiLDATask::TiLDATask() {&lt;br /&gt;
 &lt;br /&gt;
@@ -68,6 +70,10 @@ String TiLDATask::getName() const {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TiLDATask::task() {&lt;br /&gt;
+&lt;br /&gt;
+    // Hack to make FreeRTOS support work in OpenOCD&lt;br /&gt;
+    uxTopUsedPriority = configMAX_PRIORITIES - 1;&lt;br /&gt;
+&lt;br /&gt;
     Tilda::_realTimeClock = new RTC_clock(RC);&lt;br /&gt;
     Tilda::_appManager = new AppManager;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This adds a variable that the OpenOCD expects to be able to read from the target to determine how many queues are being used by the FreeRTOS scheduler. This was present in older FreeRTOS release but has since been removed.&lt;br /&gt;
&lt;br /&gt;
== Build and flash the badge firmware ==&lt;br /&gt;
To make the debugger work you must be sure that the firmware running on the badge exactly matches the source code and binary objects that you have locally on your development machine. I recommend you apply the patch from the previous section, build the TiLDA firmware and upload it to your badge before you go any further.&lt;br /&gt;
&lt;br /&gt;
In the Arduino IDE you should build firmware (EMF2014 sketch) and upload it via the USB port on the TiLDA badge. (I have not attempted to upload firmware via the JTAG interface but that should be possible as well). The IDE writes a copy of the object files and the final executable to a directory in /tmp whenever you build the code. The firmware image file is &amp;lt;code&amp;gt;EMF2014.cpp.elf&amp;lt;/code&amp;gt; and you want to find the most recently built one, e.g.&lt;br /&gt;
&lt;br /&gt;
 [jburgess@shark]$ ls -lt /tmp/build*/EMF2014.cpp.elf | head -n 1&lt;br /&gt;
 -rwxrwxr-x. 1 jburgess jburgess 1475463 Sep 14 22:53 /tmp/build9091009552223609902.tmp/EMF2014.cpp.elf&lt;br /&gt;
&lt;br /&gt;
== Running GDB ==&lt;br /&gt;
First locate the EMF2014.cpp.elf file mentioned in the previous section. Run gdb with this file and with any luck it should be able to load it:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
[jburgess@shark tmp]$ gdb /tmp/build9091009552223609902.tmp/EMF2014.cpp.elf&lt;br /&gt;
GNU gdb (GDB) Fedora 7.7.1-18.fc20&lt;br /&gt;
Copyright (C) 2014 Free Software Foundation, Inc.&lt;br /&gt;
License GPLv3+: GNU GPL version 3 or later &amp;lt;http://gnu.org/licenses/gpl.html&amp;gt;&lt;br /&gt;
This is free software: you are free to change and redistribute it.&lt;br /&gt;
There is NO WARRANTY, to the extent permitted by law.  Type &amp;quot;show copying&amp;quot;&lt;br /&gt;
and &amp;quot;show warranty&amp;quot; for details.&lt;br /&gt;
This GDB was configured as &amp;quot;x86_64-redhat-linux-gnu&amp;quot;.&lt;br /&gt;
Type &amp;quot;show configuration&amp;quot; for configuration details.&lt;br /&gt;
For bug reporting instructions, please see:&lt;br /&gt;
&amp;lt;http://www.gnu.org/software/gdb/bugs/&amp;gt;.&lt;br /&gt;
Find the GDB manual and other documentation resources online at:&lt;br /&gt;
&amp;lt;http://www.gnu.org/software/gdb/documentation/&amp;gt;.&lt;br /&gt;
For help, type &amp;quot;help&amp;quot;.&lt;br /&gt;
Type &amp;quot;apropos word&amp;quot; to search for commands related to &amp;quot;word&amp;quot;...&lt;br /&gt;
Reading symbols from /tmp/build9091009552223609902.tmp/EMF2014.cpp.elf...done.&lt;br /&gt;
(gdb) &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Check debug symbols ===&lt;br /&gt;
Next try some simple commands to see whether GDB knows where symbols are located in the binary and source:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) info line main&lt;br /&gt;
Line 43 of &amp;quot;/home/jburgess/Documents/emf/Mk2-Firmware/hardware/emfcamp/sam/cores/rtos/main.cpp&amp;quot; starts at address 0x8fe78 &amp;lt;main()&amp;gt; and ends at 0x8fe7a &amp;lt;main()+2&amp;gt;.&lt;br /&gt;
(gdb) list main&lt;br /&gt;
38&lt;br /&gt;
39      /*&lt;br /&gt;
40       * \brief Main entry point of Arduino application&lt;br /&gt;
41       */&lt;br /&gt;
42      int main( void )&lt;br /&gt;
43      {&lt;br /&gt;
44              init();&lt;br /&gt;
45&lt;br /&gt;
46              initVariant();&lt;br /&gt;
47&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If something goes wrong at this point you could try using the copy of GDB provided with the arduino tools instead, e.g. &amp;lt;code&amp;gt;arduino-1.5.7/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-gdb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Attach GDB to OpenOCD ===&lt;br /&gt;
The OpenOCD supports a couple of different interfaces. Before we try GDB we should first stop the CPU using the basic control interface and tell it to halt the CPU:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
$ telnet localhost 4444&lt;br /&gt;
Trying 127.0.0.1...&lt;br /&gt;
Connected to localhost.&lt;br /&gt;
Escape character is '^]'.&lt;br /&gt;
Open On-Chip Debugger&lt;br /&gt;
&amp;gt; halt&lt;br /&gt;
target state: halted&lt;br /&gt;
target halted due to debug-request, current mode: Thread &lt;br /&gt;
xPSR: 0x61000000 pc: 0x000870ba psp: 0x20074a30&lt;br /&gt;
&amp;gt; &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To continue execution you can run &amp;quot;resume&amp;quot;. Make sure you run &amp;quot;halt&amp;quot; to leave the target in the stopped before attaching GDB. Normally when GDB attaches it should stop the target automatically but this isn't working at the moment. If the target is running then you may when GDB attaches then you may see some odd behaviour.&lt;br /&gt;
&lt;br /&gt;
The OpenOCD software runs a target server on localhost:3333 which we can ask GDB to attach to:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) target extended-remote localhost:3333&lt;br /&gt;
Remote debugging using localhost:3333&lt;br /&gt;
0x000870ba in prvCheckTasksWaitingTermination () at /home/jburgess/Documents/emf/Mk2-Firmware/hardware/emfcamp/sam/libraries/FreeRTOS_ARM/utility/tasks.c:2839&lt;br /&gt;
2839                    while( uxTasksDeleted &amp;gt; ( UBaseType_t ) 0U )&lt;br /&gt;
(gdb) &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== List FreeRTOS tasks ===&lt;br /&gt;
To list the running tasks you can use &amp;quot;info threads&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) info threads&lt;br /&gt;
[New Thread 537348080]&lt;br /&gt;
[New Thread 537396632]&lt;br /&gt;
[New Thread 537402416]&lt;br /&gt;
[New Thread 537394216]&lt;br /&gt;
[New Thread 537405232]&lt;br /&gt;
[New Thread 537393096]&lt;br /&gt;
[New Thread 537348848]&lt;br /&gt;
[New Thread 537398824]&lt;br /&gt;
[New Thread 537400224]&lt;br /&gt;
[New Thread 537346984]&lt;br /&gt;
[New Thread 537403512]&lt;br /&gt;
[New Thread 537397728]&lt;br /&gt;
[New Thread 537395312]&lt;br /&gt;
  Id   Target Id         Frame &lt;br /&gt;
  14   Thread 537395312 (MessageCh) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  13   Thread 537397728 (RadioTran) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  12   Thread 537403512 (IMUTask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  11   Thread 537346984 (TiLDATask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  10   Thread 537400224 (GUI) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  9    Thread 537398824 (LCD) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  8    Thread 537348848 (Tmr Svc) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  7    Thread 537393096 (RGBTask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  6    Thread 537405232 (HomeScree) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  5    Thread 537394216 (BatterySa) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  4    Thread 537402416 (PMICTask) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  3    Thread 537396632 (RadioRece) 0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
  2    Thread 537348080 (IDLE :  : Running) 0x000870ba in prvCheckTasksWaitingTermination ()&lt;br /&gt;
    at emfcamp/sam/libraries/FreeRTOS_ARM/utility/tasks.c:2839&lt;br /&gt;
* 1    Thread 537401320 (AppOpener) 0x000870ba in prvCheckTasksWaitingTermination ()&lt;br /&gt;
    at emfcamp/sam/libraries/FreeRTOS_ARM/utility/tasks.c:2839&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Most threads should claim to be in &amp;quot;vPortYield()&amp;quot; which is one of the OS routines that a task will call when it wants to sleep for a while.Select a task and you can obtain its backtrace:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
(gdb) thread 6&lt;br /&gt;
[Switching to thread 6 (Thread 537405232)]&lt;br /&gt;
#0  0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
385             __asm volatile( &amp;quot;isb&amp;quot; );&lt;br /&gt;
(gdb) bt&lt;br /&gt;
#0  0x00086750 in vPortYield () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:385&lt;br /&gt;
#1  0x00085c60 in xEventGroupWaitBits (xEventGroup=0x20082b78, uxBitsToWaitFor=1, xClearOnExit=0, xWaitForAllBits=0, xTicksToWait=&amp;lt;optimized out&amp;gt;)&lt;br /&gt;
    at emfcamp/sam/libraries/FreeRTOS_ARM/utility/event_groups.c:357&lt;br /&gt;
#2  0x0008453e in HomeScreenApp::task (this=0x20082710) at /tmp/build9091009552223609902.tmp/HomeScreenApp.cpp:157&lt;br /&gt;
#3  0x000818b4 in Task::taskCaller (this=0x20082710) at /tmp/build9091009552223609902.tmp/Task.cpp:78&lt;br /&gt;
#4  0x00081906 in Task::_task (self=&amp;lt;optimized out&amp;gt;) at /tmp/build9091009552223609902.tmp/Task.cpp:87&lt;br /&gt;
#5  0x00086768 in ulPortSetInterruptMask () at emfcamp/sam/libraries/FreeRTOS_ARM/utility/port.c:423&lt;br /&gt;
Backtrace stopped: previous frame identical to this frame (corrupt stack?)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
== Known issues ==&lt;br /&gt;
* &amp;lt;strike&amp;gt;Normally when you hit a breakpoint GDB will automatically switch to the thread that hit it. This is not happening at the moment. If you interrupt the code or hit a breakpoint you may have to manually switch threads. The 'info threads' puts &amp;quot;Running&amp;quot; next to task being executed and this is probably the one you need to switch to.&amp;lt;/strike&amp;gt;&lt;br /&gt;
** Fixed by applying this patch to OpenOCD http://openocd.zylin.com/#/c/2303/&lt;br /&gt;
* When you attach and detach GDB doesn't automatically halt/resume the target. You can do this manually using the interface on port 3333 or just tell GDB to continue, then interrupt to stop it.&lt;br /&gt;
* GDB hits an assert if you detach the target and asks whether you want a core dump.&lt;br /&gt;
** This appears to be: https://sourceware.org/bugzilla/show_bug.cgi?id=12228&lt;br /&gt;
* I had a problem where the badge kept stopping at a breakpoint that I set in a previous GDB session and I was unable to fix it without power cycling the badge and restarting GDB &amp;amp; OpenOCD.&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3695</id>
		<title>TiLDA MKe</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3695"/>
		<updated>2014-09-10T19:05:52Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: /* Features and Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA MKe project, Code name &amp;quot;ElectroMagnetic Boogaloo&amp;quot;, is being headed by [[User:Dpslwk|'RepRap' Matt]] and [[User:thinkl33t|Bob]]&lt;br /&gt;
[[File:IMG_0474.jpg|500px|right|thumb|Front]]&lt;br /&gt;
[[File:Badge_Front.png|right|thumb|Front]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/E_(mathematical_constant) Why MKe?]&lt;br /&gt;
&lt;br /&gt;
Please Note: There are a couple of minor hardware and some firmware issues that might be effecting your badge. If you've let the magic smoke out of your charge controller or have tried to re-flash and ended up with nothing but a couple of dimly glowing lights then DO NOT DESPAIR -It's recoverable and fixes, documentation and lots of firmware are still being produced :)&lt;br /&gt;
&lt;br /&gt;
=Aim= &lt;br /&gt;
The main aim of the 2014 badge is to give camp attendees live schedule updates and notifications. As with the original TiLDA we wanted to keep with an Arduino compatible platform that will allow badge hacking during and after the camp. As with the previous badge all code and design files are available.&lt;br /&gt;
&lt;br /&gt;
==Battery Warning==&lt;br /&gt;
'''Always make sure you plug your battery in the right way round!'''  If you don't, the charge controller will let out its magic smoke and die / become damaged and die later.  The badge itself will still work, but it wont have the ability to charge anymore.  &lt;br /&gt;
&lt;br /&gt;
We think this is the cause of the charge controller issues a small number of badges had at the event was due to this mistake being made during final assembly on-site. &lt;br /&gt;
&lt;br /&gt;
'''Lithium Batteries are dangerous!'''  While these batteries are better protected than the MK1 batteries, they are still scary.  Do not short your battery, and if it starts bulging or gets punctured, '''DO NOT USE IT AGAIN''' and dispose of it properly.&lt;br /&gt;
&lt;br /&gt;
==Features and Functions==&lt;br /&gt;
[[File:Badge_Back.png|right|thumb|Back]]&lt;br /&gt;
* Torch mode - Press the light button next to the screen. It will only light up fully if it's hung upside down to avoid blinding&lt;br /&gt;
* Snake&lt;br /&gt;
* Tetris&lt;br /&gt;
&lt;br /&gt;
'''Please note that there's a known issue with the badge freezing'''. We're trying to work out what's causing this, but in the meantime pressing &amp;quot;reset&amp;quot; should get the badge back to life. Help with debugging is highly welcome!&lt;br /&gt;
&lt;br /&gt;
== How to get going ==&lt;br /&gt;
=== Set up your environment ===&lt;br /&gt;
* Plug your badge into your computer via USB&lt;br /&gt;
* Download Arduino IDE 1.5.7 from http://arduino.cc/en/main/software#toc3&lt;br /&gt;
* “git clone” or download TiLDA source code from https://github.com/emfcamp/Mk2-Firmware&lt;br /&gt;
* Start the Arduino IDE. &lt;br /&gt;
* Now you have to change the sketchbook-folder to be the folder you just cloned. To do this use File | Preferences | “Set Sketchbook location”. On MacOS, this is Arduino | Preferences &lt;br /&gt;
* Restart the Arduino IDE&lt;br /&gt;
* Open sketch “EMF2014”&lt;br /&gt;
* Set Tools | Board to MKe v0.333 (RTOS Core)&lt;br /&gt;
* Set Tools | Port to correct port (you might have to research this - some operating systems like Windows require you to install drivers or become a member of a certain group)&lt;br /&gt;
** On MacOS this is will start /dev/tty.usbmodem with 4 digits, and change for each port&lt;br /&gt;
** On Linux this is usually /dev/ttyACM0 but may be a higher number if you have other USB Serial devices&lt;br /&gt;
* Hit the upload button&lt;br /&gt;
* Wait&lt;br /&gt;
* Woohoo - You just successfully uploaded code to your badge&lt;br /&gt;
&lt;br /&gt;
=== Your first “Hello world” app ===&lt;br /&gt;
There’s a “HelloWorldApp.cpp” file in which you can play around. In order for it to show up on the Homescreen you have to uncomment line 51 in AppManager.cpp and flash the changed code to the badge. Great app pull requests are appreciated!&lt;br /&gt;
&lt;br /&gt;
If you are still using the Arduino IDE at this point, note that it will not let you edit the .cpp and .h files that are needed to create Apps for the badge. To force the IDE to re-compile/re-read any files you've edited using an external editor, make sure to go to the File -&amp;gt; Preferences dialog box, and check the &amp;quot;Use external editor&amp;quot; checkbox.&lt;br /&gt;
&lt;br /&gt;
=== Why are things so different from standard Arduino code? ===&lt;br /&gt;
We’re using a library called FreeRTOS that allows us to multitask - something that’s normally not possible with standard Arduino code. This allows us to run multiple tasks at the same time. FreeRTOS uses preemptive scheduling to switch between the task. Due to this we have to be very careful about how we do some things. For example we can’t just define interrupts for buttons in every task (imagine the mess!) or write to the serial port directly (your task might stop in the middle of the message). &lt;br /&gt;
&lt;br /&gt;
We’ve also spend quite a lot of time to make the build-in components as easy to use as possible without having every task to write lots of boilerplate code. If you feel like using the build-in components on the badge, chances are we already wrote a wrapper for them that is already used by one of the other tasks. &lt;br /&gt;
&lt;br /&gt;
Have a look at the “Documentation” section in this document for a full list of API functions. You will avoid a lot of headaches if you stick to those.&lt;br /&gt;
=== How to use the badge with pure Arduino code ===&lt;br /&gt;
If you prefer you can always start from scratch without FreeRTOS or any of our code, just keep in mind that you won’t be able to receive messages via radio or use any of the API features we already added. Just start a new sketch in the Arduino IDE for that and get going. If you want to load the main firmware again just change the sketch to “EMF2014” and upload again.&lt;br /&gt;
=== Debugging and Gotchas ===&lt;br /&gt;
* The USB serial is set up to 115220 baud. There are lots of terminals that can connect to them&lt;br /&gt;
* If you can’t revive a badge you can short the two erase pins and press the reset button while holding it down.&lt;br /&gt;
* Avoid busy waiting, use FreeRTOS queues and Tilda::delay() instead&lt;br /&gt;
* Don’t use low level functions like interrupts or serial ports directly unless you really, really know how FreeRTOS will handle them. For general logging you can use Tilda::log()&lt;br /&gt;
* If sending code to the badge using the Arduino IDE &amp;quot;Upload&amp;quot; button fails, even though the /dev/ttyACM0 (linux com port) is there, just retry, twice if neccessary.&lt;br /&gt;
&lt;br /&gt;
=== Code structure ===&lt;br /&gt;
* FreeRTOS has the concept of “Tasks” which work like threads. We’ve wrappered them in a class called “Task” (for background stuff) and “Apps” (for foreground, one-at-a-time things)&lt;br /&gt;
* Everything needs to be in the main EMF2014 folder. Subfolders are not allowed. This is an Arduino IDE restriction :(&lt;br /&gt;
=== Radio infrastructure ===&lt;br /&gt;
The radio infrastructure is distributed between DKs. Every “gateway” has a Raspberry Pi with two Ciseco USB radios. We never had the chance to actually try it with a large number of badges in the same spot, so please don’t expect it to work perfectly.&lt;br /&gt;
&lt;br /&gt;
=== Contribute ===&lt;br /&gt;
Send us a pull request via [https://github.com/emfcamp/Mk2-Firmware GitHub] - We’ll do our best to review and merge the good ones during EMF so others can use them.&lt;br /&gt;
&lt;br /&gt;
=Hardware=&lt;br /&gt;
&lt;br /&gt;
The following hardware has been included on the badge.&lt;br /&gt;
&lt;br /&gt;
* [http://www.atmel.com/products/microcontrollers/arm/sam3x.aspx Atmel ATSAM3X8E]&lt;br /&gt;
** This is the same chip as the [http://arduino.cc/en/Main/ArduinoBoardDue Arduino Due] and gives us the base platform for the badge&lt;br /&gt;
** 32bit ARM Cortex M3 * 84MHz&lt;br /&gt;
** 512KBytes Flash RAM&lt;br /&gt;
** 96KBytes of SRAM&lt;br /&gt;
* A 128x64 pixel monochrome LCD display&lt;br /&gt;
* [http://shop.ciseco.co.uk/srf-wireless-rf-radio-surface-mount/ Ciseco SRF Radio]&lt;br /&gt;
** 868Mhz RF Transceiver&lt;br /&gt;
** Simple UART interface&lt;br /&gt;
** Low power sleep mode&lt;br /&gt;
* [http://www.invensense.com/mems/gyro/mpu6050.html MPU-6050] 3-axis Accelerometer and 3-axis gyro&lt;br /&gt;
** I2C interface&lt;br /&gt;
** Tri-Axis angular rate sensor (gyro) with a sensitivity up to 131 LSBs/dps and a full-scale range of ±250, ±500, ±1000, and ±2000dps&lt;br /&gt;
** Tri-Axis accelerometer with a programmable full scale range of ±2g, ±4g, ±8g and ±16g&lt;br /&gt;
** Digital Motion Processing™ (DMP™) engine offloads complex MotionFusion, sensor timing synchronisation and gesture detection&lt;br /&gt;
* PMIC &amp;amp; LiPo&lt;br /&gt;
* Joystick&lt;br /&gt;
* Buttons&lt;br /&gt;
* RGB LEDs&lt;br /&gt;
* IR&lt;br /&gt;
* Arduino Headers&lt;br /&gt;
* Pads for wearable tech&lt;br /&gt;
&lt;br /&gt;
= Firmware Documentation =&lt;br /&gt;
== Debugging ==&lt;br /&gt;
===Tilda::log(String text)===&lt;br /&gt;
&lt;br /&gt;
This logs “text” to the serial console. To read it connect to it via the Arduino IDE Serial Monitor. Don’t use “SerialUSB.println” or similar -- it’s not thread-safe and you might end up with utter nonsense.&lt;br /&gt;
== Buttons ==&lt;br /&gt;
The badge has 8 buttons: Up, Down, Left, Right, Center (on the joystick), A, B and Light. You can use arduino-style “digitalRead(BUTTON_RIGHT)” to read the current status of any button, but you can’t define your own interrupt (because we already did that). This doesn’t mean you can’t wait for a certain button to be pressed, it just means you have to approach it slightly differently:&lt;br /&gt;
&lt;br /&gt;
Example: A simple app displaying the button code&lt;br /&gt;
 void ButtonApp::task() {&lt;br /&gt;
     ButtonSubscription allButtons = Tilda::createButtonSubscription(LIGHT | A | B | UP | DOWN | LEFT | RIGHT | CENTER);&lt;br /&gt;
 &lt;br /&gt;
     while(true) {&lt;br /&gt;
         Button button = allButtons.waitForPress(1000);&lt;br /&gt;
         if (button == A) {&lt;br /&gt;
             debug::log(“You pressed button A”);&lt;br /&gt;
         } else if (button == LEFT) {&lt;br /&gt;
             debug::log(“You pressed LEFT”);&lt;br /&gt;
         } else if (button == NONE) {&lt;br /&gt;
             debug::log(“No button has been pressed in 1000ms”); &lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription Tilda::createButtonSubscription(&amp;lt;buttons&amp;gt;)===&lt;br /&gt;
&lt;br /&gt;
Registers a subscriptions for a defined set of buttons and returns a ButtonSubscription. Multiple Buttons can be combined via “|” (see example above). One button can not be subscribed by more than 10 subscriptions (which shouldn’t really happen, but keep it in mind). &lt;br /&gt;
&lt;br /&gt;
Don’t use this function in a constructor, it requires FreeRTOS to be running. Using it inside the task() function is the only safe place for it.&lt;br /&gt;
&lt;br /&gt;
===Button ButtonSubscription::waitForPress(TimeInTicks timeout)===&lt;br /&gt;
&lt;br /&gt;
This is normally called in a loop. It causes the task to block until one of the buttons has been pressed. If the timeout occurs before any button has been pressed “NONE” will be returned. &lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::waitForPress()===&lt;br /&gt;
&lt;br /&gt;
The same as above, but without the timeout.&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::clear()===&lt;br /&gt;
&lt;br /&gt;
This should be called after an App has been suspended, just before it’s going to be resumed. It causes the Queue to be cleared which could otherwise lead to buttons being reported that have been pressed while other apps were in the foreground. Have a look at the FlashLightApp for an example.&lt;br /&gt;
&lt;br /&gt;
==LEDs==&lt;br /&gt;
===Tilda::setLedColor(Led led, Color color);===&lt;br /&gt;
===Tilde::setLedColor(Color color);===&lt;br /&gt;
&lt;br /&gt;
Sets the color of all or one led. Color is an object that takes red, green and blue as a value between 0 and 255 each. If no led is defined both leds will be set to the same color.&lt;br /&gt;
&lt;br /&gt;
Example: A simple color-changing task&lt;br /&gt;
 void ColorfulTask::task() {&lt;br /&gt;
     while(true) {&lt;br /&gt;
         Tilda::setLedColor(LED1, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::setLedColor(LED2, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Display==&lt;br /&gt;
&lt;br /&gt;
The Display Library is based on GLCDv3 (http://playground.arduino.cc/Code/GLCDks0108), docs (http://code.google.com/p/glcd-arduino/source/browse/trunk/glcd/doc/GLCD_Documentation.pdf) but adapted to support our screen.  The Init routine is called in the setup, and the LCDTask takes care of ensuring the screen is updated every 40ms if required (Unlike the original GLCD library, screen updates are decoupled from the graphics routines.)&lt;br /&gt;
&lt;br /&gt;
Also available is M2tklib (https://code.google.com/p/m2tklib/) which is a nice toolkit library.  Further details on using this will come later, but expect the main loop to be handled for you, and just passing the menu structure you require for your app.&lt;br /&gt;
&lt;br /&gt;
Right now, you can call the GLCD functions directly with GLCD.DrawBitmap() for example.  This is going to change to be accessed through the GUITask class in the near future, to ensure only one task at a time writes to the screen.  Expect this to be simply GUITask in place of GLCD, along with a registering a redraw call back to GUITask. The bitmap format, by the way, is rather unconventional but there are a couple of utility scripts to convert popular formats down in the hacking section below - you can grab the SponsorsApp.h as an example and swap out the bitmap array with one of your choosing.&lt;br /&gt;
&lt;br /&gt;
Extra features that are included, GLCD.SetRotation() will handle rotation of the screen for you, and GLCD.CurrentWidth() and GLCD.CurrentHeight will give you the correct Width and Height for the current orientation.  GLCD.Width and GLCD.Height constants are not available, and the GLCD predefined Text areas will not be rotated for you, if you require this define your own text areas.&lt;br /&gt;
&lt;br /&gt;
Note that one function was not ported to the badge version of GLCD, &amp;quot;Printf&amp;quot;, you'll have to cope without it.&lt;br /&gt;
&lt;br /&gt;
== Sound == &lt;br /&gt;
There's a piezo on the board, but we haven't added code for it to the current firmware. Pull requests are very welcome!&lt;br /&gt;
&lt;br /&gt;
== IMU ==&lt;br /&gt;
=== Tilda::getOrientation ===&lt;br /&gt;
returns &amp;quot; ORIENTATION_HELD&amp;quot;, &amp;quot;ORIENTATION_RIGHT&amp;quot; (joystick to the right of the screen), &amp;quot;ORIENTATION_HUNG&amp;quot; or &amp;quot;ORIENTATION_LEFT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Flash Storage ==&lt;br /&gt;
We have 2mb of flash storage, but we're not using it in the main firmware - Please get this working!&lt;br /&gt;
== Data: Schedule ==&lt;br /&gt;
===Tilda::getDataStore().getSchedule(day, location) ===&lt;br /&gt;
== Date: Weather Forecast ==&lt;br /&gt;
===Tilda::getDataStore().getWeatherForecast()===&lt;br /&gt;
== Radio ==&lt;br /&gt;
There's no way of sending messages in the current version of the firmware, sorry :(&lt;br /&gt;
&lt;br /&gt;
== Time ==&lt;br /&gt;
&lt;br /&gt;
=== Tilda::delay(uint16_t delayInMs) === &lt;br /&gt;
&lt;br /&gt;
Works like Arduino’s delay(), but is FreeRTOS-safe. It’s safe to use this function before FreeRTOS has started.&lt;br /&gt;
&lt;br /&gt;
=== tilda::getClock() ===&lt;br /&gt;
&lt;br /&gt;
Returns an instance of https://github.com/MarkusLange/Arduino-Due-RTC-Library/blob/master/rtc_clock.h&lt;br /&gt;
&lt;br /&gt;
==Settings==&lt;br /&gt;
===uint16_t tilda::getBadgeId()===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==2.12. Battery==&lt;br /&gt;
===float TiLDA::getBatteryVoltage()===&lt;br /&gt;
Returns the current voltage as a float&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getBatteryPercent()===&lt;br /&gt;
Returns the current voltage as a percentage&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getChargeState()===&lt;br /&gt;
Returns the charge state&lt;br /&gt;
&lt;br /&gt;
0 Charging&lt;br /&gt;
1 Not Charging&lt;br /&gt;
&lt;br /&gt;
=Hacking=&lt;br /&gt;
To use our board definition you will need to first get the Arduino 1.5.7 IDE from [http://arduino.cc/en/Main/Software#toc3 here]&amp;lt;br/&amp;gt;&lt;br /&gt;
Next you can download the TiLDA MKe Firmware project from either the [https://github.com/emfcamp/Mk2-Firmware github repo] or via [https://github.com/emfcamp/Mk2-Firmware/archive/master.zip direct download]&amp;lt;br/&amp;gt;&lt;br /&gt;
Now copy the &amp;quot;hardware&amp;quot; folder to your Sketchbook folder, this is usually ~/Sketchbook/&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br/&amp;gt;&lt;br /&gt;
Alternative option is to set the Arduino 1.5.7 sketchbook folder to the Mk2-Firmware directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start the Arduino IDE and your will be able to select TiLDA MKe v0.333 for the Tools-&amp;gt;Board menu&lt;br /&gt;
&lt;br /&gt;
* Draft 3d print-able and laser-able case files [http://www.thingiverse.com/thing:436815 here]&lt;br /&gt;
* A Python script (via [https://twitter.com/trotmaster99 @trotmaster99]) that converts a monochrome bitmap image into a format suitable for the Tilda can be found [http://pastebin.com/8XeazQjT here].&lt;br /&gt;
* A similar script in Perl to create TiLDA MKe fullscreen bitmaps from XBM: -&lt;br /&gt;
&amp;lt;div style =&amp;quot;height:200px;overflow-x:hidden;overflow-y:auto;border: 4px solid orange;&amp;quot;&amp;gt;&lt;br /&gt;
'''xbm2mke.pl by [[User:Msemtd]]'''&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!perl -w&lt;br /&gt;
use strict;&lt;br /&gt;
# Little script to convert a regular XBM to TiLDA MKe bitmap&lt;br /&gt;
# only tested with fullscreen bitmaps!&lt;br /&gt;
# Hot file handle magic...&lt;br /&gt;
select((select(STDERR), $| = 1)[0]);&lt;br /&gt;
select((select(STDOUT), $| = 1)[0]);&lt;br /&gt;
sub t(@);&lt;br /&gt;
sub d($);&lt;br /&gt;
sub chug($);&lt;br /&gt;
my $f = shift;&lt;br /&gt;
#~ $f = 'blankish.xbm' if not $f;&lt;br /&gt;
if(not defined $f or not $f =~ /^(.*)\.xbm$/i){&lt;br /&gt;
    die &amp;quot;Usage: gimme an XBM file dude!\n&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
my $name = $1;&lt;br /&gt;
t &amp;quot;Reading file '$f'...&amp;quot;;&lt;br /&gt;
my $data = chug($f);&lt;br /&gt;
t &amp;quot;OK&amp;quot;;&lt;br /&gt;
my @lines = split /^/, $data;&lt;br /&gt;
@lines = grep{chomp; s/^\s+//; s/\s+$//; length;} @lines;&lt;br /&gt;
#~ t d \@lines;&lt;br /&gt;
my($width, $height) = (0,0);&lt;br /&gt;
my @head = @lines[0..5];&lt;br /&gt;
foreach(@head){&lt;br /&gt;
    if(/_width\s+(\d+)/){$width = $1;}&lt;br /&gt;
    if(/_height\s+(\d+)/){$height = $1;}&lt;br /&gt;
}&lt;br /&gt;
t &amp;quot;width x height = $width x $height&amp;quot;;&lt;br /&gt;
my @k;&lt;br /&gt;
foreach(@lines){ push @k, split /,/; }&lt;br /&gt;
@k = grep { s/^.*(0x[0-9A-Fa-f]{1,2}).*$/$1/o; /(0x[0-9A-Fa-f]{1,2})/o } @k;&lt;br /&gt;
#~ t d \@k;&lt;br /&gt;
my $bc = scalar(@k);&lt;br /&gt;
t &amp;quot;Pulled out $bc hex bytes&amp;quot;;&lt;br /&gt;
if($bc != $width * $height / 8) {&lt;br /&gt;
    die &amp;quot;byte count $bc does not match that expected for w x h&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
t &amp;quot;OK - reorder bytes for MKe bitmap&amp;quot;;&lt;br /&gt;
my $wb = int($width/8) + (($width &amp;amp; 0x07) ? 1: 0);&lt;br /&gt;
t &amp;quot;width in whole bytes for $width pixels = $wb&amp;quot;;&lt;br /&gt;
my @mke;&lt;br /&gt;
for(my $col = 0; $col &amp;lt; $wb; $col++){&lt;br /&gt;
    for(my $row = $height - 1; $row &amp;gt;= 0; $row--){&lt;br /&gt;
        my $idx = ($row * $wb) + $col;&lt;br /&gt;
        my $val = $k[$idx];&lt;br /&gt;
        #~ t &amp;quot;Column $col + Row $row = idx $idx = $val&amp;quot;;&lt;br /&gt;
        push @mke, $val;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
my $out = &amp;quot;static const uint8_t &amp;quot;.uc($name).&amp;quot;_BM[] = {\n&amp;quot;&lt;br /&gt;
	.&amp;quot;    $width, // width\n&amp;quot;&lt;br /&gt;
	.&amp;quot;    $height , // height\n&amp;quot;;&lt;br /&gt;
#~ $out .= join(&amp;quot;, &amp;quot;, @mke);&lt;br /&gt;
while(scalar @mke){&lt;br /&gt;
	$out .= join(&amp;quot;, &amp;quot;, splice(@mke, 0, 16)).&amp;quot;,\n&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
$out .= &amp;quot;};\n&amp;quot;;&lt;br /&gt;
# meh, just print it out&lt;br /&gt;
t $out;&lt;br /&gt;
&lt;br /&gt;
sub t(@) {&lt;br /&gt;
    foreach (@_) {&lt;br /&gt;
       print STDOUT &amp;quot;$_\n&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
sub d($) {&lt;br /&gt;
    require Data::Dumper;&lt;br /&gt;
    my $s = $_[0];&lt;br /&gt;
    my $d = Data::Dumper::Dumper($s);&lt;br /&gt;
    $d =~ s/^\$VAR1 =\s*//;&lt;br /&gt;
    $d =~ s/;$//;&lt;br /&gt;
    chomp $d;&lt;br /&gt;
    return $d;&lt;br /&gt;
}&lt;br /&gt;
sub chug($) {&lt;br /&gt;
  my $filename = shift;&lt;br /&gt;
  local *F;&lt;br /&gt;
  open F, &amp;quot;&amp;lt; $filename&amp;quot; or die &amp;quot;Couldn't open `$filename': $!&amp;quot;;&lt;br /&gt;
  local $/ = undef;&lt;br /&gt;
  return &amp;lt;F&amp;gt;;&lt;br /&gt;
}  # F automatically closed&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;span id=github&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Source =&lt;br /&gt;
&lt;br /&gt;
All the source code and designs are on openly available on Github:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Hardware Hardware] - the full board design&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Documentation Documentation] - a dump of relevant parts datasheets&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Firmware Firmware] - source code for the badge software&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Software Software] - server-side software for the network&lt;br /&gt;
&lt;br /&gt;
[[Category: Badges]]&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3401</id>
		<title>TiLDA MKe</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3401"/>
		<updated>2014-09-01T18:36:03Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: /* Flash Storage = */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA MKe project, Code name &amp;quot;ElectroMagnetic Boogaloo&amp;quot;, is being headed by [[User:Dpslwk|'RepRap' Matt]] and [[User:thinkl33t|Bob]]&lt;br /&gt;
[[File:Badge_Front.png|right|thumb|Front]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/E_(mathematical_constant) Why MKe?]&lt;br /&gt;
&lt;br /&gt;
=Aim= &lt;br /&gt;
The main aim of the 2014 badge is to give camp attendees live schedule updates and notifications. As with the original TiLDA we wanted to keep with an Arduino compatible platform that will allow badge hacking during and after the camp. As with previous badge all code and design files are available.&lt;br /&gt;
&lt;br /&gt;
==Features and Functions==&lt;br /&gt;
[[File:Badge_Back.png|right|thumb|Back]]&lt;br /&gt;
* Torch mode - Press the light button next to the screen. It will only light up fully if it's hung upside down to avoid blinding&lt;br /&gt;
* Snake&lt;br /&gt;
* Tetris&lt;br /&gt;
* Weather Forecast&lt;br /&gt;
* Schedule&lt;br /&gt;
* Can receive notifications about upcoming schedule items you're interested in. Visit schedule.emf.camp to set up your account.&lt;br /&gt;
&lt;br /&gt;
'''Please note that there's a known issue with the badge freezing'''. We're trying to work out what's causing this, but in the meantime pressing &amp;quot;reset&amp;quot; should get the badge back to life. Help with debugging is highly welcome!&lt;br /&gt;
&lt;br /&gt;
== How to get going ==&lt;br /&gt;
=== Set up your environment ===&lt;br /&gt;
* Plug your badge into your computer via USB&lt;br /&gt;
* Download Arduino IDE 1.5.7 from http://arduino.cc/en/main/software#toc3&lt;br /&gt;
* “git clone” or download TiLDA source code from https://github.com/emfcamp/Mk2-Firmware&lt;br /&gt;
* Start the Arduino IDE. &lt;br /&gt;
* Now you have to change the sketchbook-folder to be the folder you just cloned. To do this use File | Preferences | “Set Sketchbook location”. On MacOS, this is Arduino | Preferences &lt;br /&gt;
* Restart the Arduino IDE&lt;br /&gt;
* Open sketch “EMF2014”&lt;br /&gt;
* Set Tools | Board to MKe v0.333 (RTOS Core)&lt;br /&gt;
* Set Tools | Port to correct port (you might have to research this - some operating systems like Windows require you to install drivers or become member of a certain group)&lt;br /&gt;
** On Macos this is will start /dev/tty.usbmodem with 4 digits, and change for each port&lt;br /&gt;
** On Linux this is usually /dev/ttyACM0 but may be a higher number if you have other USB Serial devices&lt;br /&gt;
* Hit the upload button&lt;br /&gt;
* Wait&lt;br /&gt;
* Woohoo - You just successfully uploaded code to your badge&lt;br /&gt;
&lt;br /&gt;
=== Your first “Hello world” App ===&lt;br /&gt;
There’s a “HelloWorldApp.cpp” file in which you can play around. In order for it to show up on the Homescreen you have to uncomment line 51 in AppManager.cpp and flash the changed code to the badge. Great app pull requests are appreciated!&lt;br /&gt;
&lt;br /&gt;
=== Why are things so different from standard arduino code? ===&lt;br /&gt;
We’re using a library called FreeRTOS that allows us to multitask - something that’s normally not possible with standard arduino code. This allows us to run multiple tasks at the same time. FreeRTOS uses preemptive scheduling to switch between the task. Due to this we have to be very careful about how we do some things. For example we can’t just define interrupts for buttons in every task (imagine the mess!) or write to the serial port directly (your task might stop in the middle of the message). &lt;br /&gt;
&lt;br /&gt;
We’ve also spend quite a lot of time to make the build-in components as easy to use as possible without having every task to write lots of boilerplate code. If you feel like using the build-in components on the badge, chances are we already wrote a wrapper for them that is already used by one of the other tasks. &lt;br /&gt;
&lt;br /&gt;
Have a look at the “Documentation” section in this document for a full list of API functions. You will avoid a lot of headache if you stick to those.&lt;br /&gt;
=== How to use the badge with pure Arduino code ===&lt;br /&gt;
If you prefer you can always start from scratch without FreeRTOS or any of our code, just keep in mind that you won’t be able to receive messages via radio or use any of the API features we already added. Just start a new sketch in the Arduino IDE for that and get going. If you want to load the main firmware again just change the sketch to “EMF2014” and upload again.&lt;br /&gt;
=== Debugging and Gotchas ===&lt;br /&gt;
* The USB serial is set up to 115220 baud. There are lots of terminals that can connect to them&lt;br /&gt;
* If you can’t revive a badge you can short the two erase pins and press the reset button while holding it down.&lt;br /&gt;
* Avoid busy waiting, use FreeRTOS queues and Tilda::delay() instead&lt;br /&gt;
* Don’t use low level functions like interrupts or serial ports directly unless you really, really know how FreeRTOS will handle them. For general logging you can use Tilda::log()&lt;br /&gt;
=== Code structure ===&lt;br /&gt;
* FreeRTOS has the concept of “Tasks” which work like threads. We’ve wrappered them in a class called “Task” (for background stuff) and “Apps” (for foreground, one-at-a-time things)&lt;br /&gt;
* Everything needs to be in the main EMF2014 folder. Subfolders are not allowed. This is an Arduino IDE restriction :(&lt;br /&gt;
=== Radio infrastructure ===&lt;br /&gt;
The radio infrastructure is distributed between DKs. Every “gateway” has a raspberry pi with two ciseco usb radios. We never had the change to actually try it with that many badges in the same spot, so please don’t expect it to work perfectly.&lt;br /&gt;
=== Contribute ===&lt;br /&gt;
Send us pull request via github - We’ll do our best to review and merge the good ones during EMF so others can use them.&lt;br /&gt;
&lt;br /&gt;
=Hardware=&lt;br /&gt;
&lt;br /&gt;
The following hardware has been included on the badge.&lt;br /&gt;
&lt;br /&gt;
* [http://www.atmel.com/products/microcontrollers/arm/sam3x.aspx Atmel ATSAM3X8E]&lt;br /&gt;
** This is the same chip as the [http://arduino.cc/en/Main/ArduinoBoardDue Arduino Due] and gives us the base platform for the badge&lt;br /&gt;
** 32bit ARM Cortex M3 * 84MHz&lt;br /&gt;
** 512KBytes Flash RAM&lt;br /&gt;
** 96KBytes of SRAM&lt;br /&gt;
* A 128x64 pixel monochrome LCD display&lt;br /&gt;
* [http://shop.ciseco.co.uk/srf-wireless-rf-radio-surface-mount/ Ciseco SRF Radio]&lt;br /&gt;
** 868Mhz RF Transceiver&lt;br /&gt;
** Simple UART interface&lt;br /&gt;
** Low power sleep mode&lt;br /&gt;
* [http://www.invensense.com/mems/gyro/mpu6050.html MPU-6050] 3-axis Accelerometer and 3-axis gyro&lt;br /&gt;
** I2C interface&lt;br /&gt;
** Tri-Axis angular rate sensor (gyro) with a sensitivity up to 131 LSBs/dps and a full-scale range of ±250, ±500, ±1000, and ±2000dps&lt;br /&gt;
** Tri-Axis accelerometer with a programmable full scale range of ±2g, ±4g, ±8g and ±16g&lt;br /&gt;
** Digital Motion Processing™ (DMP™) engine offloads complex MotionFusion, sensor timing synchronization and gesture detection&lt;br /&gt;
* PMIC &amp;amp; LiPo&lt;br /&gt;
* Joystick&lt;br /&gt;
* Buttons&lt;br /&gt;
* RGB LED's&lt;br /&gt;
* IR&lt;br /&gt;
* Arduino Headers&lt;br /&gt;
* Pads for wearable tech&lt;br /&gt;
&lt;br /&gt;
= Firmware Documentation =&lt;br /&gt;
== Debugging ==&lt;br /&gt;
===Tilda::log(String text)===&lt;br /&gt;
&lt;br /&gt;
This logs “text” to the serial console. To read it connect to it via the Arduino IDE Serial Monitor. Don’t use “SerialUSB.println” or similar -- it’s not thread-safe and you might end up with utter nonsense.&lt;br /&gt;
== Buttons ==&lt;br /&gt;
The badge has 8 buttons: Up, Down, Left, Right, Center (on the joystick), A, B and Light. You can use arduino-style “digitalRead(BUTTON_RIGHT)” to read the current status of any button, but you can’t define your own interrupt (because we already did that). This doesn’t mean you can’t wait for a certain button to be pressed, it just means you have to approach it slightly differently:&lt;br /&gt;
&lt;br /&gt;
Example: A simple app displaying the button code&lt;br /&gt;
 void ButtonApp::task() {&lt;br /&gt;
     ButtonSubscription allButtons = Tilda::createButtonSubscription(LIGHT | A | B | UP | DOWN | LEFT | RIGHT | CENTER);&lt;br /&gt;
 &lt;br /&gt;
     while(true) {&lt;br /&gt;
         Button button = allButtons.waitForPress(1000);&lt;br /&gt;
         if (button == A) {&lt;br /&gt;
             debug::log(“You pressed button A”);&lt;br /&gt;
         } else if (button == LEFT) {&lt;br /&gt;
             debug::log(“You pressed LEFT”);&lt;br /&gt;
         } else if (button == NONE) {&lt;br /&gt;
             debug::log(“No button has been pressed in 1000ms”); &lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription Tilda::createButtonSubscription(&amp;lt;buttons&amp;gt;)===&lt;br /&gt;
&lt;br /&gt;
Registers a subscriptions for a defined set of buttons and returns a ButtonSubscription. Multiple Buttons can be combined via “|” (see example above). One button can not be subscribed by more than 10 subscriptions (which shouldn’t really happen, but keep it in mind). &lt;br /&gt;
&lt;br /&gt;
Don’t use this function in a constructor, it requires FreeRTOS to be running. Using it inside the task() function is the only safe place for it.&lt;br /&gt;
&lt;br /&gt;
===Button ButtonSubscription::waitForPress(TimeInTicks timeout)===&lt;br /&gt;
&lt;br /&gt;
This is normally called in a loop. It causes the task to block until one of the buttons has been pressed. If the timeout occurs before any button has been pressed “NONE” will be returned. &lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::waitForPress()===&lt;br /&gt;
&lt;br /&gt;
The same as above, but without the timeout.&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::clear()===&lt;br /&gt;
&lt;br /&gt;
This should be called after an App has been suspended, just before it’s going to be resumed. It causes the Queue to be cleared which could otherwise lead to buttons being reported that have been pressed while other apps were in the foreground. Have a look at the FlashLightApp for an example.&lt;br /&gt;
&lt;br /&gt;
==LEDs==&lt;br /&gt;
===Tilda::setLedColor(Led led, Color color);===&lt;br /&gt;
===Tilde::setLedColor(Color color);===&lt;br /&gt;
&lt;br /&gt;
Sets the color of all or one led. Color is an object that takes red, green and blue as a value between 0 and 255 each. If no led is defined both leds will be set to the same color.&lt;br /&gt;
&lt;br /&gt;
Example: A simple color-changing task&lt;br /&gt;
 void ColorfulTask::task() {&lt;br /&gt;
     while(true) {&lt;br /&gt;
         Tilda::setLedColor(LED1, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::setLedColor(LED2, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Display==&lt;br /&gt;
&lt;br /&gt;
The Display Library is based on GLCDv3 (http://playground.arduino.cc/Code/GLCDks0108) but adapted to support our screen.  The Init routine is called in the setup, and the LCDTask takes care of ensuring the screen is updated every 40ms if required (Unlike the original GLCD library, screen updates are decoupled from the graphics routines.)&lt;br /&gt;
&lt;br /&gt;
Also available is M2tklib (https://code.google.com/p/m2tklib/) which is a nice toolkit library.  Further details on using this will come later, but expect the main loop to be handled for you, and just passing the menu structure you require for your app.&lt;br /&gt;
&lt;br /&gt;
Right now, you can call the GLCD functions directly with GLCD.DrawBitmap() for example.  This is going to change to be accessed through the GUITask class in the near future, to ensure only one task at a time writes to the screen.  Expect this to be simply GUITask in place of GLCD, along with a registering a redraw call back to GUITask.&lt;br /&gt;
&lt;br /&gt;
Extra features that are included, GLCD.SetRotation() will handle rotation of the screen for you, and GLCD.CurrentWidth() and GLCD.CurrentHeight will give you the correct Width and Height for the current orientation.  GLCD.Width and GLCD.Height constants are not available, and the GLCD predefined Text areas will not be rotated for you, if you require this define your own text areas.&lt;br /&gt;
&lt;br /&gt;
== Sound == &lt;br /&gt;
There's a piezo on the board, but we haven't added code for it to the current firmware. Pull requests are very welcome!&lt;br /&gt;
&lt;br /&gt;
== IMU ==&lt;br /&gt;
=== Tilda::getOrientation ===&lt;br /&gt;
returns &amp;quot; ORIENTATION_HELD&amp;quot;, &amp;quot;ORIENTATION_RIGHT&amp;quot; (joystick to the right of the screen), &amp;quot;ORIENTATION_HUNG&amp;quot; or &amp;quot;ORIENTATION_LEFT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Flash Storage ==&lt;br /&gt;
We have 2mb of flash storage, but we're not using it in the main firmware - Please get this working!&lt;br /&gt;
== Data: Schedule ==&lt;br /&gt;
===Tilda::getDataStore().getSchedule(day, location) ===&lt;br /&gt;
== Date: Weather Forecast ==&lt;br /&gt;
===Tilda::getDataStore().getWeatherForecast()===&lt;br /&gt;
== Radio ==&lt;br /&gt;
There's no way of sending messages in the current version of the firmware, sorry :(&lt;br /&gt;
&lt;br /&gt;
== Time ==&lt;br /&gt;
&lt;br /&gt;
=== Tilda::delay(uint16_t delayInMs) === &lt;br /&gt;
&lt;br /&gt;
Works like Arduino’s delay(), but is FreeRTOS-safe. It’s safe to use this function before FreeRTOS has started.&lt;br /&gt;
&lt;br /&gt;
=== tilda::getClock() ===&lt;br /&gt;
&lt;br /&gt;
Returns an instance of https://github.com/MarkusLange/Arduino-Due-RTC-Library/blob/master/rtc_clock.h&lt;br /&gt;
&lt;br /&gt;
==Settings==&lt;br /&gt;
===uint16_t tilda::getBadgeId()===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==2.12. Battery==&lt;br /&gt;
===float TiLDA::getBatteryVoltage()===&lt;br /&gt;
Returns the current voltage as a float&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getBatteryPercent()===&lt;br /&gt;
Returns the current voltage as a percentage&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getChargeState()===&lt;br /&gt;
Returns the charge state&lt;br /&gt;
&lt;br /&gt;
0 Charging&lt;br /&gt;
1 Not Charging&lt;br /&gt;
&lt;br /&gt;
=Hacking=&lt;br /&gt;
To use our board definition you will need to first get the Arduino 1.5.7 IDE from [http://arduino.cc/en/Main/Software#toc3 here]&amp;lt;br/&amp;gt;&lt;br /&gt;
Next you can download the TiLDA MKe Firmware project from either the [https://github.com/emfcamp/Mk2-Firmware github repo] or via [https://github.com/emfcamp/Mk2-Firmware/archive/master.zip direct download]&amp;lt;br/&amp;gt;&lt;br /&gt;
Now copy the &amp;quot;hardware&amp;quot; folder to your Sketchbook folder, this is usually ~/Sketchbook/&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br/&amp;gt;&lt;br /&gt;
Alternative option is to set the Arduino 1.5.7 sketchbook folder to the Mk2-Firmware directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start the Arduino IDE and your will be able to select TiLDA MKe v0.333 for the Tools-&amp;gt;Board menu&lt;br /&gt;
&lt;br /&gt;
Draft 3d print-able and laser-able case files [http://www.thingiverse.com/thing:436815 here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=github&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Source =&lt;br /&gt;
&lt;br /&gt;
All the source code and designs are on openly available on Github:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Hardware Hardware] - the full board design&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Documentation Documentation] - a dump of relevant parts datasheets&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Firmware Firmware] - source code for the badge software&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Software Software] - server-side software for the network&lt;br /&gt;
&lt;br /&gt;
[[Category: Badges]]&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3400</id>
		<title>TiLDA MKe</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3400"/>
		<updated>2014-09-01T18:33:44Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA MKe project, Code name &amp;quot;ElectroMagnetic Boogaloo&amp;quot;, is being headed by [[User:Dpslwk|'RepRap' Matt]] and [[User:thinkl33t|Bob]]&lt;br /&gt;
[[File:Badge_Front.png|right|thumb|Front]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/E_(mathematical_constant) Why MKe?]&lt;br /&gt;
&lt;br /&gt;
=Aim= &lt;br /&gt;
The main aim of the 2014 badge is to give camp attendees live schedule updates and notifications. As with the original TiLDA we wanted to keep with an Arduino compatible platform that will allow badge hacking during and after the camp. As with previous badge all code and design files are available.&lt;br /&gt;
&lt;br /&gt;
==Features and Functions==&lt;br /&gt;
[[File:Badge_Back.png|right|thumb|Back]]&lt;br /&gt;
* Torch mode - Press the light button next to the screen. It will only light up fully if it's hung upside down to avoid blinding&lt;br /&gt;
* Snake&lt;br /&gt;
* Tetris&lt;br /&gt;
* Weather Forecast&lt;br /&gt;
* Schedule&lt;br /&gt;
* Can receive notifications about upcoming schedule items you're interested in. Visit schedule.emf.camp to set up your account.&lt;br /&gt;
&lt;br /&gt;
'''Please note that there's a known issue with the badge freezing'''. We're trying to work out what's causing this, but in the meantime pressing &amp;quot;reset&amp;quot; should get the badge back to life. Help with debugging is highly welcome!&lt;br /&gt;
&lt;br /&gt;
== How to get going ==&lt;br /&gt;
=== Set up your environment ===&lt;br /&gt;
* Plug your badge into your computer via USB&lt;br /&gt;
* Download Arduino IDE 1.5.7 from http://arduino.cc/en/main/software#toc3&lt;br /&gt;
* “git clone” or download TiLDA source code from https://github.com/emfcamp/Mk2-Firmware&lt;br /&gt;
* Start the Arduino IDE. &lt;br /&gt;
* Now you have to change the sketchbook-folder to be the folder you just cloned. To do this use File | Preferences | “Set Sketchbook location”. On MacOS, this is Arduino | Preferences &lt;br /&gt;
* Restart the Arduino IDE&lt;br /&gt;
* Open sketch “EMF2014”&lt;br /&gt;
* Set Tools | Board to MKe v0.333 (RTOS Core)&lt;br /&gt;
* Set Tools | Port to correct port (you might have to research this - some operating systems like Windows require you to install drivers or become member of a certain group)&lt;br /&gt;
** On Macos this is will start /dev/tty.usbmodem with 4 digits, and change for each port&lt;br /&gt;
** On Linux this is usually /dev/ttyACM0 but may be a higher number if you have other USB Serial devices&lt;br /&gt;
* Hit the upload button&lt;br /&gt;
* Wait&lt;br /&gt;
* Woohoo - You just successfully uploaded code to your badge&lt;br /&gt;
&lt;br /&gt;
=== Your first “Hello world” App ===&lt;br /&gt;
There’s a “HelloWorldApp.cpp” file in which you can play around. In order for it to show up on the Homescreen you have to uncomment line 51 in AppManager.cpp and flash the changed code to the badge. Great app pull requests are appreciated!&lt;br /&gt;
&lt;br /&gt;
=== Why are things so different from standard arduino code? ===&lt;br /&gt;
We’re using a library called FreeRTOS that allows us to multitask - something that’s normally not possible with standard arduino code. This allows us to run multiple tasks at the same time. FreeRTOS uses preemptive scheduling to switch between the task. Due to this we have to be very careful about how we do some things. For example we can’t just define interrupts for buttons in every task (imagine the mess!) or write to the serial port directly (your task might stop in the middle of the message). &lt;br /&gt;
&lt;br /&gt;
We’ve also spend quite a lot of time to make the build-in components as easy to use as possible without having every task to write lots of boilerplate code. If you feel like using the build-in components on the badge, chances are we already wrote a wrapper for them that is already used by one of the other tasks. &lt;br /&gt;
&lt;br /&gt;
Have a look at the “Documentation” section in this document for a full list of API functions. You will avoid a lot of headache if you stick to those.&lt;br /&gt;
=== How to use the badge with pure Arduino code ===&lt;br /&gt;
If you prefer you can always start from scratch without FreeRTOS or any of our code, just keep in mind that you won’t be able to receive messages via radio or use any of the API features we already added. Just start a new sketch in the Arduino IDE for that and get going. If you want to load the main firmware again just change the sketch to “EMF2014” and upload again.&lt;br /&gt;
=== Debugging and Gotchas ===&lt;br /&gt;
* The USB serial is set up to 115220 baud. There are lots of terminals that can connect to them&lt;br /&gt;
* If you can’t revive a badge you can short the two erase pins and press the reset button while holding it down.&lt;br /&gt;
* Avoid busy waiting, use FreeRTOS queues and Tilda::delay() instead&lt;br /&gt;
* Don’t use low level functions like interrupts or serial ports directly unless you really, really know how FreeRTOS will handle them. For general logging you can use Tilda::log()&lt;br /&gt;
=== Code structure ===&lt;br /&gt;
* FreeRTOS has the concept of “Tasks” which work like threads. We’ve wrappered them in a class called “Task” (for background stuff) and “Apps” (for foreground, one-at-a-time things)&lt;br /&gt;
* Everything needs to be in the main EMF2014 folder. Subfolders are not allowed. This is an Arduino IDE restriction :(&lt;br /&gt;
=== Radio infrastructure ===&lt;br /&gt;
The radio infrastructure is distributed between DKs. Every “gateway” has a raspberry pi with two ciseco usb radios. We never had the change to actually try it with that many badges in the same spot, so please don’t expect it to work perfectly.&lt;br /&gt;
=== Contribute ===&lt;br /&gt;
Send us pull request via github - We’ll do our best to review and merge the good ones during EMF so others can use them.&lt;br /&gt;
&lt;br /&gt;
=Hardware=&lt;br /&gt;
&lt;br /&gt;
The following hardware has been included on the badge.&lt;br /&gt;
&lt;br /&gt;
* [http://www.atmel.com/products/microcontrollers/arm/sam3x.aspx Atmel ATSAM3X8E]&lt;br /&gt;
** This is the same chip as the [http://arduino.cc/en/Main/ArduinoBoardDue Arduino Due] and gives us the base platform for the badge&lt;br /&gt;
** 32bit ARM Cortex M3 * 84MHz&lt;br /&gt;
** 512KBytes Flash RAM&lt;br /&gt;
** 96KBytes of SRAM&lt;br /&gt;
* A 128x64 pixel monochrome LCD display&lt;br /&gt;
* [http://shop.ciseco.co.uk/srf-wireless-rf-radio-surface-mount/ Ciseco SRF Radio]&lt;br /&gt;
** 868Mhz RF Transceiver&lt;br /&gt;
** Simple UART interface&lt;br /&gt;
** Low power sleep mode&lt;br /&gt;
* [http://www.invensense.com/mems/gyro/mpu6050.html MPU-6050] 3-axis Accelerometer and 3-axis gyro&lt;br /&gt;
** I2C interface&lt;br /&gt;
** Tri-Axis angular rate sensor (gyro) with a sensitivity up to 131 LSBs/dps and a full-scale range of ±250, ±500, ±1000, and ±2000dps&lt;br /&gt;
** Tri-Axis accelerometer with a programmable full scale range of ±2g, ±4g, ±8g and ±16g&lt;br /&gt;
** Digital Motion Processing™ (DMP™) engine offloads complex MotionFusion, sensor timing synchronization and gesture detection&lt;br /&gt;
* PMIC &amp;amp; LiPo&lt;br /&gt;
* Joystick&lt;br /&gt;
* Buttons&lt;br /&gt;
* RGB LED's&lt;br /&gt;
* IR&lt;br /&gt;
* Arduino Headers&lt;br /&gt;
* Pads for wearable tech&lt;br /&gt;
&lt;br /&gt;
= Firmware Documentation =&lt;br /&gt;
== Debugging ==&lt;br /&gt;
===Tilda::log(String text)===&lt;br /&gt;
&lt;br /&gt;
This logs “text” to the serial console. To read it connect to it via the Arduino IDE Serial Monitor. Don’t use “SerialUSB.println” or similar -- it’s not thread-safe and you might end up with utter nonsense.&lt;br /&gt;
== Buttons ==&lt;br /&gt;
The badge has 8 buttons: Up, Down, Left, Right, Center (on the joystick), A, B and Light. You can use arduino-style “digitalRead(BUTTON_RIGHT)” to read the current status of any button, but you can’t define your own interrupt (because we already did that). This doesn’t mean you can’t wait for a certain button to be pressed, it just means you have to approach it slightly differently:&lt;br /&gt;
&lt;br /&gt;
Example: A simple app displaying the button code&lt;br /&gt;
 void ButtonApp::task() {&lt;br /&gt;
     ButtonSubscription allButtons = Tilda::createButtonSubscription(LIGHT | A | B | UP | DOWN | LEFT | RIGHT | CENTER);&lt;br /&gt;
 &lt;br /&gt;
     while(true) {&lt;br /&gt;
         Button button = allButtons.waitForPress(1000);&lt;br /&gt;
         if (button == A) {&lt;br /&gt;
             debug::log(“You pressed button A”);&lt;br /&gt;
         } else if (button == LEFT) {&lt;br /&gt;
             debug::log(“You pressed LEFT”);&lt;br /&gt;
         } else if (button == NONE) {&lt;br /&gt;
             debug::log(“No button has been pressed in 1000ms”); &lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription Tilda::createButtonSubscription(&amp;lt;buttons&amp;gt;)===&lt;br /&gt;
&lt;br /&gt;
Registers a subscriptions for a defined set of buttons and returns a ButtonSubscription. Multiple Buttons can be combined via “|” (see example above). One button can not be subscribed by more than 10 subscriptions (which shouldn’t really happen, but keep it in mind). &lt;br /&gt;
&lt;br /&gt;
Don’t use this function in a constructor, it requires FreeRTOS to be running. Using it inside the task() function is the only safe place for it.&lt;br /&gt;
&lt;br /&gt;
===Button ButtonSubscription::waitForPress(TimeInTicks timeout)===&lt;br /&gt;
&lt;br /&gt;
This is normally called in a loop. It causes the task to block until one of the buttons has been pressed. If the timeout occurs before any button has been pressed “NONE” will be returned. &lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::waitForPress()===&lt;br /&gt;
&lt;br /&gt;
The same as above, but without the timeout.&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::clear()===&lt;br /&gt;
&lt;br /&gt;
This should be called after an App has been suspended, just before it’s going to be resumed. It causes the Queue to be cleared which could otherwise lead to buttons being reported that have been pressed while other apps were in the foreground. Have a look at the FlashLightApp for an example.&lt;br /&gt;
&lt;br /&gt;
==LEDs==&lt;br /&gt;
===Tilda::setLedColor(Led led, Color color);===&lt;br /&gt;
===Tilde::setLedColor(Color color);===&lt;br /&gt;
&lt;br /&gt;
Sets the color of all or one led. Color is an object that takes red, green and blue as a value between 0 and 255 each. If no led is defined both leds will be set to the same color.&lt;br /&gt;
&lt;br /&gt;
Example: A simple color-changing task&lt;br /&gt;
 void ColorfulTask::task() {&lt;br /&gt;
     while(true) {&lt;br /&gt;
         Tilda::setLedColor(LED1, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::setLedColor(LED2, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Display==&lt;br /&gt;
&lt;br /&gt;
The Display Library is based on GLCDv3 (http://playground.arduino.cc/Code/GLCDks0108) but adapted to support our screen.  The Init routine is called in the setup, and the LCDTask takes care of ensuring the screen is updated every 40ms if required (Unlike the original GLCD library, screen updates are decoupled from the graphics routines.)&lt;br /&gt;
&lt;br /&gt;
Also available is M2tklib (https://code.google.com/p/m2tklib/) which is a nice toolkit library.  Further details on using this will come later, but expect the main loop to be handled for you, and just passing the menu structure you require for your app.&lt;br /&gt;
&lt;br /&gt;
Right now, you can call the GLCD functions directly with GLCD.DrawBitmap() for example.  This is going to change to be accessed through the GUITask class in the near future, to ensure only one task at a time writes to the screen.  Expect this to be simply GUITask in place of GLCD, along with a registering a redraw call back to GUITask.&lt;br /&gt;
&lt;br /&gt;
Extra features that are included, GLCD.SetRotation() will handle rotation of the screen for you, and GLCD.CurrentWidth() and GLCD.CurrentHeight will give you the correct Width and Height for the current orientation.  GLCD.Width and GLCD.Height constants are not available, and the GLCD predefined Text areas will not be rotated for you, if you require this define your own text areas.&lt;br /&gt;
&lt;br /&gt;
== Sound == &lt;br /&gt;
There's a piezo on the board, but we haven't added code for it to the current firmware. Pull requests are very welcome!&lt;br /&gt;
&lt;br /&gt;
== IMU ==&lt;br /&gt;
=== Tilda::getOrientation ===&lt;br /&gt;
returns &amp;quot; ORIENTATION_HELD&amp;quot;, &amp;quot;ORIENTATION_RIGHT&amp;quot; (joystick to the right of the screen), &amp;quot;ORIENTATION_HUNG&amp;quot; or &amp;quot;ORIENTATION_LEFT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Flash Storage ==&lt;br /&gt;
We have 2mb of flash storage, but we're not using it in the main firmware - Please get this working!&lt;br /&gt;
== Data: Schedule ==&lt;br /&gt;
===Tilda::getDataStore().getSchedule(day, location) ===&lt;br /&gt;
== Date: Weather Forecast ==&lt;br /&gt;
===Tilda::getDataStore().getWeatherForecast()===&lt;br /&gt;
== Radio ==&lt;br /&gt;
There's no way of sending messages in the current version of the firmware, sorry :(&lt;br /&gt;
&lt;br /&gt;
== Time ==&lt;br /&gt;
&lt;br /&gt;
=== Tilda::delay(uint16_t delayInMs) === &lt;br /&gt;
&lt;br /&gt;
Works like Arduino’s delay(), but is FreeRTOS-safe. It’s safe to use this function before FreeRTOS has started.&lt;br /&gt;
&lt;br /&gt;
=== tilda::getClock() ===&lt;br /&gt;
&lt;br /&gt;
Returns an instance of https://github.com/MarkusLange/Arduino-Due-RTC-Library/blob/master/rtc_clock.h&lt;br /&gt;
&lt;br /&gt;
==Settings==&lt;br /&gt;
===uint16_t tilda::getBadgeId()===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==2.12. Battery==&lt;br /&gt;
===float TiLDA::getBatteryVoltage()===&lt;br /&gt;
Returns the current voltage as a float&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getBatteryPercent()===&lt;br /&gt;
Returns the current voltage as a percentage&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getChargeState()===&lt;br /&gt;
Returns the charge state&lt;br /&gt;
&lt;br /&gt;
0 Charging&lt;br /&gt;
1 Not Charging&lt;br /&gt;
&lt;br /&gt;
=Hacking=&lt;br /&gt;
To use our board definition you will need to first get the Arduino 1.5.7 IDE from [http://arduino.cc/en/Main/Software#toc3 here]&amp;lt;br/&amp;gt;&lt;br /&gt;
Next you can download the TiLDA MKe Firmware project from either the [https://github.com/emfcamp/Mk2-Firmware github repo] or via [https://github.com/emfcamp/Mk2-Firmware/archive/master.zip direct download]&amp;lt;br/&amp;gt;&lt;br /&gt;
Now copy the &amp;quot;hardware&amp;quot; folder to your Sketchbook folder, this is usually ~/Sketchbook/&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br/&amp;gt;&lt;br /&gt;
Alternative option is to set the Arduino 1.5.7 sketchbook folder to the Mk2-Firmware directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start the Arduino IDE and your will be able to select TiLDA MKe v0.333 for the Tools-&amp;gt;Board menu&lt;br /&gt;
&lt;br /&gt;
Draft 3d print-able and laser-able case files [http://www.thingiverse.com/thing:436815 here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=github&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Source =&lt;br /&gt;
&lt;br /&gt;
All the source code and designs are on openly available on Github:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Hardware Hardware] - the full board design&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Documentation Documentation] - a dump of relevant parts datasheets&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Firmware Firmware] - source code for the badge software&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Software Software] - server-side software for the network&lt;br /&gt;
&lt;br /&gt;
[[Category: Badges]]&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3339</id>
		<title>TiLDA MKe</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3339"/>
		<updated>2014-08-30T13:44:03Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: /* Radio */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA MKe project, Code name &amp;quot;ElectroMagnetic Boogaloo&amp;quot;, is being headed by [[User:Dpslwk|'RepRap' Matt]] and [[User:thinkl33t|Bob]]&lt;br /&gt;
[[File:Badge_Front.png|right|thumb|Front]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/E_(mathematical_constant) Why MKe?]&lt;br /&gt;
&lt;br /&gt;
=Aim= &lt;br /&gt;
The main aim of the 2014 badge is to give camp attendees live schedule updates and notifications. As with the original TiLDA we wanted to keep with an Arduino compatible platform that will allow badge hacking during and after the camp. As with previous badge all code and design files are available.&lt;br /&gt;
&lt;br /&gt;
==Features and Functions==&lt;br /&gt;
[[File:Badge_Back.png|right|thumb|Back]]&lt;br /&gt;
* Torch mode - Press the light button next to the screen. It will only light up fully if it's hung upside down to avoid blinding&lt;br /&gt;
* Snake&lt;br /&gt;
* Tetris&lt;br /&gt;
* Weather Forecast&lt;br /&gt;
* Schedule&lt;br /&gt;
* Can receive notifications about upcoming schedule items you're interested in. Visit schedule.emf.camp to set up your account.&lt;br /&gt;
&lt;br /&gt;
'''Please note that there's a known issue with the badge freezing'''. We're trying to work out what's causing this, but in the meantime pressing &amp;quot;reset&amp;quot; should get the badge back to life. Help with debugging is highly welcome!&lt;br /&gt;
&lt;br /&gt;
== How to get going ==&lt;br /&gt;
=== Set up your environment ===&lt;br /&gt;
* Plug your badge into your computer via USB&lt;br /&gt;
* Download Arduino IDE 1.5.7 from http://arduino.cc/en/main/software#toc3&lt;br /&gt;
* “git clone” or download TiLDA source code from https://github.com/emfcamp/Mk2-Firmware&lt;br /&gt;
* Start the Arduino IDE. &lt;br /&gt;
* Now you have to change the sketchbook-folder to be the folder you just cloned. To do this use File | Preferences | “Set Sketchbook location”. On MacOS, this is Arduino | Preferences &lt;br /&gt;
* Restart the Arduino IDE&lt;br /&gt;
* Open sketch “EMF2014”&lt;br /&gt;
* Set Tools | Board to MKe v0.333 (RTOS Core)&lt;br /&gt;
* Set Tools | Port to correct port (you might have to research this - some operating systems like Windows require you to install drivers or become member of a certain group)&lt;br /&gt;
** On Macos this is will start /dev/tty.usbmodem with 4 digits, and change for each port&lt;br /&gt;
** On Linux this is usually /dev/ttyACM0 but may be a higher number if you have other USB Serial devices&lt;br /&gt;
* Hit the upload button&lt;br /&gt;
* Wait&lt;br /&gt;
* Woho - You just successfully uploaded code to your badge&lt;br /&gt;
* For now, the code waits for a key on the usbserial debug before doing anything, open the serial monitor in Arduino, set the line endings to ‘Newline’ and press enter.&lt;br /&gt;
&lt;br /&gt;
=== Your first “Hello world” App ===&lt;br /&gt;
There’s a “HelloWorldApp.cpp” file in which you can play around. In order for it to show up on the Homescreen you have to uncomment line 51 in AppManager.cpp and flash the changed code to the badge. Great app pull requests are appreciated!&lt;br /&gt;
&lt;br /&gt;
=== Why are things so different from standard arduino code? ===&lt;br /&gt;
We’re using a library called FreeRTOS that allows us to multitask - something that’s normally not possible with standard arduino code. This allows us to run multiple tasks at the same time. FreeRTOS uses preemptive scheduling to switch between the task. Due to this we have to be very careful about how we do some things. For example we can’t just define interrupts for buttons in every task (imagine the mess!) or write to the serial port directly (your task might stop in the middle of the message). &lt;br /&gt;
&lt;br /&gt;
We’ve also spend quite a lot of time to make the build-in components as easy to use as possible without having every task to write lots of boilerplate code. If you feel like using the build-in components on the badge, chances are we already wrote a wrapper for them that is already used by one of the other tasks. &lt;br /&gt;
&lt;br /&gt;
Have a look at the “Documentation” section in this document for a full list of API functions. You will avoid a lot of headache if you stick to those.&lt;br /&gt;
=== How to use the badge with pure Arduino code ===&lt;br /&gt;
If you prefer you can always start from scratch without FreeRTOS or any of our code, just keep in mind that you won’t be able to receive messages via radio or use any of the API features we already added. Just start a new sketch in the Arduino IDE for that and get going. If you want to load the main firmware again just change the sketch to “EMF2014” and upload again.&lt;br /&gt;
=== Debugging and Gotchas ===&lt;br /&gt;
* The USB serial is set up to 11220 baud. There are lots of terminals that can connect to them&lt;br /&gt;
* If you can’t revive a badge you can short the two erase pins and press the reset button while holding it down.&lt;br /&gt;
* Avoid busy waiting, use FreeRTOS queues and Tilda::delay() instead&lt;br /&gt;
* Don’t use low level functions like interrupts or serial ports directly unless you really, really know how FreeRTOS will handle them. For general logging you can use Tilda::log()&lt;br /&gt;
=== Code structure ===&lt;br /&gt;
* FreeRTOS has the concept of “Tasks” which work like threads. We’ve wrappered them in a class called “Task” (for background stuff) and “Apps” (for foreground, one-at-a-time things)&lt;br /&gt;
* Everything needs to be in the main EMF2014 folder. Subfolders are not allowed. This is an Arduino IDE restriction :(&lt;br /&gt;
=== Radio infrastructure ===&lt;br /&gt;
The radio infrastructure is distributed between DKs. Every “gateway” has a raspberry pi with two ciseco usb radios. We never had the change to actually try it with that many badges in the same spot, so please don’t expect it to work perfectly.&lt;br /&gt;
=== Contribute ===&lt;br /&gt;
Send us pull request via github - We’ll do our best to review and merge the good ones during EMF so others can use them.&lt;br /&gt;
&lt;br /&gt;
=Hardware=&lt;br /&gt;
&lt;br /&gt;
The following hardware has been included on the badge.&lt;br /&gt;
&lt;br /&gt;
* [http://www.atmel.com/products/microcontrollers/arm/sam3x.aspx Atmel ATSAM3X8E]&lt;br /&gt;
** This is the same chip as the [http://arduino.cc/en/Main/ArduinoBoardDue Arduino Due] and gives us the base platform for the badge&lt;br /&gt;
** 32bit ARM Cortex M3 * 84MHz&lt;br /&gt;
** 512KBytes Flash RAM&lt;br /&gt;
** 96KBytes of SRAM&lt;br /&gt;
* A 128x64 pixel monochrome LCD display&lt;br /&gt;
* [http://shop.ciseco.co.uk/srf-wireless-rf-radio-surface-mount/ Ciseco SRF Radio]&lt;br /&gt;
** 868Mhz RF Transceiver&lt;br /&gt;
** Simple UART interface&lt;br /&gt;
** Low power sleep mode&lt;br /&gt;
* [http://www.invensense.com/mems/gyro/mpu6050.html MPU-6050] 3-axis Accelerometer and 3-axis gyro&lt;br /&gt;
** I2C interface&lt;br /&gt;
** Tri-Axis angular rate sensor (gyro) with a sensitivity up to 131 LSBs/dps and a full-scale range of ±250, ±500, ±1000, and ±2000dps&lt;br /&gt;
** Tri-Axis accelerometer with a programmable full scale range of ±2g, ±4g, ±8g and ±16g&lt;br /&gt;
** Digital Motion Processing™ (DMP™) engine offloads complex MotionFusion, sensor timing synchronization and gesture detection&lt;br /&gt;
* PMIC &amp;amp; LiPo&lt;br /&gt;
* Joystick&lt;br /&gt;
* Buttons&lt;br /&gt;
* RGB LED's&lt;br /&gt;
* IR&lt;br /&gt;
* Arduino Headers&lt;br /&gt;
* Pads for wearable tech&lt;br /&gt;
&lt;br /&gt;
= Firmware Documentation =&lt;br /&gt;
== Debugging ==&lt;br /&gt;
===Tilda::log(String text)===&lt;br /&gt;
&lt;br /&gt;
This logs “text” to the serial console. To read it connect to it via the Arduino IDE Serial Monitor. Don’t use “SerialUSB.println” or similar -- it’s not thread-safe and you might end up with utter nonsense.&lt;br /&gt;
== Buttons ==&lt;br /&gt;
The badge has 8 buttons: Up, Down, Left, Right, Center (on the joystick), A, B and Light. You can use arduino-style “digitalRead(BUTTON_RIGHT)” to read the current status of any button, but you can’t define your own interrupt (because we already did that). This doesn’t mean you can’t wait for a certain button to be pressed, it just means you have to approach it slightly differently:&lt;br /&gt;
&lt;br /&gt;
Example: A simple app displaying the button code&lt;br /&gt;
 void ButtonApp::task() {&lt;br /&gt;
     ButtonSubscription allButtons = Tilda::createButtonSubscription(LIGHT | A | B | UP | DOWN | LEFT | RIGHT | CENTER);&lt;br /&gt;
 &lt;br /&gt;
     while(true) {&lt;br /&gt;
         Button button = allButtons.waitForPress(1000);&lt;br /&gt;
         if (button == A) {&lt;br /&gt;
             debug::log(“You pressed button A”);&lt;br /&gt;
         } else if (button == LEFT) {&lt;br /&gt;
             debug::log(“You pressed LEFT”);&lt;br /&gt;
         } else if (button == NONE) {&lt;br /&gt;
             debug::log(“No button has been pressed in 1000ms”); &lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription Tilda::createButtonSubscription(&amp;lt;buttons&amp;gt;)===&lt;br /&gt;
&lt;br /&gt;
Registers a subscriptions for a defined set of buttons and returns a ButtonSubscription. Multiple Buttons can be combined via “|” (see example above). One button can not be subscribed by more than 10 subscriptions (which shouldn’t really happen, but keep it in mind). &lt;br /&gt;
&lt;br /&gt;
Don’t use this function in a constructor, it requires FreeRTOS to be running. Using it inside the task() function is the only safe place for it.&lt;br /&gt;
&lt;br /&gt;
===Button ButtonSubscription::waitForPress(TimeInTicks timeout)===&lt;br /&gt;
&lt;br /&gt;
This is normally called in a loop. It causes the task to block until one of the buttons has been pressed. If the timeout occurs before any button has been pressed “NONE” will be returned. &lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::waitForPress()===&lt;br /&gt;
&lt;br /&gt;
The same as above, but without the timeout.&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::clear()===&lt;br /&gt;
&lt;br /&gt;
This should be called after an App has been suspended, just before it’s going to be resumed. It causes the Queue to be cleared which could otherwise lead to buttons being reported that have been pressed while other apps were in the foreground. Have a look at the FlashLightApp for an example.&lt;br /&gt;
&lt;br /&gt;
==LEDs==&lt;br /&gt;
===Tilda::setLedColor(Led led, Color color);===&lt;br /&gt;
===Tilde::setLedColor(Color color);===&lt;br /&gt;
&lt;br /&gt;
Sets the color of all or one led. Color is an object that takes red, green and blue as a value between 0 and 255 each. If no led is defined both leds will be set to the same color.&lt;br /&gt;
&lt;br /&gt;
Example: A simple color-changing task&lt;br /&gt;
 void ColorfulTask::task() {&lt;br /&gt;
     while(true) {&lt;br /&gt;
         Tilda::setLedColor(LED1, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::setLedColor(LED2, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Display==&lt;br /&gt;
&lt;br /&gt;
The Display Library is based on GLCDv3 (http://playground.arduino.cc/Code/GLCDks0108) but adapted to support our screen.  The Init routine is called in the setup, and the LCDTask takes care of ensuring the screen is updated every 40ms if required (Unlike the original GLCD library, screen updates are decoupled from the graphics routines.)&lt;br /&gt;
&lt;br /&gt;
Also available is M2tklib (https://code.google.com/p/m2tklib/) which is a nice toolkit library.  Further details on using this will come later, but expect the main loop to be handled for you, and just passing the menu structure you require for your app.&lt;br /&gt;
&lt;br /&gt;
Right now, you can call the GLCD functions directly with GLCD.DrawBitmap() for example.  This is going to change to be accessed through the GUITask class in the near future, to ensure only one task at a time writes to the screen.  Expect this to be simply GUITask in place of GLCD, along with a registering a redraw call back to GUITask.&lt;br /&gt;
&lt;br /&gt;
Extra features that are included, GLCD.SetRotation() will handle rotation of the screen for you, and GLCD.CurrentWidth() and GLCD.CurrentHeight will give you the correct Width and Height for the current orientation.  GLCD.Width and GLCD.Height constants are not available, and the GLCD predefined Text areas will not be rotated for you, if you require this define your own text areas.&lt;br /&gt;
&lt;br /&gt;
== Sound == &lt;br /&gt;
There's a piezo on the board, but we haven't added code for it to the current firmware. Pull requests are very welcome!&lt;br /&gt;
&lt;br /&gt;
== IMU ==&lt;br /&gt;
=== Tilda::getOrientation ===&lt;br /&gt;
returns &amp;quot; ORIENTATION_HELD&amp;quot;, &amp;quot;ORIENTATION_RIGHT&amp;quot; (joystick to the right of the screen), &amp;quot;ORIENTATION_HUNG&amp;quot; or &amp;quot;ORIENTATION_LEFT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Flash Storage ==&lt;br /&gt;
We have 2mb of flash storage, but we're not using it in the main firmware - Please get this working!&lt;br /&gt;
== Data: Schedule ==&lt;br /&gt;
===Tilda::getDataStore().getSchedule(day, location) ===&lt;br /&gt;
== Date: Weather Forecast ==&lt;br /&gt;
===Tilda::getDataStore().getWeatherForecast()===&lt;br /&gt;
== Radio ==&lt;br /&gt;
There's no way of sending messages in the current version of the firmware, sorry :(&lt;br /&gt;
&lt;br /&gt;
== Time ==&lt;br /&gt;
&lt;br /&gt;
=== Tilda::delay(uint16_t delayInMs) === &lt;br /&gt;
&lt;br /&gt;
Works like Arduino’s delay(), but is FreeRTOS-safe. It’s safe to use this function before FreeRTOS has started.&lt;br /&gt;
&lt;br /&gt;
=== tilda::getClock() ===&lt;br /&gt;
&lt;br /&gt;
Returns an instance of https://github.com/MarkusLange/Arduino-Due-RTC-Library/blob/master/rtc_clock.h&lt;br /&gt;
&lt;br /&gt;
==Settings==&lt;br /&gt;
===uint16_t tilda::getBadgeId()===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==2.12. Battery==&lt;br /&gt;
===float TiLDA::getBatteryVoltage()===&lt;br /&gt;
Returns the current voltage as a float&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getBatteryPercent()===&lt;br /&gt;
Returns the current voltage as a percentage&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getChargeState()===&lt;br /&gt;
Returns the charge state&lt;br /&gt;
&lt;br /&gt;
0 Charging&lt;br /&gt;
1 Not Charging&lt;br /&gt;
&lt;br /&gt;
=Hacking=&lt;br /&gt;
To use our board definition you will need to first get the Arduino 1.5.7 IDE from [http://arduino.cc/en/Main/Software#toc3 here]&amp;lt;br/&amp;gt;&lt;br /&gt;
Next you can download the TiLDA MKe Firmware project from either the [https://github.com/emfcamp/Mk2-Firmware github repo] or via [https://github.com/emfcamp/Mk2-Firmware/archive/master.zip direct download]&amp;lt;br/&amp;gt;&lt;br /&gt;
Now copy the &amp;quot;hardware&amp;quot; folder to your Sketchbook folder, this is usually ~/Sketchbook/&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br/&amp;gt;&lt;br /&gt;
Alternative option is to set the Arduino 1.5.7 sketchbook folder to the Mk2-Firmware directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start the Arduino IDE and your will be able to select TiLDA MKe v0.333 for the Tools-&amp;gt;Board menu&lt;br /&gt;
&lt;br /&gt;
Draft 3d print-able and laser-able case files [http://www.thingiverse.com/thing:436815 here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=github&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Source =&lt;br /&gt;
&lt;br /&gt;
All the source code and designs are on openly available on Github:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Hardware Hardware] - the full board design&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Documentation Documentation] - a dump of relevant parts datasheets&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Firmware Firmware] - source code for the badge software&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Software Software] - server-side software for the network&lt;br /&gt;
&lt;br /&gt;
[[Category: Badges]]&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3338</id>
		<title>TiLDA MKe</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3338"/>
		<updated>2014-08-30T13:43:22Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: /* Firmware Documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA MKe project, Code name &amp;quot;ElectroMagnetic Boogaloo&amp;quot;, is being headed by [[User:Dpslwk|'RepRap' Matt]] and [[User:thinkl33t|Bob]]&lt;br /&gt;
[[File:Badge_Front.png|right|thumb|Front]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/E_(mathematical_constant) Why MKe?]&lt;br /&gt;
&lt;br /&gt;
=Aim= &lt;br /&gt;
The main aim of the 2014 badge is to give camp attendees live schedule updates and notifications. As with the original TiLDA we wanted to keep with an Arduino compatible platform that will allow badge hacking during and after the camp. As with previous badge all code and design files are available.&lt;br /&gt;
&lt;br /&gt;
==Features and Functions==&lt;br /&gt;
[[File:Badge_Back.png|right|thumb|Back]]&lt;br /&gt;
* Torch mode - Press the light button next to the screen. It will only light up fully if it's hung upside down to avoid blinding&lt;br /&gt;
* Snake&lt;br /&gt;
* Tetris&lt;br /&gt;
* Weather Forecast&lt;br /&gt;
* Schedule&lt;br /&gt;
* Can receive notifications about upcoming schedule items you're interested in. Visit schedule.emf.camp to set up your account.&lt;br /&gt;
&lt;br /&gt;
'''Please note that there's a known issue with the badge freezing'''. We're trying to work out what's causing this, but in the meantime pressing &amp;quot;reset&amp;quot; should get the badge back to life. Help with debugging is highly welcome!&lt;br /&gt;
&lt;br /&gt;
== How to get going ==&lt;br /&gt;
=== Set up your environment ===&lt;br /&gt;
* Plug your badge into your computer via USB&lt;br /&gt;
* Download Arduino IDE 1.5.7 from http://arduino.cc/en/main/software#toc3&lt;br /&gt;
* “git clone” or download TiLDA source code from https://github.com/emfcamp/Mk2-Firmware&lt;br /&gt;
* Start the Arduino IDE. &lt;br /&gt;
* Now you have to change the sketchbook-folder to be the folder you just cloned. To do this use File | Preferences | “Set Sketchbook location”. On MacOS, this is Arduino | Preferences &lt;br /&gt;
* Restart the Arduino IDE&lt;br /&gt;
* Open sketch “EMF2014”&lt;br /&gt;
* Set Tools | Board to MKe v0.333 (RTOS Core)&lt;br /&gt;
* Set Tools | Port to correct port (you might have to research this - some operating systems like Windows require you to install drivers or become member of a certain group)&lt;br /&gt;
** On Macos this is will start /dev/tty.usbmodem with 4 digits, and change for each port&lt;br /&gt;
** On Linux this is usually /dev/ttyACM0 but may be a higher number if you have other USB Serial devices&lt;br /&gt;
* Hit the upload button&lt;br /&gt;
* Wait&lt;br /&gt;
* Woho - You just successfully uploaded code to your badge&lt;br /&gt;
* For now, the code waits for a key on the usbserial debug before doing anything, open the serial monitor in Arduino, set the line endings to ‘Newline’ and press enter.&lt;br /&gt;
&lt;br /&gt;
=== Your first “Hello world” App ===&lt;br /&gt;
There’s a “HelloWorldApp.cpp” file in which you can play around. In order for it to show up on the Homescreen you have to uncomment line 51 in AppManager.cpp and flash the changed code to the badge. Great app pull requests are appreciated!&lt;br /&gt;
&lt;br /&gt;
=== Why are things so different from standard arduino code? ===&lt;br /&gt;
We’re using a library called FreeRTOS that allows us to multitask - something that’s normally not possible with standard arduino code. This allows us to run multiple tasks at the same time. FreeRTOS uses preemptive scheduling to switch between the task. Due to this we have to be very careful about how we do some things. For example we can’t just define interrupts for buttons in every task (imagine the mess!) or write to the serial port directly (your task might stop in the middle of the message). &lt;br /&gt;
&lt;br /&gt;
We’ve also spend quite a lot of time to make the build-in components as easy to use as possible without having every task to write lots of boilerplate code. If you feel like using the build-in components on the badge, chances are we already wrote a wrapper for them that is already used by one of the other tasks. &lt;br /&gt;
&lt;br /&gt;
Have a look at the “Documentation” section in this document for a full list of API functions. You will avoid a lot of headache if you stick to those.&lt;br /&gt;
=== How to use the badge with pure Arduino code ===&lt;br /&gt;
If you prefer you can always start from scratch without FreeRTOS or any of our code, just keep in mind that you won’t be able to receive messages via radio or use any of the API features we already added. Just start a new sketch in the Arduino IDE for that and get going. If you want to load the main firmware again just change the sketch to “EMF2014” and upload again.&lt;br /&gt;
=== Debugging and Gotchas ===&lt;br /&gt;
* The USB serial is set up to 11220 baud. There are lots of terminals that can connect to them&lt;br /&gt;
* If you can’t revive a badge you can short the two erase pins and press the reset button while holding it down.&lt;br /&gt;
* Avoid busy waiting, use FreeRTOS queues and Tilda::delay() instead&lt;br /&gt;
* Don’t use low level functions like interrupts or serial ports directly unless you really, really know how FreeRTOS will handle them. For general logging you can use Tilda::log()&lt;br /&gt;
=== Code structure ===&lt;br /&gt;
* FreeRTOS has the concept of “Tasks” which work like threads. We’ve wrappered them in a class called “Task” (for background stuff) and “Apps” (for foreground, one-at-a-time things)&lt;br /&gt;
* Everything needs to be in the main EMF2014 folder. Subfolders are not allowed. This is an Arduino IDE restriction :(&lt;br /&gt;
=== Radio infrastructure ===&lt;br /&gt;
The radio infrastructure is distributed between DKs. Every “gateway” has a raspberry pi with two ciseco usb radios. We never had the change to actually try it with that many badges in the same spot, so please don’t expect it to work perfectly.&lt;br /&gt;
=== Contribute ===&lt;br /&gt;
Send us pull request via github - We’ll do our best to review and merge the good ones during EMF so others can use them.&lt;br /&gt;
&lt;br /&gt;
=Hardware=&lt;br /&gt;
&lt;br /&gt;
The following hardware has been included on the badge.&lt;br /&gt;
&lt;br /&gt;
* [http://www.atmel.com/products/microcontrollers/arm/sam3x.aspx Atmel ATSAM3X8E]&lt;br /&gt;
** This is the same chip as the [http://arduino.cc/en/Main/ArduinoBoardDue Arduino Due] and gives us the base platform for the badge&lt;br /&gt;
** 32bit ARM Cortex M3 * 84MHz&lt;br /&gt;
** 512KBytes Flash RAM&lt;br /&gt;
** 96KBytes of SRAM&lt;br /&gt;
* A 128x64 pixel monochrome LCD display&lt;br /&gt;
* [http://shop.ciseco.co.uk/srf-wireless-rf-radio-surface-mount/ Ciseco SRF Radio]&lt;br /&gt;
** 868Mhz RF Transceiver&lt;br /&gt;
** Simple UART interface&lt;br /&gt;
** Low power sleep mode&lt;br /&gt;
* [http://www.invensense.com/mems/gyro/mpu6050.html MPU-6050] 3-axis Accelerometer and 3-axis gyro&lt;br /&gt;
** I2C interface&lt;br /&gt;
** Tri-Axis angular rate sensor (gyro) with a sensitivity up to 131 LSBs/dps and a full-scale range of ±250, ±500, ±1000, and ±2000dps&lt;br /&gt;
** Tri-Axis accelerometer with a programmable full scale range of ±2g, ±4g, ±8g and ±16g&lt;br /&gt;
** Digital Motion Processing™ (DMP™) engine offloads complex MotionFusion, sensor timing synchronization and gesture detection&lt;br /&gt;
* PMIC &amp;amp; LiPo&lt;br /&gt;
* Joystick&lt;br /&gt;
* Buttons&lt;br /&gt;
* RGB LED's&lt;br /&gt;
* IR&lt;br /&gt;
* Arduino Headers&lt;br /&gt;
* Pads for wearable tech&lt;br /&gt;
&lt;br /&gt;
= Firmware Documentation =&lt;br /&gt;
== Debugging ==&lt;br /&gt;
===Tilda::log(String text)===&lt;br /&gt;
&lt;br /&gt;
This logs “text” to the serial console. To read it connect to it via the Arduino IDE Serial Monitor. Don’t use “SerialUSB.println” or similar -- it’s not thread-safe and you might end up with utter nonsense.&lt;br /&gt;
== Buttons ==&lt;br /&gt;
The badge has 8 buttons: Up, Down, Left, Right, Center (on the joystick), A, B and Light. You can use arduino-style “digitalRead(BUTTON_RIGHT)” to read the current status of any button, but you can’t define your own interrupt (because we already did that). This doesn’t mean you can’t wait for a certain button to be pressed, it just means you have to approach it slightly differently:&lt;br /&gt;
&lt;br /&gt;
Example: A simple app displaying the button code&lt;br /&gt;
 void ButtonApp::task() {&lt;br /&gt;
     ButtonSubscription allButtons = Tilda::createButtonSubscription(LIGHT | A | B | UP | DOWN | LEFT | RIGHT | CENTER);&lt;br /&gt;
 &lt;br /&gt;
     while(true) {&lt;br /&gt;
         Button button = allButtons.waitForPress(1000);&lt;br /&gt;
         if (button == A) {&lt;br /&gt;
             debug::log(“You pressed button A”);&lt;br /&gt;
         } else if (button == LEFT) {&lt;br /&gt;
             debug::log(“You pressed LEFT”);&lt;br /&gt;
         } else if (button == NONE) {&lt;br /&gt;
             debug::log(“No button has been pressed in 1000ms”); &lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription Tilda::createButtonSubscription(&amp;lt;buttons&amp;gt;)===&lt;br /&gt;
&lt;br /&gt;
Registers a subscriptions for a defined set of buttons and returns a ButtonSubscription. Multiple Buttons can be combined via “|” (see example above). One button can not be subscribed by more than 10 subscriptions (which shouldn’t really happen, but keep it in mind). &lt;br /&gt;
&lt;br /&gt;
Don’t use this function in a constructor, it requires FreeRTOS to be running. Using it inside the task() function is the only safe place for it.&lt;br /&gt;
&lt;br /&gt;
===Button ButtonSubscription::waitForPress(TimeInTicks timeout)===&lt;br /&gt;
&lt;br /&gt;
This is normally called in a loop. It causes the task to block until one of the buttons has been pressed. If the timeout occurs before any button has been pressed “NONE” will be returned. &lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::waitForPress()===&lt;br /&gt;
&lt;br /&gt;
The same as above, but without the timeout.&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::clear()===&lt;br /&gt;
&lt;br /&gt;
This should be called after an App has been suspended, just before it’s going to be resumed. It causes the Queue to be cleared which could otherwise lead to buttons being reported that have been pressed while other apps were in the foreground. Have a look at the FlashLightApp for an example.&lt;br /&gt;
&lt;br /&gt;
==LEDs==&lt;br /&gt;
===Tilda::setLedColor(Led led, Color color);===&lt;br /&gt;
===Tilde::setLedColor(Color color);===&lt;br /&gt;
&lt;br /&gt;
Sets the color of all or one led. Color is an object that takes red, green and blue as a value between 0 and 255 each. If no led is defined both leds will be set to the same color.&lt;br /&gt;
&lt;br /&gt;
Example: A simple color-changing task&lt;br /&gt;
 void ColorfulTask::task() {&lt;br /&gt;
     while(true) {&lt;br /&gt;
         Tilda::setLedColor(LED1, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::setLedColor(LED2, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Display==&lt;br /&gt;
&lt;br /&gt;
The Display Library is based on GLCDv3 (http://playground.arduino.cc/Code/GLCDks0108) but adapted to support our screen.  The Init routine is called in the setup, and the LCDTask takes care of ensuring the screen is updated every 40ms if required (Unlike the original GLCD library, screen updates are decoupled from the graphics routines.)&lt;br /&gt;
&lt;br /&gt;
Also available is M2tklib (https://code.google.com/p/m2tklib/) which is a nice toolkit library.  Further details on using this will come later, but expect the main loop to be handled for you, and just passing the menu structure you require for your app.&lt;br /&gt;
&lt;br /&gt;
Right now, you can call the GLCD functions directly with GLCD.DrawBitmap() for example.  This is going to change to be accessed through the GUITask class in the near future, to ensure only one task at a time writes to the screen.  Expect this to be simply GUITask in place of GLCD, along with a registering a redraw call back to GUITask.&lt;br /&gt;
&lt;br /&gt;
Extra features that are included, GLCD.SetRotation() will handle rotation of the screen for you, and GLCD.CurrentWidth() and GLCD.CurrentHeight will give you the correct Width and Height for the current orientation.  GLCD.Width and GLCD.Height constants are not available, and the GLCD predefined Text areas will not be rotated for you, if you require this define your own text areas.&lt;br /&gt;
&lt;br /&gt;
== Sound == &lt;br /&gt;
There's a piezo on the board, but we haven't added code for it to the current firmware. Pull requests are very welcome!&lt;br /&gt;
&lt;br /&gt;
== IMU ==&lt;br /&gt;
=== Tilda::getOrientation ===&lt;br /&gt;
returns &amp;quot; ORIENTATION_HELD&amp;quot;, &amp;quot;ORIENTATION_RIGHT&amp;quot; (joystick to the right of the screen), &amp;quot;ORIENTATION_HUNG&amp;quot; or &amp;quot;ORIENTATION_LEFT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Flash Storage ==&lt;br /&gt;
We have 2mb of flash storage, but we're not using it in the main firmware - Please get this working!&lt;br /&gt;
== Data: Schedule ==&lt;br /&gt;
===Tilda::getDataStore().getSchedule(day, location) ===&lt;br /&gt;
== Date: Weather Forecast ==&lt;br /&gt;
===Tilda::getDataStore().getWeatherForecast()===&lt;br /&gt;
== Radio ==&lt;br /&gt;
== Time ==&lt;br /&gt;
&lt;br /&gt;
=== Tilda::delay(uint16_t delayInMs) === &lt;br /&gt;
&lt;br /&gt;
Works like Arduino’s delay(), but is FreeRTOS-safe. It’s safe to use this function before FreeRTOS has started.&lt;br /&gt;
&lt;br /&gt;
=== tilda::getClock() ===&lt;br /&gt;
&lt;br /&gt;
Returns an instance of https://github.com/MarkusLange/Arduino-Due-RTC-Library/blob/master/rtc_clock.h&lt;br /&gt;
&lt;br /&gt;
==Settings==&lt;br /&gt;
===uint16_t tilda::getBadgeId()===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==2.12. Battery==&lt;br /&gt;
===float TiLDA::getBatteryVoltage()===&lt;br /&gt;
Returns the current voltage as a float&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getBatteryPercent()===&lt;br /&gt;
Returns the current voltage as a percentage&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getChargeState()===&lt;br /&gt;
Returns the charge state&lt;br /&gt;
&lt;br /&gt;
0 Charging&lt;br /&gt;
1 Not Charging&lt;br /&gt;
&lt;br /&gt;
=Hacking=&lt;br /&gt;
To use our board definition you will need to first get the Arduino 1.5.7 IDE from [http://arduino.cc/en/Main/Software#toc3 here]&amp;lt;br/&amp;gt;&lt;br /&gt;
Next you can download the TiLDA MKe Firmware project from either the [https://github.com/emfcamp/Mk2-Firmware github repo] or via [https://github.com/emfcamp/Mk2-Firmware/archive/master.zip direct download]&amp;lt;br/&amp;gt;&lt;br /&gt;
Now copy the &amp;quot;hardware&amp;quot; folder to your Sketchbook folder, this is usually ~/Sketchbook/&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br/&amp;gt;&lt;br /&gt;
Alternative option is to set the Arduino 1.5.7 sketchbook folder to the Mk2-Firmware directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start the Arduino IDE and your will be able to select TiLDA MKe v0.333 for the Tools-&amp;gt;Board menu&lt;br /&gt;
&lt;br /&gt;
Draft 3d print-able and laser-able case files [http://www.thingiverse.com/thing:436815 here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=github&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Source =&lt;br /&gt;
&lt;br /&gt;
All the source code and designs are on openly available on Github:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Hardware Hardware] - the full board design&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Documentation Documentation] - a dump of relevant parts datasheets&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Firmware Firmware] - source code for the badge software&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Software Software] - server-side software for the network&lt;br /&gt;
&lt;br /&gt;
[[Category: Badges]]&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3337</id>
		<title>TiLDA MKe</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3337"/>
		<updated>2014-08-30T13:33:05Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: /* Hacking */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA MKe project, Code name &amp;quot;ElectroMagnetic Boogaloo&amp;quot;, is being headed by [[User:Dpslwk|'RepRap' Matt]] and [[User:thinkl33t|Bob]]&lt;br /&gt;
[[File:Badge_Front.png|right|thumb|Front]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/E_(mathematical_constant) Why MKe?]&lt;br /&gt;
&lt;br /&gt;
=Aim= &lt;br /&gt;
The main aim of the 2014 badge is to give camp attendees live schedule updates and notifications. As with the original TiLDA we wanted to keep with an Arduino compatible platform that will allow badge hacking during and after the camp. As with previous badge all code and design files are available.&lt;br /&gt;
&lt;br /&gt;
==Features and Functions==&lt;br /&gt;
[[File:Badge_Back.png|right|thumb|Back]]&lt;br /&gt;
* Torch mode - Press the light button next to the screen. It will only light up fully if it's hung upside down to avoid blinding&lt;br /&gt;
* Snake&lt;br /&gt;
* Tetris&lt;br /&gt;
* Weather Forecast&lt;br /&gt;
* Schedule&lt;br /&gt;
* Can receive notifications about upcoming schedule items you're interested in. Visit schedule.emf.camp to set up your account.&lt;br /&gt;
&lt;br /&gt;
'''Please note that there's a known issue with the badge freezing'''. We're trying to work out what's causing this, but in the meantime pressing &amp;quot;reset&amp;quot; should get the badge back to life. Help with debugging is highly welcome!&lt;br /&gt;
&lt;br /&gt;
== How to get going ==&lt;br /&gt;
=== Set up your environment ===&lt;br /&gt;
* Plug your badge into your computer via USB&lt;br /&gt;
* Download Arduino IDE 1.5.7 from http://arduino.cc/en/main/software#toc3&lt;br /&gt;
* “git clone” or download TiLDA source code from https://github.com/emfcamp/Mk2-Firmware&lt;br /&gt;
* Start the Arduino IDE. &lt;br /&gt;
* Now you have to change the sketchbook-folder to be the folder you just cloned. To do this use File | Preferences | “Set Sketchbook location”. On MacOS, this is Arduino | Preferences &lt;br /&gt;
* Restart the Arduino IDE&lt;br /&gt;
* Open sketch “EMF2014”&lt;br /&gt;
* Set Tools | Board to MKe v0.333 (RTOS Core)&lt;br /&gt;
* Set Tools | Port to correct port (you might have to research this - some operating systems like Windows require you to install drivers or become member of a certain group)&lt;br /&gt;
** On Macos this is will start /dev/tty.usbmodem with 4 digits, and change for each port&lt;br /&gt;
** On Linux this is usually /dev/ttyACM0 but may be a higher number if you have other USB Serial devices&lt;br /&gt;
* Hit the upload button&lt;br /&gt;
* Wait&lt;br /&gt;
* Woho - You just successfully uploaded code to your badge&lt;br /&gt;
* For now, the code waits for a key on the usbserial debug before doing anything, open the serial monitor in Arduino, set the line endings to ‘Newline’ and press enter.&lt;br /&gt;
&lt;br /&gt;
=== Your first “Hello world” App ===&lt;br /&gt;
There’s a “HelloWorldApp.cpp” file in which you can play around. In order for it to show up on the Homescreen you have to uncomment line 51 in AppManager.cpp and flash the changed code to the badge. Great app pull requests are appreciated!&lt;br /&gt;
&lt;br /&gt;
=== Why are things so different from standard arduino code? ===&lt;br /&gt;
We’re using a library called FreeRTOS that allows us to multitask - something that’s normally not possible with standard arduino code. This allows us to run multiple tasks at the same time. FreeRTOS uses preemptive scheduling to switch between the task. Due to this we have to be very careful about how we do some things. For example we can’t just define interrupts for buttons in every task (imagine the mess!) or write to the serial port directly (your task might stop in the middle of the message). &lt;br /&gt;
&lt;br /&gt;
We’ve also spend quite a lot of time to make the build-in components as easy to use as possible without having every task to write lots of boilerplate code. If you feel like using the build-in components on the badge, chances are we already wrote a wrapper for them that is already used by one of the other tasks. &lt;br /&gt;
&lt;br /&gt;
Have a look at the “Documentation” section in this document for a full list of API functions. You will avoid a lot of headache if you stick to those.&lt;br /&gt;
=== How to use the badge with pure Arduino code ===&lt;br /&gt;
If you prefer you can always start from scratch without FreeRTOS or any of our code, just keep in mind that you won’t be able to receive messages via radio or use any of the API features we already added. Just start a new sketch in the Arduino IDE for that and get going. If you want to load the main firmware again just change the sketch to “EMF2014” and upload again.&lt;br /&gt;
=== Debugging and Gotchas ===&lt;br /&gt;
* The USB serial is set up to 11220 baud. There are lots of terminals that can connect to them&lt;br /&gt;
* If you can’t revive a badge you can short the two erase pins and press the reset button while holding it down.&lt;br /&gt;
* Avoid busy waiting, use FreeRTOS queues and Tilda::delay() instead&lt;br /&gt;
* Don’t use low level functions like interrupts or serial ports directly unless you really, really know how FreeRTOS will handle them. For general logging you can use Tilda::log()&lt;br /&gt;
=== Code structure ===&lt;br /&gt;
* FreeRTOS has the concept of “Tasks” which work like threads. We’ve wrappered them in a class called “Task” (for background stuff) and “Apps” (for foreground, one-at-a-time things)&lt;br /&gt;
* Everything needs to be in the main EMF2014 folder. Subfolders are not allowed. This is an Arduino IDE restriction :(&lt;br /&gt;
=== Radio infrastructure ===&lt;br /&gt;
The radio infrastructure is distributed between DKs. Every “gateway” has a raspberry pi with two ciseco usb radios. We never had the change to actually try it with that many badges in the same spot, so please don’t expect it to work perfectly.&lt;br /&gt;
=== Contribute ===&lt;br /&gt;
Send us pull request via github - We’ll do our best to review and merge the good ones during EMF so others can use them.&lt;br /&gt;
&lt;br /&gt;
=Hardware=&lt;br /&gt;
&lt;br /&gt;
The following hardware has been included on the badge.&lt;br /&gt;
&lt;br /&gt;
* [http://www.atmel.com/products/microcontrollers/arm/sam3x.aspx Atmel ATSAM3X8E]&lt;br /&gt;
** This is the same chip as the [http://arduino.cc/en/Main/ArduinoBoardDue Arduino Due] and gives us the base platform for the badge&lt;br /&gt;
** 32bit ARM Cortex M3 * 84MHz&lt;br /&gt;
** 512KBytes Flash RAM&lt;br /&gt;
** 96KBytes of SRAM&lt;br /&gt;
* A 128x64 pixel monochrome LCD display&lt;br /&gt;
* [http://shop.ciseco.co.uk/srf-wireless-rf-radio-surface-mount/ Ciseco SRF Radio]&lt;br /&gt;
** 868Mhz RF Transceiver&lt;br /&gt;
** Simple UART interface&lt;br /&gt;
** Low power sleep mode&lt;br /&gt;
* [http://www.invensense.com/mems/gyro/mpu6050.html MPU-6050] 3-axis Accelerometer and 3-axis gyro&lt;br /&gt;
** I2C interface&lt;br /&gt;
** Tri-Axis angular rate sensor (gyro) with a sensitivity up to 131 LSBs/dps and a full-scale range of ±250, ±500, ±1000, and ±2000dps&lt;br /&gt;
** Tri-Axis accelerometer with a programmable full scale range of ±2g, ±4g, ±8g and ±16g&lt;br /&gt;
** Digital Motion Processing™ (DMP™) engine offloads complex MotionFusion, sensor timing synchronization and gesture detection&lt;br /&gt;
* PMIC &amp;amp; LiPo&lt;br /&gt;
* Joystick&lt;br /&gt;
* Buttons&lt;br /&gt;
* RGB LED's&lt;br /&gt;
* IR&lt;br /&gt;
* Arduino Headers&lt;br /&gt;
* Pads for wearable tech&lt;br /&gt;
&lt;br /&gt;
= Firmware Documentation =&lt;br /&gt;
== Debugging ==&lt;br /&gt;
===Tilda::log(String text)===&lt;br /&gt;
&lt;br /&gt;
This logs “text” to the serial console. To read it connect to it via the Arduino IDE Serial Monitor. Don’t use “SerialUSB.println” or similar -- it’s not thread-safe and you might end up with utter nonsense.&lt;br /&gt;
== Buttons ==&lt;br /&gt;
The badge has 8 buttons: Up, Down, Left, Right, Center (on the joystick), A, B and Light. You can use arduino-style “digitalRead(BUTTON_RIGHT)” to read the current status of any button, but you can’t define your own interrupt (because we already did that). This doesn’t mean you can’t wait for a certain button to be pressed, it just means you have to approach it slightly differently:&lt;br /&gt;
&lt;br /&gt;
Example: A simple app displaying the button code&lt;br /&gt;
 void ButtonApp::task() {&lt;br /&gt;
     ButtonSubscription allButtons = Tilda::createButtonSubscription(LIGHT | A | B | UP | DOWN | LEFT | RIGHT | CENTER);&lt;br /&gt;
 &lt;br /&gt;
     while(true) {&lt;br /&gt;
         Button button = allButtons.waitForPress(1000);&lt;br /&gt;
         if (button == A) {&lt;br /&gt;
             debug::log(“You pressed button A”);&lt;br /&gt;
         } else if (button == LEFT) {&lt;br /&gt;
             debug::log(“You pressed LEFT”);&lt;br /&gt;
         } else if (button == NONE) {&lt;br /&gt;
             debug::log(“No button has been pressed in 1000ms”); &lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription Tilda::createButtonSubscription(&amp;lt;buttons&amp;gt;)===&lt;br /&gt;
&lt;br /&gt;
Registers a subscriptions for a defined set of buttons and returns a ButtonSubscription. Multiple Buttons can be combined via “|” (see example above). One button can not be subscribed by more than 10 subscriptions (which shouldn’t really happen, but keep it in mind). &lt;br /&gt;
&lt;br /&gt;
Don’t use this function in a constructor, it requires FreeRTOS to be running. Using it inside the task() function is the only safe place for it.&lt;br /&gt;
&lt;br /&gt;
===Button ButtonSubscription::waitForPress(TimeInTicks timeout)===&lt;br /&gt;
&lt;br /&gt;
This is normally called in a loop. It causes the task to block until one of the buttons has been pressed. If the timeout occurs before any button has been pressed “NONE” will be returned. &lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::waitForPress()===&lt;br /&gt;
&lt;br /&gt;
The same as above, but without the timeout.&lt;br /&gt;
&lt;br /&gt;
===ButtonSubscription::clear()===&lt;br /&gt;
&lt;br /&gt;
This should be called after an App has been suspended, just before it’s going to be resumed. It causes the Queue to be cleared which could otherwise lead to buttons being reported that have been pressed while other apps were in the foreground. Have a look at the FlashLightApp for an example.&lt;br /&gt;
&lt;br /&gt;
==LEDs==&lt;br /&gt;
===Tilda::setLedColor(Led led, Color color);===&lt;br /&gt;
===Tilde::setLedColor(Color color);===&lt;br /&gt;
&lt;br /&gt;
Sets the color of all or one led. Color is an object that takes red, green and blue as a value between 0 and 255 each. If no led is defined both leds will be set to the same color.&lt;br /&gt;
&lt;br /&gt;
Example: A simple color-changing task&lt;br /&gt;
 void ColorfulTask::task() {&lt;br /&gt;
     while(true) {&lt;br /&gt;
         Tilda::setLedColor(LED1, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 255, 0}); // Green&lt;br /&gt;
         Tilda::setLedColor(LED2, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
         Tilda::setLedColor(LED1, {0, 0, 255}); // Blue&lt;br /&gt;
         Tilda::setLedColor(LED2, {255, 0, 0}); // Red&lt;br /&gt;
         Tilda::delay(300);&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Display==&lt;br /&gt;
&lt;br /&gt;
The Display Library is based on GLCDv3 (http://playground.arduino.cc/Code/GLCDks0108) but adapted to support our screen.  The Init routine is called in the setup, and the LCDTask takes care of ensuring the screen is updated every 40ms if required (Unlike the original GLCD library, screen updates are decoupled from the graphics routines.)&lt;br /&gt;
&lt;br /&gt;
Also available is M2tklib (https://code.google.com/p/m2tklib/) which is a nice toolkit library.  Further details on using this will come later, but expect the main loop to be handled for you, and just passing the menu structure you require for your app.&lt;br /&gt;
&lt;br /&gt;
Right now, you can call the GLCD functions directly with GLCD.DrawBitmap() for example.  This is going to change to be accessed through the GUITask class in the near future, to ensure only one task at a time writes to the screen.  Expect this to be simply GUITask in place of GLCD, along with a registering a redraw call back to GUITask.&lt;br /&gt;
&lt;br /&gt;
Extra features that are included, GLCD.SetRotation() will handle rotation of the screen for you, and GLCD.CurrentWidth() and GLCD.CurrentHeight will give you the correct Width and Height for the current orientation.  GLCD.Width and GLCD.Height constants are not available, and the GLCD predefined Text areas will not be rotated for you, if you require this define your own text areas.&lt;br /&gt;
&lt;br /&gt;
== Sound == &lt;br /&gt;
There's a piezo on the board, but we haven't added code for it to the current firmware. Pull requests are very welcome!&lt;br /&gt;
&lt;br /&gt;
== IMU ==&lt;br /&gt;
== Flash Storage ==&lt;br /&gt;
== Data: Schedule ==&lt;br /&gt;
== Date: Weather Forecast ==&lt;br /&gt;
== Radio ==&lt;br /&gt;
== Time ==&lt;br /&gt;
&lt;br /&gt;
=== Tilda::delay(uint16_t delayInMs) === &lt;br /&gt;
&lt;br /&gt;
Works like Arduino’s delay(), but is FreeRTOS-safe. It’s safe to use this function before FreeRTOS has started.&lt;br /&gt;
&lt;br /&gt;
=== tilda::getClock() ===&lt;br /&gt;
&lt;br /&gt;
Returns an instance of https://github.com/MarkusLange/Arduino-Due-RTC-Library/blob/master/rtc_clock.h&lt;br /&gt;
&lt;br /&gt;
==Settings==&lt;br /&gt;
===uint16_t tilda::getBadgeId()===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==2.12. Battery==&lt;br /&gt;
===float TiLDA::getBatteryVoltage()===&lt;br /&gt;
Returns the current voltage as a float&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getBatteryPercent()===&lt;br /&gt;
Returns the current voltage as a percentage&lt;br /&gt;
&lt;br /&gt;
===uint8_t TiLDA::getChargeState()===&lt;br /&gt;
Returns the charge state&lt;br /&gt;
&lt;br /&gt;
0 Charging&lt;br /&gt;
1 Not Charging&lt;br /&gt;
&lt;br /&gt;
== Apps ==&lt;br /&gt;
===Tilda::openApp(String appName)===&lt;br /&gt;
&lt;br /&gt;
Opens an app with the given name. Make sure the name matches exactly the one defined in the task’s “getName()” function. If the app is not the currently-running one then the other one will be suspended first.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Hacking=&lt;br /&gt;
To use our board definition you will need to first get the Arduino 1.5.7 IDE from [http://arduino.cc/en/Main/Software#toc3 here]&amp;lt;br/&amp;gt;&lt;br /&gt;
Next you can download the TiLDA MKe Firmware project from either the [https://github.com/emfcamp/Mk2-Firmware github repo] or via [https://github.com/emfcamp/Mk2-Firmware/archive/master.zip direct download]&amp;lt;br/&amp;gt;&lt;br /&gt;
Now copy the &amp;quot;hardware&amp;quot; folder to your Sketchbook folder, this is usually ~/Sketchbook/&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br/&amp;gt;&lt;br /&gt;
Alternative option is to set the Arduino 1.5.7 sketchbook folder to the Mk2-Firmware directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start the Arduino IDE and your will be able to select TiLDA MKe v0.333 for the Tools-&amp;gt;Board menu&lt;br /&gt;
&lt;br /&gt;
Draft 3d print-able and laser-able case files [http://www.thingiverse.com/thing:436815 here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=github&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Source =&lt;br /&gt;
&lt;br /&gt;
All the source code and designs are on openly available on Github:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Hardware Hardware] - the full board design&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Documentation Documentation] - a dump of relevant parts datasheets&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Firmware Firmware] - source code for the badge software&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Software Software] - server-side software for the network&lt;br /&gt;
&lt;br /&gt;
[[Category: Badges]]&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3336</id>
		<title>TiLDA MKe</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3336"/>
		<updated>2014-08-30T13:26:13Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: /* Set up your environment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA MKe project, Code name &amp;quot;ElectroMagnetic Boogaloo&amp;quot;, is being headed by [[User:Dpslwk|'RepRap' Matt]] and [[User:thinkl33t|Bob]]&lt;br /&gt;
[[File:Badge_Front.png|right|thumb|Front]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/E_(mathematical_constant) Why MKe?]&lt;br /&gt;
&lt;br /&gt;
=Aim= &lt;br /&gt;
The main aim of the 2014 badge is to give camp attendees live schedule updates and notifications. As with the original TiLDA we wanted to keep with an Arduino compatible platform that will allow badge hacking during and after the camp. As with previous badge all code and design files are available.&lt;br /&gt;
&lt;br /&gt;
==Features and Functions==&lt;br /&gt;
[[File:Badge_Back.png|right|thumb|Back]]&lt;br /&gt;
* Torch mode - Press the light button next to the screen. It will only light up fully if it's hung upside down to avoid blinding&lt;br /&gt;
* Snake&lt;br /&gt;
* Tetris&lt;br /&gt;
* Weather Forecast&lt;br /&gt;
* Schedule&lt;br /&gt;
* Can receive notifications about upcoming schedule items you're interested in. Visit schedule.emf.camp to set up your account.&lt;br /&gt;
&lt;br /&gt;
'''Please note that there's a known issue with the badge freezing'''. We're trying to work out what's causing this, but in the meantime pressing &amp;quot;reset&amp;quot; should get the badge back to life. Help with debugging is highly welcome!&lt;br /&gt;
&lt;br /&gt;
== How to get going ==&lt;br /&gt;
=== Set up your environment ===&lt;br /&gt;
* Plug your badge into your computer via USB&lt;br /&gt;
* Download Arduino IDE 1.5.7 from http://arduino.cc/en/main/software#toc3&lt;br /&gt;
* “git clone” or download TiLDA source code from https://github.com/emfcamp/Mk2-Firmware&lt;br /&gt;
* Start the Arduino IDE. &lt;br /&gt;
* Now you have to change the sketchbook-folder to be the folder you just cloned. To do this use File | Preferences | “Set Sketchbook location”. On MacOS, this is Arduino | Preferences &lt;br /&gt;
* Restart the Arduino IDE&lt;br /&gt;
* Open sketch “EMF2014”&lt;br /&gt;
* Set Tools | Board to MKe v0.333 (RTOS Core)&lt;br /&gt;
* Set Tools | Port to correct port (you might have to research this - some operating systems like Windows require you to install drivers or become member of a certain group)&lt;br /&gt;
** On Macos this is will start /dev/tty.usbmodem with 4 digits, and change for each port&lt;br /&gt;
** On Linux this is usually /dev/ttyACM0 but may be a higher number if you have other USB Serial devices&lt;br /&gt;
* Hit the upload button&lt;br /&gt;
* Wait&lt;br /&gt;
* Woho - You just successfully uploaded code to your badge&lt;br /&gt;
* For now, the code waits for a key on the usbserial debug before doing anything, open the serial monitor in Arduino, set the line endings to ‘Newline’ and press enter.&lt;br /&gt;
&lt;br /&gt;
=== Your first “Hello world” App ===&lt;br /&gt;
There’s a “HelloWorldApp.cpp” file in which you can play around. In order for it to show up on the Homescreen you have to uncomment line 51 in AppManager.cpp and flash the changed code to the badge. Great app pull requests are appreciated!&lt;br /&gt;
&lt;br /&gt;
=== Why are things so different from standard arduino code? ===&lt;br /&gt;
We’re using a library called FreeRTOS that allows us to multitask - something that’s normally not possible with standard arduino code. This allows us to run multiple tasks at the same time. FreeRTOS uses preemptive scheduling to switch between the task. Due to this we have to be very careful about how we do some things. For example we can’t just define interrupts for buttons in every task (imagine the mess!) or write to the serial port directly (your task might stop in the middle of the message). &lt;br /&gt;
&lt;br /&gt;
We’ve also spend quite a lot of time to make the build-in components as easy to use as possible without having every task to write lots of boilerplate code. If you feel like using the build-in components on the badge, chances are we already wrote a wrapper for them that is already used by one of the other tasks. &lt;br /&gt;
&lt;br /&gt;
Have a look at the “Documentation” section in this document for a full list of API functions. You will avoid a lot of headache if you stick to those.&lt;br /&gt;
=== How to use the badge with pure Arduino code ===&lt;br /&gt;
If you prefer you can always start from scratch without FreeRTOS or any of our code, just keep in mind that you won’t be able to receive messages via radio or use any of the API features we already added. Just start a new sketch in the Arduino IDE for that and get going. If you want to load the main firmware again just change the sketch to “EMF2014” and upload again.&lt;br /&gt;
=== Debugging and Gotchas ===&lt;br /&gt;
* The USB serial is set up to 11220 baud. There are lots of terminals that can connect to them&lt;br /&gt;
* If you can’t revive a badge you can short the two erase pins and press the reset button while holding it down.&lt;br /&gt;
* Avoid busy waiting, use FreeRTOS queues and Tilda::delay() instead&lt;br /&gt;
* Don’t use low level functions like interrupts or serial ports directly unless you really, really know how FreeRTOS will handle them. For general logging you can use Tilda::log()&lt;br /&gt;
=== Code structure ===&lt;br /&gt;
* FreeRTOS has the concept of “Tasks” which work like threads. We’ve wrappered them in a class called “Task” (for background stuff) and “Apps” (for foreground, one-at-a-time things)&lt;br /&gt;
* Everything needs to be in the main EMF2014 folder. Subfolders are not allowed. This is an Arduino IDE restriction :(&lt;br /&gt;
=== Radio infrastructure ===&lt;br /&gt;
The radio infrastructure is distributed between DKs. Every “gateway” has a raspberry pi with two ciseco usb radios. We never had the change to actually try it with that many badges in the same spot, so please don’t expect it to work perfectly.&lt;br /&gt;
=== Contribute ===&lt;br /&gt;
Send us pull request via github - We’ll do our best to review and merge the good ones during EMF so others can use them.&lt;br /&gt;
&lt;br /&gt;
=Hardware=&lt;br /&gt;
&lt;br /&gt;
The following hardware has been included on the badge.&lt;br /&gt;
&lt;br /&gt;
* [http://www.atmel.com/products/microcontrollers/arm/sam3x.aspx Atmel ATSAM3X8E]&lt;br /&gt;
** This is the same chip as the [http://arduino.cc/en/Main/ArduinoBoardDue Arduino Due] and gives us the base platform for the badge&lt;br /&gt;
** 32bit ARM Cortex M3 * 84MHz&lt;br /&gt;
** 512KBytes Flash RAM&lt;br /&gt;
** 96KBytes of SRAM&lt;br /&gt;
* A 128x64 pixel monochrome LCD display&lt;br /&gt;
* [http://shop.ciseco.co.uk/srf-wireless-rf-radio-surface-mount/ Ciseco SRF Radio]&lt;br /&gt;
** 868Mhz RF Transceiver&lt;br /&gt;
** Simple UART interface&lt;br /&gt;
** Low power sleep mode&lt;br /&gt;
* [http://www.invensense.com/mems/gyro/mpu6050.html MPU-6050] 3-axis Accelerometer and 3-axis gyro&lt;br /&gt;
** I2C interface&lt;br /&gt;
** Tri-Axis angular rate sensor (gyro) with a sensitivity up to 131 LSBs/dps and a full-scale range of ±250, ±500, ±1000, and ±2000dps&lt;br /&gt;
** Tri-Axis accelerometer with a programmable full scale range of ±2g, ±4g, ±8g and ±16g&lt;br /&gt;
** Digital Motion Processing™ (DMP™) engine offloads complex MotionFusion, sensor timing synchronization and gesture detection&lt;br /&gt;
* PMIC &amp;amp; LiPo&lt;br /&gt;
* Joystick&lt;br /&gt;
* Buttons&lt;br /&gt;
* RGB LED's&lt;br /&gt;
* IR&lt;br /&gt;
* Arduino Headers&lt;br /&gt;
* Pads for wearable tech&lt;br /&gt;
&lt;br /&gt;
=Hacking=&lt;br /&gt;
To use our board definition you will need to first get the Arduino 1.5.7 IDE from [http://arduino.cc/en/Main/Software#toc3 here]&amp;lt;br/&amp;gt;&lt;br /&gt;
Next you can download the TiLDA MKe Firmware project from either the [https://github.com/emfcamp/Mk2-Firmware github repo] or via [https://github.com/emfcamp/Mk2-Firmware/archive/master.zip direct download]&amp;lt;br/&amp;gt;&lt;br /&gt;
Now copy the &amp;quot;hardware&amp;quot; folder to your Sketchbook folder, this is usually ~/Sketchbook/&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br/&amp;gt;&lt;br /&gt;
Alternative option is to set the Arduino 1.5.7 sketchbook folder to the Mk2-Firmware directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start the Arduino IDE and your will be able to select TiLDA MKe v0.333 for the Tools-&amp;gt;Board menu&lt;br /&gt;
&lt;br /&gt;
Draft 3d print-able and laser-able case files [http://www.thingiverse.com/thing:436815 here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=github&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Source =&lt;br /&gt;
&lt;br /&gt;
All the source code and designs are on openly available on Github:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Hardware Hardware] - the full board design&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Documentation Documentation] - a dump of relevant parts datasheets&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Firmware Firmware] - source code for the badge software&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Software Software] - server-side software for the network&lt;br /&gt;
&lt;br /&gt;
[[Category: Badges]]&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3335</id>
		<title>TiLDA MKe</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3335"/>
		<updated>2014-08-30T13:25:56Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: /* Features and Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA MKe project, Code name &amp;quot;ElectroMagnetic Boogaloo&amp;quot;, is being headed by [[User:Dpslwk|'RepRap' Matt]] and [[User:thinkl33t|Bob]]&lt;br /&gt;
[[File:Badge_Front.png|right|thumb|Front]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/E_(mathematical_constant) Why MKe?]&lt;br /&gt;
&lt;br /&gt;
=Aim= &lt;br /&gt;
The main aim of the 2014 badge is to give camp attendees live schedule updates and notifications. As with the original TiLDA we wanted to keep with an Arduino compatible platform that will allow badge hacking during and after the camp. As with previous badge all code and design files are available.&lt;br /&gt;
&lt;br /&gt;
==Features and Functions==&lt;br /&gt;
[[File:Badge_Back.png|right|thumb|Back]]&lt;br /&gt;
* Torch mode - Press the light button next to the screen. It will only light up fully if it's hung upside down to avoid blinding&lt;br /&gt;
* Snake&lt;br /&gt;
* Tetris&lt;br /&gt;
* Weather Forecast&lt;br /&gt;
* Schedule&lt;br /&gt;
* Can receive notifications about upcoming schedule items you're interested in. Visit schedule.emf.camp to set up your account.&lt;br /&gt;
&lt;br /&gt;
'''Please note that there's a known issue with the badge freezing'''. We're trying to work out what's causing this, but in the meantime pressing &amp;quot;reset&amp;quot; should get the badge back to life. Help with debugging is highly welcome!&lt;br /&gt;
&lt;br /&gt;
== How to get going ==&lt;br /&gt;
=== Set up your environment ===&lt;br /&gt;
* Plug your badge into your computer via USB&lt;br /&gt;
* Download Arduino IDE 1.5.7 from http://arduino.cc/en/main/software#toc3&lt;br /&gt;
* “git clone” or download TiLDA source code from https://github.com/emfcamp/Mk2-Firmware&lt;br /&gt;
* Start the Arduino IDE. &lt;br /&gt;
* Now you have to change the sketchbook-folder to be the folder you just cloned. To do this use File | Preferences | “Set Sketchbook location”. On MacOS, this is Arduino | Preferences &lt;br /&gt;
* Restart the Arduino IDE&lt;br /&gt;
* Open sketch “EMF2014”&lt;br /&gt;
* Set Tools | Board to MKe v0.333 (RTOS Core)&lt;br /&gt;
* Set Tools | Port to correct port (you might have to research this - some operating systems like Windows require you to install drivers or become member of a certain group)&lt;br /&gt;
  * On Macos this is will start /dev/tty.usbmodem with 4 digits, and change for each port&lt;br /&gt;
  * On Linux this is usually /dev/ttyACM0 but may be a higher number if you have other USB Serial devices&lt;br /&gt;
* Hit the upload button&lt;br /&gt;
* Wait&lt;br /&gt;
* Woho - You just successfully uploaded code to your badge&lt;br /&gt;
* For now, the code waits for a key on the usbserial debug before doing anything, open the serial monitor in Arduino, set the line endings to ‘Newline’ and press enter.&lt;br /&gt;
=== Your first “Hello world” App ===&lt;br /&gt;
There’s a “HelloWorldApp.cpp” file in which you can play around. In order for it to show up on the Homescreen you have to uncomment line 51 in AppManager.cpp and flash the changed code to the badge. Great app pull requests are appreciated!&lt;br /&gt;
&lt;br /&gt;
=== Why are things so different from standard arduino code? ===&lt;br /&gt;
We’re using a library called FreeRTOS that allows us to multitask - something that’s normally not possible with standard arduino code. This allows us to run multiple tasks at the same time. FreeRTOS uses preemptive scheduling to switch between the task. Due to this we have to be very careful about how we do some things. For example we can’t just define interrupts for buttons in every task (imagine the mess!) or write to the serial port directly (your task might stop in the middle of the message). &lt;br /&gt;
&lt;br /&gt;
We’ve also spend quite a lot of time to make the build-in components as easy to use as possible without having every task to write lots of boilerplate code. If you feel like using the build-in components on the badge, chances are we already wrote a wrapper for them that is already used by one of the other tasks. &lt;br /&gt;
&lt;br /&gt;
Have a look at the “Documentation” section in this document for a full list of API functions. You will avoid a lot of headache if you stick to those.&lt;br /&gt;
=== How to use the badge with pure Arduino code ===&lt;br /&gt;
If you prefer you can always start from scratch without FreeRTOS or any of our code, just keep in mind that you won’t be able to receive messages via radio or use any of the API features we already added. Just start a new sketch in the Arduino IDE for that and get going. If you want to load the main firmware again just change the sketch to “EMF2014” and upload again.&lt;br /&gt;
=== Debugging and Gotchas ===&lt;br /&gt;
* The USB serial is set up to 11220 baud. There are lots of terminals that can connect to them&lt;br /&gt;
* If you can’t revive a badge you can short the two erase pins and press the reset button while holding it down.&lt;br /&gt;
* Avoid busy waiting, use FreeRTOS queues and Tilda::delay() instead&lt;br /&gt;
* Don’t use low level functions like interrupts or serial ports directly unless you really, really know how FreeRTOS will handle them. For general logging you can use Tilda::log()&lt;br /&gt;
=== Code structure ===&lt;br /&gt;
* FreeRTOS has the concept of “Tasks” which work like threads. We’ve wrappered them in a class called “Task” (for background stuff) and “Apps” (for foreground, one-at-a-time things)&lt;br /&gt;
* Everything needs to be in the main EMF2014 folder. Subfolders are not allowed. This is an Arduino IDE restriction :(&lt;br /&gt;
=== Radio infrastructure ===&lt;br /&gt;
The radio infrastructure is distributed between DKs. Every “gateway” has a raspberry pi with two ciseco usb radios. We never had the change to actually try it with that many badges in the same spot, so please don’t expect it to work perfectly.&lt;br /&gt;
=== Contribute ===&lt;br /&gt;
Send us pull request via github - We’ll do our best to review and merge the good ones during EMF so others can use them.&lt;br /&gt;
&lt;br /&gt;
=Hardware=&lt;br /&gt;
&lt;br /&gt;
The following hardware has been included on the badge.&lt;br /&gt;
&lt;br /&gt;
* [http://www.atmel.com/products/microcontrollers/arm/sam3x.aspx Atmel ATSAM3X8E]&lt;br /&gt;
** This is the same chip as the [http://arduino.cc/en/Main/ArduinoBoardDue Arduino Due] and gives us the base platform for the badge&lt;br /&gt;
** 32bit ARM Cortex M3 * 84MHz&lt;br /&gt;
** 512KBytes Flash RAM&lt;br /&gt;
** 96KBytes of SRAM&lt;br /&gt;
* A 128x64 pixel monochrome LCD display&lt;br /&gt;
* [http://shop.ciseco.co.uk/srf-wireless-rf-radio-surface-mount/ Ciseco SRF Radio]&lt;br /&gt;
** 868Mhz RF Transceiver&lt;br /&gt;
** Simple UART interface&lt;br /&gt;
** Low power sleep mode&lt;br /&gt;
* [http://www.invensense.com/mems/gyro/mpu6050.html MPU-6050] 3-axis Accelerometer and 3-axis gyro&lt;br /&gt;
** I2C interface&lt;br /&gt;
** Tri-Axis angular rate sensor (gyro) with a sensitivity up to 131 LSBs/dps and a full-scale range of ±250, ±500, ±1000, and ±2000dps&lt;br /&gt;
** Tri-Axis accelerometer with a programmable full scale range of ±2g, ±4g, ±8g and ±16g&lt;br /&gt;
** Digital Motion Processing™ (DMP™) engine offloads complex MotionFusion, sensor timing synchronization and gesture detection&lt;br /&gt;
* PMIC &amp;amp; LiPo&lt;br /&gt;
* Joystick&lt;br /&gt;
* Buttons&lt;br /&gt;
* RGB LED's&lt;br /&gt;
* IR&lt;br /&gt;
* Arduino Headers&lt;br /&gt;
* Pads for wearable tech&lt;br /&gt;
&lt;br /&gt;
=Hacking=&lt;br /&gt;
To use our board definition you will need to first get the Arduino 1.5.7 IDE from [http://arduino.cc/en/Main/Software#toc3 here]&amp;lt;br/&amp;gt;&lt;br /&gt;
Next you can download the TiLDA MKe Firmware project from either the [https://github.com/emfcamp/Mk2-Firmware github repo] or via [https://github.com/emfcamp/Mk2-Firmware/archive/master.zip direct download]&amp;lt;br/&amp;gt;&lt;br /&gt;
Now copy the &amp;quot;hardware&amp;quot; folder to your Sketchbook folder, this is usually ~/Sketchbook/&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br/&amp;gt;&lt;br /&gt;
Alternative option is to set the Arduino 1.5.7 sketchbook folder to the Mk2-Firmware directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start the Arduino IDE and your will be able to select TiLDA MKe v0.333 for the Tools-&amp;gt;Board menu&lt;br /&gt;
&lt;br /&gt;
Draft 3d print-able and laser-able case files [http://www.thingiverse.com/thing:436815 here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=github&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Source =&lt;br /&gt;
&lt;br /&gt;
All the source code and designs are on openly available on Github:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Hardware Hardware] - the full board design&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Documentation Documentation] - a dump of relevant parts datasheets&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Firmware Firmware] - source code for the badge software&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Software Software] - server-side software for the network&lt;br /&gt;
&lt;br /&gt;
[[Category: Badges]]&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3334</id>
		<title>TiLDA MKe</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3334"/>
		<updated>2014-08-30T13:25:18Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: /* Features and Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA MKe project, Code name &amp;quot;ElectroMagnetic Boogaloo&amp;quot;, is being headed by [[User:Dpslwk|'RepRap' Matt]] and [[User:thinkl33t|Bob]]&lt;br /&gt;
[[File:Badge_Front.png|right|thumb|Front]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/E_(mathematical_constant) Why MKe?]&lt;br /&gt;
&lt;br /&gt;
=Aim= &lt;br /&gt;
The main aim of the 2014 badge is to give camp attendees live schedule updates and notifications. As with the original TiLDA we wanted to keep with an Arduino compatible platform that will allow badge hacking during and after the camp. As with previous badge all code and design files are available.&lt;br /&gt;
&lt;br /&gt;
==Features and Functions==&lt;br /&gt;
[[File:Badge_Back.png|right|thumb|Back]]&lt;br /&gt;
* Torch mode - Press the light button next to the screen. It will only light up fully if it's hung upside down to avoid blinding&lt;br /&gt;
* Snake&lt;br /&gt;
* Tetris&lt;br /&gt;
* Weather Forecast&lt;br /&gt;
* Schedule&lt;br /&gt;
* Can receive notifications about upcoming schedule items you're interested in. Visit schedule.emf.camp to set up your account.&lt;br /&gt;
&lt;br /&gt;
Please note that there's a known issue with the badge freezing. We're trying to work out what's causing this, but in the meantime pressing &amp;quot;reset&amp;quot; should get the badge back to life.&lt;br /&gt;
&lt;br /&gt;
== How to get going ==&lt;br /&gt;
=== Set up your environment ===&lt;br /&gt;
* Plug your badge into your computer via USB&lt;br /&gt;
* Download Arduino IDE 1.5.7 from http://arduino.cc/en/main/software#toc3&lt;br /&gt;
* “git clone” or download TiLDA source code from https://github.com/emfcamp/Mk2-Firmware&lt;br /&gt;
* Start the Arduino IDE. &lt;br /&gt;
* Now you have to change the sketchbook-folder to be the folder you just cloned. To do this use File | Preferences | “Set Sketchbook location”. On MacOS, this is Arduino | Preferences &lt;br /&gt;
* Restart the Arduino IDE&lt;br /&gt;
* Open sketch “EMF2014”&lt;br /&gt;
* Set Tools | Board to MKe v0.333 (RTOS Core)&lt;br /&gt;
* Set Tools | Port to correct port (you might have to research this - some operating systems like Windows require you to install drivers or become member of a certain group)&lt;br /&gt;
  * On Macos this is will start /dev/tty.usbmodem with 4 digits, and change for each port&lt;br /&gt;
  * On Linux this is usually /dev/ttyACM0 but may be a higher number if you have other USB Serial devices&lt;br /&gt;
* Hit the upload button&lt;br /&gt;
* Wait&lt;br /&gt;
* Woho - You just successfully uploaded code to your badge&lt;br /&gt;
* For now, the code waits for a key on the usbserial debug before doing anything, open the serial monitor in Arduino, set the line endings to ‘Newline’ and press enter.&lt;br /&gt;
=== Your first “Hello world” App ===&lt;br /&gt;
There’s a “HelloWorldApp.cpp” file in which you can play around. In order for it to show up on the Homescreen you have to uncomment line 51 in AppManager.cpp and flash the changed code to the badge. Great app pull requests are appreciated!&lt;br /&gt;
&lt;br /&gt;
=== Why are things so different from standard arduino code? ===&lt;br /&gt;
We’re using a library called FreeRTOS that allows us to multitask - something that’s normally not possible with standard arduino code. This allows us to run multiple tasks at the same time. FreeRTOS uses preemptive scheduling to switch between the task. Due to this we have to be very careful about how we do some things. For example we can’t just define interrupts for buttons in every task (imagine the mess!) or write to the serial port directly (your task might stop in the middle of the message). &lt;br /&gt;
&lt;br /&gt;
We’ve also spend quite a lot of time to make the build-in components as easy to use as possible without having every task to write lots of boilerplate code. If you feel like using the build-in components on the badge, chances are we already wrote a wrapper for them that is already used by one of the other tasks. &lt;br /&gt;
&lt;br /&gt;
Have a look at the “Documentation” section in this document for a full list of API functions. You will avoid a lot of headache if you stick to those.&lt;br /&gt;
=== How to use the badge with pure Arduino code ===&lt;br /&gt;
If you prefer you can always start from scratch without FreeRTOS or any of our code, just keep in mind that you won’t be able to receive messages via radio or use any of the API features we already added. Just start a new sketch in the Arduino IDE for that and get going. If you want to load the main firmware again just change the sketch to “EMF2014” and upload again.&lt;br /&gt;
=== Debugging and Gotchas ===&lt;br /&gt;
* The USB serial is set up to 11220 baud. There are lots of terminals that can connect to them&lt;br /&gt;
* If you can’t revive a badge you can short the two erase pins and press the reset button while holding it down.&lt;br /&gt;
* Avoid busy waiting, use FreeRTOS queues and Tilda::delay() instead&lt;br /&gt;
* Don’t use low level functions like interrupts or serial ports directly unless you really, really know how FreeRTOS will handle them. For general logging you can use Tilda::log()&lt;br /&gt;
=== Code structure ===&lt;br /&gt;
* FreeRTOS has the concept of “Tasks” which work like threads. We’ve wrappered them in a class called “Task” (for background stuff) and “Apps” (for foreground, one-at-a-time things)&lt;br /&gt;
* Everything needs to be in the main EMF2014 folder. Subfolders are not allowed. This is an Arduino IDE restriction :(&lt;br /&gt;
=== Radio infrastructure ===&lt;br /&gt;
The radio infrastructure is distributed between DKs. Every “gateway” has a raspberry pi with two ciseco usb radios. We never had the change to actually try it with that many badges in the same spot, so please don’t expect it to work perfectly.&lt;br /&gt;
=== Contribute ===&lt;br /&gt;
Send us pull request via github - We’ll do our best to review and merge the good ones during EMF so others can use them.&lt;br /&gt;
&lt;br /&gt;
=Hardware=&lt;br /&gt;
&lt;br /&gt;
The following hardware has been included on the badge.&lt;br /&gt;
&lt;br /&gt;
* [http://www.atmel.com/products/microcontrollers/arm/sam3x.aspx Atmel ATSAM3X8E]&lt;br /&gt;
** This is the same chip as the [http://arduino.cc/en/Main/ArduinoBoardDue Arduino Due] and gives us the base platform for the badge&lt;br /&gt;
** 32bit ARM Cortex M3 * 84MHz&lt;br /&gt;
** 512KBytes Flash RAM&lt;br /&gt;
** 96KBytes of SRAM&lt;br /&gt;
* A 128x64 pixel monochrome LCD display&lt;br /&gt;
* [http://shop.ciseco.co.uk/srf-wireless-rf-radio-surface-mount/ Ciseco SRF Radio]&lt;br /&gt;
** 868Mhz RF Transceiver&lt;br /&gt;
** Simple UART interface&lt;br /&gt;
** Low power sleep mode&lt;br /&gt;
* [http://www.invensense.com/mems/gyro/mpu6050.html MPU-6050] 3-axis Accelerometer and 3-axis gyro&lt;br /&gt;
** I2C interface&lt;br /&gt;
** Tri-Axis angular rate sensor (gyro) with a sensitivity up to 131 LSBs/dps and a full-scale range of ±250, ±500, ±1000, and ±2000dps&lt;br /&gt;
** Tri-Axis accelerometer with a programmable full scale range of ±2g, ±4g, ±8g and ±16g&lt;br /&gt;
** Digital Motion Processing™ (DMP™) engine offloads complex MotionFusion, sensor timing synchronization and gesture detection&lt;br /&gt;
* PMIC &amp;amp; LiPo&lt;br /&gt;
* Joystick&lt;br /&gt;
* Buttons&lt;br /&gt;
* RGB LED's&lt;br /&gt;
* IR&lt;br /&gt;
* Arduino Headers&lt;br /&gt;
* Pads for wearable tech&lt;br /&gt;
&lt;br /&gt;
=Hacking=&lt;br /&gt;
To use our board definition you will need to first get the Arduino 1.5.7 IDE from [http://arduino.cc/en/Main/Software#toc3 here]&amp;lt;br/&amp;gt;&lt;br /&gt;
Next you can download the TiLDA MKe Firmware project from either the [https://github.com/emfcamp/Mk2-Firmware github repo] or via [https://github.com/emfcamp/Mk2-Firmware/archive/master.zip direct download]&amp;lt;br/&amp;gt;&lt;br /&gt;
Now copy the &amp;quot;hardware&amp;quot; folder to your Sketchbook folder, this is usually ~/Sketchbook/&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br/&amp;gt;&lt;br /&gt;
Alternative option is to set the Arduino 1.5.7 sketchbook folder to the Mk2-Firmware directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start the Arduino IDE and your will be able to select TiLDA MKe v0.333 for the Tools-&amp;gt;Board menu&lt;br /&gt;
&lt;br /&gt;
Draft 3d print-able and laser-able case files [http://www.thingiverse.com/thing:436815 here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=github&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Source =&lt;br /&gt;
&lt;br /&gt;
All the source code and designs are on openly available on Github:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Hardware Hardware] - the full board design&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Documentation Documentation] - a dump of relevant parts datasheets&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Firmware Firmware] - source code for the badge software&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Software Software] - server-side software for the network&lt;br /&gt;
&lt;br /&gt;
[[Category: Badges]]&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3333</id>
		<title>TiLDA MKe</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=TiLDA_MKe&amp;diff=3333"/>
		<updated>2014-08-30T13:22:18Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The TiLDA MKe project, Code name &amp;quot;ElectroMagnetic Boogaloo&amp;quot;, is being headed by [[User:Dpslwk|'RepRap' Matt]] and [[User:thinkl33t|Bob]]&lt;br /&gt;
[[File:Badge_Front.png|right|thumb|Front]]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/E_(mathematical_constant) Why MKe?]&lt;br /&gt;
&lt;br /&gt;
=Aim= &lt;br /&gt;
The main aim of the 2014 badge is to give camp attendees live schedule updates and notifications. As with the original TiLDA we wanted to keep with an Arduino compatible platform that will allow badge hacking during and after the camp. As with previous badge all code and design files are available.&lt;br /&gt;
&lt;br /&gt;
==Features and Functions==&lt;br /&gt;
[[File:Badge_Back.png|right|thumb|Back]]&lt;br /&gt;
===Essential===&lt;br /&gt;
The following are considers core things that the badge must do for EMF2014&lt;br /&gt;
*	Receive and display announcements on talks scheduling&lt;br /&gt;
**	user registers their lanyard and which talks/workshops they are interested in on the emf web site &lt;br /&gt;
**	lanyard’s registered for talks receives reminders and notice of when and where a talk will be especially important if a talk is moved (time/location)&lt;br /&gt;
*	Torch Mode&lt;br /&gt;
** One of the side effect of the two RGB LED's on TiLDA was they made a great torch &lt;br /&gt;
*	Arduino Compatible&lt;br /&gt;
*	Work during the event and be useful afterwards&lt;br /&gt;
&lt;br /&gt;
== How to get going ==&lt;br /&gt;
=== Set up your environment ===&lt;br /&gt;
* Plug your badge into your computer via USB&lt;br /&gt;
* Download Arduino IDE 1.5.7 from http://arduino.cc/en/main/software#toc3&lt;br /&gt;
* “git clone” or download TiLDA source code from https://github.com/emfcamp/Mk2-Firmware&lt;br /&gt;
* Start the Arduino IDE. &lt;br /&gt;
* Now you have to change the sketchbook-folder to be the folder you just cloned. To do this use File | Preferences | “Set Sketchbook location”. On MacOS, this is Arduino | Preferences &lt;br /&gt;
* Restart the Arduino IDE&lt;br /&gt;
* Open sketch “EMF2014”&lt;br /&gt;
* Set Tools | Board to MKe v0.333 (RTOS Core)&lt;br /&gt;
* Set Tools | Port to correct port (you might have to research this - some operating systems like Windows require you to install drivers or become member of a certain group)&lt;br /&gt;
  * On Macos this is will start /dev/tty.usbmodem with 4 digits, and change for each port&lt;br /&gt;
  * On Linux this is usually /dev/ttyACM0 but may be a higher number if you have other USB Serial devices&lt;br /&gt;
* Hit the upload button&lt;br /&gt;
* Wait&lt;br /&gt;
* Woho - You just successfully uploaded code to your badge&lt;br /&gt;
* For now, the code waits for a key on the usbserial debug before doing anything, open the serial monitor in Arduino, set the line endings to ‘Newline’ and press enter.&lt;br /&gt;
=== Your first “Hello world” App ===&lt;br /&gt;
There’s a “HelloWorldApp.cpp” file in which you can play around. In order for it to show up on the Homescreen you have to uncomment line 51 in AppManager.cpp and flash the changed code to the badge. Great app pull requests are appreciated!&lt;br /&gt;
&lt;br /&gt;
=== Why are things so different from standard arduino code? ===&lt;br /&gt;
We’re using a library called FreeRTOS that allows us to multitask - something that’s normally not possible with standard arduino code. This allows us to run multiple tasks at the same time. FreeRTOS uses preemptive scheduling to switch between the task. Due to this we have to be very careful about how we do some things. For example we can’t just define interrupts for buttons in every task (imagine the mess!) or write to the serial port directly (your task might stop in the middle of the message). &lt;br /&gt;
&lt;br /&gt;
We’ve also spend quite a lot of time to make the build-in components as easy to use as possible without having every task to write lots of boilerplate code. If you feel like using the build-in components on the badge, chances are we already wrote a wrapper for them that is already used by one of the other tasks. &lt;br /&gt;
&lt;br /&gt;
Have a look at the “Documentation” section in this document for a full list of API functions. You will avoid a lot of headache if you stick to those.&lt;br /&gt;
=== How to use the badge with pure Arduino code ===&lt;br /&gt;
If you prefer you can always start from scratch without FreeRTOS or any of our code, just keep in mind that you won’t be able to receive messages via radio or use any of the API features we already added. Just start a new sketch in the Arduino IDE for that and get going. If you want to load the main firmware again just change the sketch to “EMF2014” and upload again.&lt;br /&gt;
=== Debugging and Gotchas ===&lt;br /&gt;
* The USB serial is set up to 11220 baud. There are lots of terminals that can connect to them&lt;br /&gt;
* If you can’t revive a badge you can short the two erase pins and press the reset button while holding it down.&lt;br /&gt;
* Avoid busy waiting, use FreeRTOS queues and Tilda::delay() instead&lt;br /&gt;
* Don’t use low level functions like interrupts or serial ports directly unless you really, really know how FreeRTOS will handle them. For general logging you can use Tilda::log()&lt;br /&gt;
=== Code structure ===&lt;br /&gt;
* FreeRTOS has the concept of “Tasks” which work like threads. We’ve wrappered them in a class called “Task” (for background stuff) and “Apps” (for foreground, one-at-a-time things)&lt;br /&gt;
* Everything needs to be in the main EMF2014 folder. Subfolders are not allowed. This is an Arduino IDE restriction :(&lt;br /&gt;
=== Radio infrastructure ===&lt;br /&gt;
The radio infrastructure is distributed between DKs. Every “gateway” has a raspberry pi with two ciseco usb radios. We never had the change to actually try it with that many badges in the same spot, so please don’t expect it to work perfectly.&lt;br /&gt;
=== Contribute ===&lt;br /&gt;
Send us pull request via github - We’ll do our best to review and merge the good ones during EMF so others can use them.&lt;br /&gt;
&lt;br /&gt;
=Hardware=&lt;br /&gt;
&lt;br /&gt;
The following hardware has been included on the badge.&lt;br /&gt;
&lt;br /&gt;
* [http://www.atmel.com/products/microcontrollers/arm/sam3x.aspx Atmel ATSAM3X8E]&lt;br /&gt;
** This is the same chip as the [http://arduino.cc/en/Main/ArduinoBoardDue Arduino Due] and gives us the base platform for the badge&lt;br /&gt;
** 32bit ARM Cortex M3 * 84MHz&lt;br /&gt;
** 512KBytes Flash RAM&lt;br /&gt;
** 96KBytes of SRAM&lt;br /&gt;
* A 128x64 pixel monochrome LCD display&lt;br /&gt;
* [http://shop.ciseco.co.uk/srf-wireless-rf-radio-surface-mount/ Ciseco SRF Radio]&lt;br /&gt;
** 868Mhz RF Transceiver&lt;br /&gt;
** Simple UART interface&lt;br /&gt;
** Low power sleep mode&lt;br /&gt;
* [http://www.invensense.com/mems/gyro/mpu6050.html MPU-6050] 3-axis Accelerometer and 3-axis gyro&lt;br /&gt;
** I2C interface&lt;br /&gt;
** Tri-Axis angular rate sensor (gyro) with a sensitivity up to 131 LSBs/dps and a full-scale range of ±250, ±500, ±1000, and ±2000dps&lt;br /&gt;
** Tri-Axis accelerometer with a programmable full scale range of ±2g, ±4g, ±8g and ±16g&lt;br /&gt;
** Digital Motion Processing™ (DMP™) engine offloads complex MotionFusion, sensor timing synchronization and gesture detection&lt;br /&gt;
* PMIC &amp;amp; LiPo&lt;br /&gt;
* Joystick&lt;br /&gt;
* Buttons&lt;br /&gt;
* RGB LED's&lt;br /&gt;
* IR&lt;br /&gt;
* Arduino Headers&lt;br /&gt;
* Pads for wearable tech&lt;br /&gt;
&lt;br /&gt;
=Hacking=&lt;br /&gt;
To use our board definition you will need to first get the Arduino 1.5.7 IDE from [http://arduino.cc/en/Main/Software#toc3 here]&amp;lt;br/&amp;gt;&lt;br /&gt;
Next you can download the TiLDA MKe Firmware project from either the [https://github.com/emfcamp/Mk2-Firmware github repo] or via [https://github.com/emfcamp/Mk2-Firmware/archive/master.zip direct download]&amp;lt;br/&amp;gt;&lt;br /&gt;
Now copy the &amp;quot;hardware&amp;quot; folder to your Sketchbook folder, this is usually ~/Sketchbook/&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br/&amp;gt;&lt;br /&gt;
Alternative option is to set the Arduino 1.5.7 sketchbook folder to the Mk2-Firmware directory.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start the Arduino IDE and your will be able to select TiLDA MKe v0.333 for the Tools-&amp;gt;Board menu&lt;br /&gt;
&lt;br /&gt;
Draft 3d print-able and laser-able case files [http://www.thingiverse.com/thing:436815 here]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=github&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Source =&lt;br /&gt;
&lt;br /&gt;
All the source code and designs are on openly available on Github:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Hardware Hardware] - the full board design&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Documentation Documentation] - a dump of relevant parts datasheets&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Firmware Firmware] - source code for the badge software&lt;br /&gt;
* [https://github.com/emfcamp/Mk2-Software Software] - server-side software for the network&lt;br /&gt;
&lt;br /&gt;
[[Category: Badges]]&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
	<entry>
		<id>https://wiki.emfcamp.org/2014/w/index.php?title=Volunteers&amp;diff=728</id>
		<title>Volunteers</title>
		<link rel="alternate" type="text/html" href="https://wiki.emfcamp.org/2014/w/index.php?title=Volunteers&amp;diff=728"/>
		<updated>2014-06-21T16:14:58Z</updated>

		<summary type="html">&lt;p&gt;Marekventur: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{link-banner}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Don't put your name here unless you really mean it and don't edit other people's words without their permission.&lt;br /&gt;
&lt;br /&gt;
This is a page in addition to signing up to volunteer as part of the ticket buying process. Please make sure that you have bought a ticket and signed up using that method as the emails gathered there will be how we contact everyone. &lt;br /&gt;
&lt;br /&gt;
NOTE: unless you're volunteering as a first aider (and have confirmed ahead of time with the first aid team) you must buy a ticket.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|'''Wiki user'''||'''[[Volunteers/DrivingLicenceCategories|Driving licence categories]]&amp;lt;br/&amp;gt;(if willing to drive)'''||'''I'd like to'''||'''I'm willing to'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:NAB|NAB]]&lt;br /&gt;
|&lt;br /&gt;
B, BE, C1, C1E, D1, D1E (clean)&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
If I put &amp;quot;motorhome&amp;quot; and &amp;quot;marshalling&amp;quot;, it's because I meant &amp;quot;motorhome&amp;quot; and &amp;quot;marshalling&amp;quot;.&lt;br /&gt;
If I had meant &amp;quot;motor-home&amp;quot; and &amp;quot;marshaling&amp;quot;, I would have put &amp;quot;motor-home&amp;quot; and &amp;quot;marshaling&amp;quot;.&lt;br /&gt;
If you think I've made a mistake, please have the common courtesy to contact me about it&lt;br /&gt;
before jumping in and 'correcting' me.&lt;br /&gt;
For reference:&lt;br /&gt;
1) There is no hyphen in 'motorhome' (http://www.oxforddictionaries.com/definition/english/motorhome?q=motorhome), and&lt;br /&gt;
2) I am not American and this is not an American event, so I have no intention of spelling&lt;br /&gt;
'marshalling' the American way. (http://www.oxforddictionaries.com/definition/english/marshal?q=marshalling)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* Take ownership of caravan/motorhome/trailer-tent section of site (selection of initial location, mark-up, marshalling, liaison re power/potable water/greywater/blackwater etc.)&lt;br /&gt;
* Create &amp;quot;I'm shy/alone, please talk to me&amp;quot; type badges&lt;br /&gt;
* Offer telephone conference room(s) with SIP, geo and freephone access&lt;br /&gt;
* Offer on-site telecoms&lt;br /&gt;
|&lt;br /&gt;
* Drive minibuses&lt;br /&gt;
* Run shop (basic staples)&lt;br /&gt;
* Keep loos stocked with toilet roll&lt;br /&gt;
* Pretty much anything else&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:lohapuk|lohapuk]]&lt;br /&gt;
|&lt;br /&gt;
A,B, B1 (clean)&lt;br /&gt;
|&lt;br /&gt;
* Help Deploy wireless / wired network (Certs CCNP,RHCE)&lt;br /&gt;
* Help Build tents / camp&lt;br /&gt;
|&lt;br /&gt;
* Anything to help out&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:Sling|Sling]]&lt;br /&gt;
|&lt;br /&gt;
B (but Dutch)&lt;br /&gt;
|&lt;br /&gt;
* Help with info/noc helpdesk&lt;br /&gt;
* Buildup and teardown&lt;br /&gt;
* Sysadmin&lt;br /&gt;
* Wiki maintaining &amp;amp; structuring&lt;br /&gt;
|&lt;br /&gt;
* Parking/Security&lt;br /&gt;
* Barshifts&lt;br /&gt;
* Help with cooking&lt;br /&gt;
* Probably more stuff I'm forgetting.&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:Dpslwk|'RepRap' Matt]]&lt;br /&gt;
|&lt;br /&gt;
Nope&lt;br /&gt;
|&lt;br /&gt;
* Badge Team, already working on it [[TiLDA 2]]&lt;br /&gt;
* Buildup and teardown (thought mostly i expect to be sorting badge related stuff, like deploying the R-PI radio network)&lt;br /&gt;
|&lt;br /&gt;
* Anything in between Badge hacking and running the Workshop area&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:User_4574|Nathan Lasseter]]&lt;br /&gt;
|&lt;br /&gt;
B,B1,f,k,p (clean)&lt;br /&gt;
|&lt;br /&gt;
* Help with the NOC team (LAIT1 Accredited)&lt;br /&gt;
* Lay/fly cabling/fibre&lt;br /&gt;
* Buildup and teardown&lt;br /&gt;
|&lt;br /&gt;
* Do most things once&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:danrl|danrl]]&lt;br /&gt;
|&lt;br /&gt;
B, C1, C&lt;br /&gt;
|&lt;br /&gt;
* deploy wireless / wired network&lt;br /&gt;
* build-up and tear-down&lt;br /&gt;
* IPv6 / NAT64&lt;br /&gt;
* Colocation&lt;br /&gt;
* Making teh NOC tent a fancy place to chill^M^Mwork hard&lt;br /&gt;
|&lt;br /&gt;
* rescue golf carts from ditches&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:markp|markp]]&lt;br /&gt;
|&lt;br /&gt;
B, B1, f, k. p (clean)&lt;br /&gt;
|&lt;br /&gt;
* network / power cabling &amp;amp; termination&lt;br /&gt;
* build-up and tear-down&lt;br /&gt;
* transport (have estate car and trailer)&lt;br /&gt;
* lighting&lt;br /&gt;
* have access to mifare card/badge printing facilities&lt;br /&gt;
* assist with camping facilities&lt;br /&gt;
|&lt;br /&gt;
* help out wherever I'm needed&lt;br /&gt;
(can only be on-site Friday to Monday, but happy to help weekend before)&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:bigcw|bigcw]]&lt;br /&gt;
|&lt;br /&gt;
B, B+E&lt;br /&gt;
|&lt;br /&gt;
* Get involved.  Will help with anything.  Very good at 'getting things done'.&lt;br /&gt;
|&lt;br /&gt;
* Connectivity (15 years experience in ISP industry)&lt;br /&gt;
* Power (former event lighting engineer)&lt;br /&gt;
* Transport (have Range Rover and trailer license)&lt;br /&gt;
* Anything else (lots of local knowledge, contacts, etc)&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:simonvc|Simon Vans-Colina]]&lt;br /&gt;
|&lt;br /&gt;
A,B,BE,B2,f,k,p&lt;br /&gt;
|&lt;br /&gt;
* Anything really&lt;br /&gt;
|&lt;br /&gt;
* Dont have a car, but can drive one if needed.&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:Si1entDave|Dave Wilson]]&lt;br /&gt;
|&lt;br /&gt;
B, B1&lt;br /&gt;
|&lt;br /&gt;
* Most things involving cables - I am also known as SparkyDave, head of site electrics for Profound Decisions LRP events&lt;br /&gt;
* My attendance will be contingent on my employer, Warwicknet, providing the connectivity - in which case they will give me the time off to attend :-)&lt;br /&gt;
* I also have a Defender which I am rather good at using to position trailers/generators/etc on fields&lt;br /&gt;
|&lt;br /&gt;
* I'll muck in with most things, but definitely specialise in electrics and networking.&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:gmc|gmc]]&lt;br /&gt;
|&lt;br /&gt;
B, AM&lt;br /&gt;
|&lt;br /&gt;
* drive a manitou&lt;br /&gt;
* man the HQ&lt;br /&gt;
* do radio&lt;br /&gt;
* organize stuff&lt;br /&gt;
* A/V related stuff&lt;br /&gt;
* all of the above preferably in a supervisory / gophery kinda way&lt;br /&gt;
* build-up / tear-down&lt;br /&gt;
|&lt;br /&gt;
* pick up trash&lt;br /&gt;
* herald a lecture venue&lt;br /&gt;
* driving&lt;br /&gt;
* bar-shifts&lt;br /&gt;
* ...&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:sleepycal|sleepycal]]&lt;br /&gt;
|&lt;br /&gt;
B,B1 (clean)&lt;br /&gt;
|&lt;br /&gt;
* Anything network related (NOC support, cabling, maintenance etc)&lt;br /&gt;
* Any aspect of site build-up/tear-down&lt;br /&gt;
* Prep work / planning&lt;br /&gt;
* Anything workshop related&lt;br /&gt;
* On-site help/emergency team (someone you can flag down any time/place if you need help)&lt;br /&gt;
|&lt;br /&gt;
* Anything to help out&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:Big Kate|Big Kate]]&lt;br /&gt;
|&lt;br /&gt;
B, BE, C1, C1E, D1, D1E, Blue Badge  &lt;br /&gt;
|&lt;br /&gt;
* Heralding/Speaker desk - On the day introduction to events etc &lt;br /&gt;
* Green Room Team:Content - Building a green room &lt;br /&gt;
* Making sure presenters have met there Heralds, hand off process etc&lt;br /&gt;
* Team:Rehash - Assuming its the same crew from OHM &lt;br /&gt;
* Queering the community i.e. LGBT etc community aspects&lt;br /&gt;
* Disability Access issues &lt;br /&gt;
|&lt;br /&gt;
* Build up and tear down &lt;br /&gt;
* (as best I can - given my disabilities)&lt;br /&gt;
* Drive Vehicles - upto 7.5 Tonnes&lt;br /&gt;
* (I have a disabled/ blue badge) &lt;br /&gt;
* (easier parking/ pickup/ drop off) &lt;br /&gt;
* Logistics and Operations &lt;br /&gt;
* Usual gophering type stuff &lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:drrk|Kimball]]&lt;br /&gt;
|&lt;br /&gt;
None&lt;br /&gt;
|&lt;br /&gt;
* &amp;lt;s&amp;gt;Buildup&amp;lt;/s&amp;gt;Due to change of job I can't be there before the Friday now :(&lt;br /&gt;
* Badge Firmware&lt;br /&gt;
* Sysadmin&lt;br /&gt;
* AV/Radio&lt;br /&gt;
|&lt;br /&gt;
* Anything else&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:Critical|Critical]]&lt;br /&gt;
|&lt;br /&gt;
B, BE, C1, C1E, D1, D1E  &lt;br /&gt;
|&lt;br /&gt;
* Build up and tear down &lt;br /&gt;
* Anything Network / IT / AV related&lt;br /&gt;
* Meet / greet / help&lt;br /&gt;
|&lt;br /&gt;
* Whatever is needed&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:chris_martin|chris_martin]]&lt;br /&gt;
|&lt;br /&gt;
0&lt;br /&gt;
|&lt;br /&gt;
* Build up and tear down &lt;br /&gt;
* FULLY SIA LICENSED &amp;gt;&amp;gt;&amp;gt; marshaling&lt;br /&gt;
* bar-shifts&lt;br /&gt;
|&lt;br /&gt;
* Whatever is needed&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:lozarythmic|lozarythmic]]&lt;br /&gt;
|&lt;br /&gt;
AM, A, B, B1 (clean)&lt;br /&gt;
|&lt;br /&gt;
* Networking&lt;br /&gt;
* Fire Marshall&lt;br /&gt;
* Bar Work&lt;br /&gt;
|&lt;br /&gt;
* Whatever is needed&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:JimM|Jim MacArthur]]&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
* Build up/tear down&lt;br /&gt;
* Bar Work&lt;br /&gt;
|&lt;br /&gt;
* Whatever is needed&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:RattyMaHatty|Ratty]]&lt;br /&gt;
|&lt;br /&gt;
B, BE, C1, C1E, D1, D1E, fklnp (a few points)&lt;br /&gt;
|&lt;br /&gt;
* M$ Windows fixing&lt;br /&gt;
* PC/Server hardware engineer&lt;br /&gt;
* Networking&lt;br /&gt;
* Bar Work&lt;br /&gt;
* Driving&lt;br /&gt;
|&lt;br /&gt;
* Whatever is needed&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:ens|ens]]&lt;br /&gt;
|&lt;br /&gt;
None - but willing ;)&lt;br /&gt;
|&lt;br /&gt;
* Media/Editing stuff (Can provide lend of broadcast-standard video gear if needed, aswell as editing gear) &lt;br /&gt;
* You need an electro-hacker-trippy-ambient DJ? hook me up.&lt;br /&gt;
* Build-up or Tear-down.&lt;br /&gt;
* Heralding.&lt;br /&gt;
* Helping those who are giving talks to get sorted.&lt;br /&gt;
|&lt;br /&gt;
* Help sourcing physical resources for the site.&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:pioneer|pioneer]]&lt;br /&gt;
|&lt;br /&gt;
B,B+E,kfp (clean)&lt;br /&gt;
|&lt;br /&gt;
* Help Deploy wireless / wired network - Anything network related.. I have my own RJ45 Cripmer :p&lt;br /&gt;
* Help with VoIP system if deployed&lt;br /&gt;
* Sysadmin, NOC Help, Server admin&lt;br /&gt;
* Power, Lighting, AV - Part time sound engineer with access to PA systems, AV gear, projectors etc&lt;br /&gt;
* Build-up and tear-down&lt;br /&gt;
|&lt;br /&gt;
* I can loan a PA System&lt;br /&gt;
* can also loan networking/wifi + server equipment if needed, just ask and I might have it.&lt;br /&gt;
* I'll Help with most things, but I specialise in electrics, networking / server admin.&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:AK47|AK47]]&lt;br /&gt;
|&lt;br /&gt;
B&lt;br /&gt;
|&lt;br /&gt;
* NOC&lt;br /&gt;
* WiFi&lt;br /&gt;
* VoIP&lt;br /&gt;
* General networking stuff&lt;br /&gt;
|&lt;br /&gt;
* Anything else&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| [[User:Pure|Joe Roberts]]&lt;br /&gt;
| None&lt;br /&gt;
|&lt;br /&gt;
* Help desk (WiFi connecting, server stuff, techy stuff!)&lt;br /&gt;
* Build up and tear down&lt;br /&gt;
* Talking to people&lt;br /&gt;
* (DBS Approved)&lt;br /&gt;
| Anything I can possibly do!&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:immunda|Phil Howell]]&lt;br /&gt;
|&lt;br /&gt;
B1, B, f, k, p (clean)&lt;br /&gt;
|&lt;br /&gt;
* Help out with driving (has estate car if helpful)&lt;br /&gt;
* A/V stuff (have PA gear that can be used)&lt;br /&gt;
* Help with networking stuff&lt;br /&gt;
|&lt;br /&gt;
* Whatever is needed&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:BuildTheRobots|Daniel Fligg]]&lt;br /&gt;
|&lt;br /&gt;
AM, A, B1, B, (f,k,p,q) (clean, since April 08)&lt;br /&gt;
|&lt;br /&gt;
* Enjoys driving&lt;br /&gt;
* Experience running PAs / Bands&lt;br /&gt;
* Networks &amp;amp; Communications (Team:Phone)&lt;br /&gt;
* Lots of marshaling experience.&lt;br /&gt;
|&lt;br /&gt;
* Whatever else is needed&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:Arran|Arran Gallagher]]&lt;br /&gt;
|&lt;br /&gt;
None&lt;br /&gt;
|&lt;br /&gt;
* Help with the NOC&lt;br /&gt;
* Deploy wireless / wired network &lt;br /&gt;
* Sysadmin&lt;br /&gt;
|&lt;br /&gt;
* Help with build up and tear down&lt;br /&gt;
* Provide assistance to attendees&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:ianthe88|Ianthe Sutherland]]&lt;br /&gt;
|&lt;br /&gt;
None&lt;br /&gt;
|&lt;br /&gt;
* Have a first aid certificate so happy to be noted as a first aider&lt;br /&gt;
* Meet &amp;amp; greet&lt;br /&gt;
|&lt;br /&gt;
* Whatever is needed&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:greenhac|PeterJ]]&lt;br /&gt;
|&lt;br /&gt;
- &lt;br /&gt;
|&lt;br /&gt;
* Security/Car Park (EMF 2012 Security Alumnus)  &lt;br /&gt;
|&lt;br /&gt;
* Whatever needs doing&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:StuartL|StuartL]]&lt;br /&gt;
|&lt;br /&gt;
A, B, BE, C1, C1E, D1, D1E, f, k, l, n, p (clean)&lt;br /&gt;
|&lt;br /&gt;
* Drive minibuses/shuttle people generally&lt;br /&gt;
* Drive pretty much anything on/off road, incl heavy equipment&lt;br /&gt;
* Do Netwerk Shtuff&lt;br /&gt;
|&lt;br /&gt;
* Drive/operate/recover vehicles&lt;br /&gt;
* Design/implement network&lt;br /&gt;
* Provide network switch(es), cables&lt;br /&gt;
* Provide vehicle with tow-bar, if it's useful&lt;br /&gt;
* Provide generator (2.5kVA)&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:mdg|mdg]]&lt;br /&gt;
|&lt;br /&gt;
N/A&lt;br /&gt;
|&lt;br /&gt;
* Bar Work&lt;br /&gt;
|&lt;br /&gt;
* Sysadmin if needed&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:pobk|pobk]]&lt;br /&gt;
|&lt;br /&gt;
B1/B/f/k/p/q (Clean)&lt;br /&gt;
|&lt;br /&gt;
* Where required&lt;br /&gt;
* I volunteer for St John Ambulance and hold advanced first aid quals (Medgasses, AED, spinal, fractures etc). Happy to provide medical cover... May even be able to drag long kit. &lt;br /&gt;
|&lt;br /&gt;
* Whatever needs doing.&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:mattg|mattg]]&lt;br /&gt;
|&lt;br /&gt;
B1/B/f/k/p/q (Clean)&lt;br /&gt;
|&lt;br /&gt;
* Drive things&lt;br /&gt;
* Help with infrastructure&lt;br /&gt;
* anything else that needs doing.&lt;br /&gt;
|&lt;br /&gt;
* Help with AV/stage stuff + streaming/recording etc.&lt;br /&gt;
* be friendly face to punters&lt;br /&gt;
* may be available for some of get-in.&lt;br /&gt;
* Whatever else needs doing.&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:Mpresson|mpresson]]&lt;br /&gt;
|&lt;br /&gt;
A, B, BE, C1, C1E, D1, D1E, f, k, l, n, p (clean)&lt;br /&gt;
|&lt;br /&gt;
* Drive minibuses/shuttle people generally&lt;br /&gt;
* Bar work&lt;br /&gt;
|&lt;br /&gt;
* Pretty much anything within reason&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:w1bble|w1bble]]&lt;br /&gt;
|&lt;br /&gt;
B, C1E, D1E (clean but a scrap of messy old paper)&lt;br /&gt;
|&lt;br /&gt;
* Be local to EMF [[Bletchley]] so can help before &amp;amp; poss after&lt;br /&gt;
* Take pictures&lt;br /&gt;
* Sysadmin if needed&lt;br /&gt;
* Be responsible for $offspring1 (Oliver age 11)&lt;br /&gt;
|&lt;br /&gt;
* Pretty much anything within reason (noting offspring requirement)&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:Chewie|Chewie]]&lt;br /&gt;
|&lt;br /&gt;
B, C1E, D1E&lt;br /&gt;
|&lt;br /&gt;
* Networking&lt;br /&gt;
* Bringing a truck that can tow things that will fit onto a [http://www.johnrichardssurplus.co.uk/content/images/xxl/129.jpg NATO hitch]&lt;br /&gt;
|&lt;br /&gt;
* Pretty much anything technical :)&lt;br /&gt;
* Bringing a generator (at least 4kw), which is thirsty, but useful for emergencies&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Begin user block --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
[[User:marekventur|marekventur]]&lt;br /&gt;
|&lt;br /&gt;
B&lt;br /&gt;
|&lt;br /&gt;
* I can be there early that week and help with building up the camp/infrastructure&lt;br /&gt;
* Happy to help out with stewarding and whatever else needs doing during the camp&lt;br /&gt;
|&lt;br /&gt;
* Help with badges if any work is needed&lt;br /&gt;
&amp;lt;!-- End user block --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Marekventur</name></author>
	</entry>
</feed>