project:elbow:start
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
project:elbow [2010/11/09 23:21] – harvie | project:elbow:start [2016/11/25 07:42] – ↷ Page moved and renamed from project:elbow to project:elbow:start ruza | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Elbow ====== | ||
+ | {{template> | ||
+ | name=Elbow| | ||
+ | image=elbow.jpg| | ||
+ | founder=[[user: | ||
+ | interested=[[user: | ||
+ | hw=| | ||
+ | sw=| | ||
+ | status=done}} | ||
+ | |||
+ | General purpose open-source ARM based MCU peripheral controled via USB.\\ | ||
+ | Allows cheap and easy way to control input/ | ||
+ | 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:// | ||
+ | * Board: [[http:// | ||
+ | * Connection to host: USB | ||
+ | * Elbow Device Software: | ||
+ | * Compiler: [[http:// | ||
+ | * OS: [[http:// | ||
+ | * Elbow Host Software: | ||
+ | * Supported OS: Linux | ||
+ | * IDE: [[http:// | ||
+ | * Driver model: ttyACM (serial communication via USB) | ||
+ | * Software library: [[http:// | ||
+ | |||
+ | ===== 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/ | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | ==== HW implementation ==== | ||
+ | - Device should be powered via USB (needs to be stabilized to 3.3V) - **DONE** | ||
+ | - Add power loss aware circuit - **DONE** | ||
+ | - LEDs/ | ||
+ | - 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** | ||
+ | * Read device firmware version - **DONE** | ||
+ | - Implement 2nd set of commands: | ||
+ | * Write once device serial number - **DONE** Command: SETSERIAL 12345678 | ||
+ | * Read device serial number | ||
+ | * Read/Write input values on/to GPIO. - **DONE** Commands: CFGIO, SETIO, CLRIO | ||
+ | - Implement 3rd set of commands: | ||
+ | * Read 1-wire Dallas chip information (serial/ | ||
+ | * 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 | ||
+ | * Write and run functionality tests. - **DONE** (some bugs fixed) | ||
+ | * Write and run stress tests (concurrency+fast queries). | ||
+ | * Implement tests for interrupt messages IOIRQ, SAFERAM | ||
+ | * Implement TCP connection support | ||
+ | |||
+ | |||
+ | ====== COMMUNICATION PROTOCOL ====== | ||
+ | How to talk to ELBOW: | ||
+ | < | ||
+ | b00lean@hcooh: | ||
+ | </ | ||
+ | |||
+ | How to listen to ELBOW: | ||
+ | < | ||
+ | b00lean@hcooh: | ||
+ | </ | ||
+ | |||
+ | Interactive mode: | ||
+ | < | ||
+ | harvie@insomnia ~ $ minicom -D / | ||
+ | </ | ||
+ | |||
+ | ===== 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' | ||
+ | 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' | ||
+ | < | ||
+ | C> CFGIO iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii | ||
+ | E> CFGIO OK | ||
+ | </ | ||
+ | |||
+ | Reading all Elbow' | ||
+ | < | ||
+ | C> GETIO | ||
+ | E> GETIO 10011111111111110111111111111101 | ||
+ | </ | ||
+ | |||
+ | Setting all Elbow' | ||
+ | < | ||
+ | C> SETIO 11111111111111111111111111111111 | ||
+ | E> SETIO OK | ||
+ | </ | ||
+ | |||
+ | Setting all Elbow' | ||
+ | < | ||
+ | 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) | ||
+ | </ | ||
+ | |||
project/elbow/start.txt · Last modified: 2016/11/28 02:04 by ruza