[[Elbow]]
 

Elbow

Elbow
elbow.jpg
founder: b00lean
depends on:
interested: niekt0
harvie
software license:
hardware license:
status: done

General purpose open-source ARM based MCU peripheral controled via USB.
Allows cheap and easy way to control input/outputs of arm7 based device from host computer via USB.
Price for building such device should not exceed 500 CZK (25 USD).

Motivation

  1. To learn and play with ARM processor
  2. To create an usefull peripheral as a possible platform for future USB based toys.

Specification

  • API which Elbow device offers to host computer:
    • Read/Write input values from/to GPIO
    • Read/Write from/to device FLASH/RAM
    • Generate pulse of specified length in milliseconds on GPIO
    • Check connection with elbow device
    • Read device serial number
    • Write once device serial number
    • Read 1-wire Dallas chip information
    • Read device firmware version
  • Selected technologies:

Phases of project

Preparation

  1. Buy module board - DONE AT91SAM7S256-KIT
  2. Buy JTAG adapter - DONE
  3. Try compiling and running tutorials with GCC - DONE
  4. Try compiling and running FreeRTOS tutorial - DONE
  5. Write USB communication example - DONE
  6. Find out how to connect to JTAG with OpenOCD - DONE
  7. Try to debug with JTAG+OpenOCD+GDB - DONE
  8. Find out how to flash program via JTAG. - DONE
  9. Setup IDE(Eclipse CDP) for project with armGCC. - DONE
  10. Configure Eclipse IDE with GDB+OpenOCD - DONE
  11. Write and test firmware that sends and receives commands to host via USB - DONE
  12. Buy prototyping board+wires+LEDs+resistors+buttons - DONE
  13. Try writing and reading inputs/outputs DONE

elbow_prototype_alpha.jpg elbow_prototype_beta.jpg

HW implementation

  1. Device should be powered via USB (needs to be stabilized to 3.3V) - DONE
  2. Add power loss aware circuit - DONE
  3. LEDs/Buttons should be connected to GPIO using 12V. DONE
  4. Connect DS2401 connector DONE
  5. Connect relays DONE
  6. Make my own board

SW implementation

  1. Implement 1st set of basic commands:
    • Check connection with elbow device - DONE Command: PING
    • Read device firmware version - DONE Command: VERSION
  2. Implement 2nd set of commands:
    • Write once device serial number - DONE Command: SETSERIAL 12345678
    • Read device serial number - DONE Command: GETSERIAL
    • Read/Write input values on/to GPIO. - DONE Commands: CFGIO, SETIO, CLRIO
  3. Implement 3rd set of commands:
    • Read 1-wire Dallas chip information (serial/temperature) - DONE Commands: GETSERIAL x, GETTEMP x
    • Generate pulse by specified length in milliseconds on GPIO - DONE Commands: PULSE x m
  4. Implement 4th set of commands:
    • Read/Write to device FLASH/RAM - DONE Commands: FLASHWRITE, FLASHREAD, RAMREAD, RAMWRITE
    • Reporting of input values change on a pin - DONE Commands: EIOIRQ, DIOIRQ
  5. Add power loss detection and RAM persistence. - DONE
  6. Implement Java library that communicates with elbow
    • Implement direct connection via ttyACM support - DONE
    • Write and run functionality tests. - DONE (some bugs fixed)
    • Write and run stress tests (concurrency+fast queries). - DONE
    • Implement tests for interrupt messages IOIRQ, SAFERAM
    • Implement TCP connection support

COMMUNICATION PROTOCOL

How to talk to ELBOW:

b00lean@hcooh:~$ echo "PING" > /dev/ttyACM0

How to listen to ELBOW:

b00lean@hcooh:~$ cat /dev/ttyACM0

Interactive mode:

harvie@insomnia ~ $ minicom -D /dev/ttyACM0

Commands

Legend:
C = Computer
E = ELBOW

How to check that elbow is alive:

C> PING
E> PONG

Get Elbow version:

C> VERSION
E> VERSION ELBOW 1.0.2

Get Elbow serial number:

C> GETSERIAL
E> SERIAL 12345678

Set Elbow serial number:

C> SETSERIAL 12345678
E> SERIAL 12345678

Read Elbow's current GPIO configuration:
This command returns configuration of every IO pin output (32)
Legend:

O = output 
I = input 
F = input with glitch filter 
P = input with pull-up resistor(10kOhm)
A = input with pull-up resistor and glitch filter
Letter in uppercase means that pin is permitted.
Letter in lowercase means pin is not permitted.
C> CFGIO
E> CFGIO FOOOPPPPPPPPPPPPOPfPPPPPPIIioAOP

Configure Elbow's GPIO:

C> CFGIO iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
E> CFGIO OK

Reading all Elbow's inputs:

C> GETIO
E> GETIO 10011111111111110111111111111101

Setting all Elbow's outputs to logical 1:

C> SETIO 11111111111111111111111111111111
E> SETIO OK

Setting all Elbow's outputs to logical 0:

C> CLRIO 11111111111111111111111111111111
E> CLRIO OK

Sending pulse on pin 8 of specified duration 100ms(sending oposite state than is current for specified duration):

C> PULSE 8 100
E> PULSE OK

Enable input value change on input pin number 3 reporting and report value after 100 continuous reads.
In example elbow is reporting that on pin 3 level changed to logical 1

C> EIOIRQ 3 100
E> EIOIRQ OK
E> IOIRQ 3 1

Disable input value change on input pin number 3 reporting

C> DIOIRQ 3
E> DIOIRQ OK

Get 1-wire chip serial number connected to pin 8 (PA08):

C> GETSERIAL 8
E> SERIAL 000002950dcd
if chip is not found:
E> SERIAL EMPTY

Get 1-wire chip temperature connected to pin 8 (PA08):

C> GETTEMP 8
E> TEMP 22.6
if chip is not found:
E> TEMP EMPTY

How to read 10 bytes from device user reserved RAM(20kB) from offset 0

C> RAMREAD 0 10
E> RAMREAD OK
E> datadatadata
E> EOF

How to read 10 bytes from device user reserved FLASH(64kB) from offset 0

C> FLASHREAD 0 10
E> FLASHREAD OK
E> datadatadata
E> EOF

How to write 10 bytes to device user reserved RAM(20kB) to offset 0

C> RAMWRITE 0 10
E> RAMWRITE READY
C> datadatadata
E> RAMWRITE OK

How to write 10 bytes to device user reserved RAM(64kB) to offset 0

C> FLASHWRITE 0 10
E> FLASHWRITE READY
C> datadatadata
E> FLASHWRITE OK

How to make sure that if power is lost on pin 4(turns to logical 0) first 256 bytes of RAM will be stored in internal flash memory before the device dies on power loss:

C> ESAFERAM 4
E> ESAFERAM OK

When power loss occurs elbow will try to send message on usb:

E> SAFERAM SAVED

How to restore saved 256 bytes of data from flash to RAM:

C> RSAFERAM
E> RSAFERAM OK

PINOUTS

 1. ADVref44. Vcc
 2. AD4   43. Vcc
 3. AD5   42. DDP
 4. AD6   41. DDM
 5. AD7   40. PA31?
 6. PA17  39. PA0
 7. PA18  38. PA1
 8. PA21  37. PA2
 9. PA19  36. PA3
10. PA22  35. PA30
11. PA23  34. PA29
12. PA20  33. RESET
13. PA16! 32. PA28
14. PA15  31. PA27
15. PA14  30. PA4
16. PA13  29. PA5
17. PA24  28. PA6
18. PA25  27. PA7
19. PA26  26. PA8
20. PA12  25. PA9*
21. GND   24. PA10*
22. GND   23. PA11!

! - reserved for USB detection
* - used also for JTAG
? - used for alive signalization (blinking diode - output)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki