NeTV Motor controller board

=Hardware= Placeholder.

=Software= All operations on motor board can be controlled via console terminal or various HTTP API.

mot_ctl command
FPGA control routine. Command character _ not recognized. r      hardware reset of the FPGA to clean state for reconfiguration o      return the state of the FPGA programming done pin V      print the version number of the FPGA a [ch] read ADC value from channel ch0-7 a      dump all ADC  channel values S [ch] [s,m] set channel ch[1,2] to mode [s,m] (servo or motor mode) S [ch] returns the servo mode status of channel [ch] s [ch] [val] set servo channel ch [1,2] to angle val [0.0-180.0, floating point] e [val] set servo pulse period to [val] microseconds (integer only) e     get servo pulse period m [ch] [cmd] motor command for channel ch1-4. cmd = [f,r,s] -> forward, reverse, stop M [xxxx] set motor channel [1234] to respective states [f,r,s,x] (x means don't change) p [ch] [dc] PWM duty cycle for channel ch1-4 and duty cycle dc0-255 P [div] set PWM divider (div = 0-65535, rate = 101.5kHz / (div + 2)) f [freq] set motor PWM to frequency [freq] Hz u [val] set digital output to value val u [ch] [val] set digital output bit [ch] to value [val] i      print the value of the digital inputs i [ch] print the value of channel [ch] d      dump the control set registers (raw values) d [adr] dump the the raw value at [adr] w [adr] [dat] write data [dat] to address [adr] D [tst] detect if the motor controller board is attached using test value [tst]. A      auto-detect if motor controller board is attached. n      return device serial number

Load motor firmware
Motor firmware needs to be first loaded to FPGA to enable motor board features. To check if motor firmware is currently loaded. mot_ctl V If a single number is returned, eg. 139, it means the motor firmware is currently loaded. Otherwise, a long string is returned. root@chumby-silvermoon-netv:~# mot_ctl V FPGA is not configured to drive a motor board, please follow this procedure: 1. Make sure the HDMI input is connected to the motor board. Do not connect an HDMI device to the port! We are not liable for damages if you wire this up wrong. 2. Issue the command '/etc/init.d/netv_service motor'; this will switch the NeTV into motor driver mode. Perform just that to load motor firmware to FPGA. /etc/init.d/netv_service motor

HTTP API
A demo page showing all capabilities of the motor board is available at http://10.0.88.1/html_motor/ It is recommended to try this page from a computer as the UI is heavily implemented with jQueryUI. Most features are implemented with NeCommand HTTP API calling  command above. However, some features such as the sliders controlling motor speed & PWM frequency are implemented using Motor HTTP API for better efficiency.

JavaScript library
All motor board features are encapsulated in a single stand_alone JS file at http://10.0.88.1/html_motor/js/utils_motor.js or /usr/share/netvserver/docroot/html_motor/js/utils_motor.js It is self-explainatory through comments. Feel free to include or copy this file to your project folder if you are developing your own UI for motor board.