User Tools

Site Tools


project:elbow:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
project:elbow [2011/04/21 14:01] – status=done paskyproject:elbow:start [2016/11/25 10:15] ruza
Line 1: Line 1:
 +====== Elbow ======
 +{{template>:project:infobox|
 +name=Elbow|
 +image=elbow.jpg|
 +founder=[[user:b00lean]]|
 +interested=[[user:niekt0]]\\ [[user:harvie]]|
 +hw=|
 +sw=|
 +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 =====
 +  - To learn and play with ARM processor
 +  - 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:
 +     * Elbow Device Hardware:
 +         * MCU: AT91SAM7S [[http://www.atmel.com/dyn/products/product_card.asp?part_id=3524|AT91SAM7S256 or AT91SAM7S512]]
 +         * Board: [[http://www.kramara.com/?q=node/16|AT91SAM7S256-KIT]]/[[http://www.kramara.com/?q=node/27|AT91SAM7X512_KIT]]/[[http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3784|AT91SAM7S256-EK]]
 +         * Connection to host: USB
 +     * Elbow Device Software:
 +         * Compiler: [[http://www.gnuarm.com/|gnuarm(GCC)]]
 +         * OS: [[http://www.freertos.org/|FreeRTOS]]
 +     * Elbow Host Software:
 +         * Supported OS: Linux
 +         * IDE: [[http://www.eclipse.org|Eclipse]] (C+Java)
 +         * Driver model: ttyACM (serial communication via USB)
 +         * Software library: [[http://www.java.com|Java]] [[http://www.rxtx.org/|RxTx]]
 +
 +===== Phases of project =====
 +==== Preparation ====
 +  - Buy module board - **DONE AT91SAM7S256-KIT**
 +  - Buy JTAG adapter - **DONE**
 +  - Try compiling and running tutorials with GCC - **DONE**
 +  - Try compiling and running FreeRTOS tutorial - **DONE**
 +  - Write USB communication example - **DONE**
 +  - Find out how to connect to JTAG with OpenOCD - **DONE**
 +  - Try to debug with JTAG+OpenOCD+GDB - **DONE**
 +  - Find out how to flash program via JTAG. - **DONE**
 +  - Setup IDE(Eclipse CDP) for project with armGCC. - **DONE**
 +  - Configure Eclipse IDE with GDB+OpenOCD - **DONE**
 +  - Write and test firmware that sends and receives commands to host via USB - **DONE**
 +  - Buy prototyping board+wires+LEDs+resistors+buttons - **DONE**
 +  - Try writing and reading inputs/outputs **DONE**
 +
 +{{:project:elbow_prototype_alpha.jpg?200}}
 +{{:project:elbow_prototype_beta.jpg?354}} 
 +
 +==== HW implementation ====
 +  - Device should be powered via USB (needs to be stabilized to 3.3V) - **DONE**
 +  - Add power loss aware circuit - **DONE**
 +  - LEDs/Buttons should be connected to GPIO using 12V. **DONE**
 +  - Connect DS2401 connector **DONE**
 +  - Connect relays **DONE**
 +  - Make my own board
 +
 +==== SW implementation ====
 +  - Implement 1st set of basic commands:
 +    * Check connection with elbow device - **DONE**  Command: PING
 +    * Read device firmware version - **DONE**  Command: VERSION
 +  - 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
 +  - 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
 +  - 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
 +  - Add power loss detection and RAM persistence. - **DONE**
 +  - 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:
 +<code>
 +b00lean@hcooh:~$ echo "PING" > /dev/ttyACM0
 +</code>
 +
 +How to listen to ELBOW: 
 +<code>
 +b00lean@hcooh:~$ cat /dev/ttyACM0
 +</code>
 +
 +Interactive mode:
 +<code>
 +harvie@insomnia ~ $ minicom -D /dev/ttyACM0
 +</code>
 +
 +=====  Commands ===== 
 +
 +Legend: \\
 +C = Computer \\
 +E = ELBOW \\
 +
 +
 +How to check that elbow is alive:
 +<code>
 +C> PING
 +E> PONG
 +</code>
 +
 +
 +Get Elbow version:
 +<code>
 +C> VERSION
 +E> VERSION ELBOW 1.0.2
 +</code>
 +
 +Get Elbow serial number:
 +<code>
 +C> GETSERIAL
 +E> SERIAL 12345678
 +</code>
 +
 +Set Elbow serial number:
 +<code>
 +C> SETSERIAL 12345678
 +E> SERIAL 12345678
 +</code>
 +
 +Read Elbow's current GPIO configuration: \\
 +This command returns configuration of every IO pin output (32) \\
 +Legend: \\
 +<code>
 +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.
 +</code>
 +
 +<code>
 +C> CFGIO
 +E> CFGIO FOOOPPPPPPPPPPPPOPfPPPPPPIIioAOP
 +</code>
 +
 +Configure Elbow's GPIO: \\
 +<code>
 +C> CFGIO iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
 +E> CFGIO OK
 +</code>
 +
 +Reading all Elbow's inputs: \\
 +<code>
 +C> GETIO
 +E> GETIO 10011111111111110111111111111101
 +</code>
 +
 +Setting all Elbow's outputs to logical 1: \\
 +<code>
 +C> SETIO 11111111111111111111111111111111
 +E> SETIO OK
 +</code>
 +
 +Setting all Elbow's outputs to logical 0: \\
 +<code>
 +C> CLRIO 11111111111111111111111111111111
 +E> CLRIO OK
 +</code>
 +
 +Sending pulse on pin 8 of specified duration 100ms(sending oposite state than is current for specified duration): \\
 +<code>
 +C> PULSE 8 100
 +E> PULSE OK
 +</code>
 +
 +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
 +<code>
 +C> EIOIRQ 3 100
 +E> EIOIRQ OK
 +E> IOIRQ 3 1
 +</code>
 +
 +Disable input value change on input pin number 3 reporting
 +<code>
 +C> DIOIRQ 3
 +E> DIOIRQ OK
 +</code>
 +
 +Get 1-wire chip serial number connected to pin 8 (PA08): 
 +<code>
 +C> GETSERIAL 8
 +E> SERIAL 000002950dcd
 +if chip is not found:
 +E> SERIAL EMPTY
 +</code>
 +
 +Get 1-wire chip temperature connected to pin 8 (PA08): 
 +<code>
 +C> GETTEMP 8
 +E> TEMP 22.6
 +if chip is not found:
 +E> TEMP EMPTY
 +</code>
 +
 +How to read 10 bytes from device user reserved RAM(20kB) from offset 0
 +<code>
 +C> RAMREAD 0 10
 +E> RAMREAD OK
 +E> datadatadata
 +E> EOF
 +</code>
 +
 +How to read 10 bytes from device user reserved FLASH(64kB) from offset 0
 +<code>
 +C> FLASHREAD 0 10
 +E> FLASHREAD OK
 +E> datadatadata
 +E> EOF
 +</code>
 +
 +How to write 10 bytes to device user reserved RAM(20kB) to offset 0
 +<code>
 +C> RAMWRITE 0 10
 +E> RAMWRITE READY
 +C> datadatadata
 +E> RAMWRITE OK
 +</code>
 +
 +How to write 10 bytes to device user reserved RAM(64kB) to offset 0
 +<code>
 +C> FLASHWRITE 0 10
 +E> FLASHWRITE READY
 +C> datadatadata
 +E> FLASHWRITE OK
 +</code>
 +
 +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:
 +<code>
 +C> ESAFERAM 4
 +E> ESAFERAM OK
 +</code>
 +
 +When power loss occurs elbow will try to send message on usb:
 +<code>
 +E> SAFERAM SAVED
 +</code>
 +
 +How to restore saved 256 bytes of data from flash to RAM:
 +<code>
 +C> RSAFERAM
 +E> RSAFERAM OK
 +</code>
 +
 +
 +
 +====== PINOUTS ======
 +<code>
 + 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)
 +</code>
 +
  
project/elbow/start.txt · Last modified: 2016/11/28 02:04 by ruza