Skip to content
K Wilson edited this page Aug 25, 2014 · 21 revisions

Fetch Commands

“An Artificially Intelligent System would be much taller." - Anonymous Product Developer

Constructing a Command

Commands are read from left to right. In this direction they also read from general to specific. In the example:

gpio:clear:porth:pin2

The most general part of the command is the gpio.

If we think about a command as a sentence, gpio would be the object and the rest of the sentence would be a story about the gpio.

We can also think about constructing commands as traversing a hierarchy from general to specific. For instance from a prompt we have these choices:

Fetch Command

Picking the GPIO choice opens up all the choices for GPIO type commands.

Fetch Command

We can build a command to configure portb pin3 as an output with a pullup by traversing increasingly specific commands...until we can go no farther.

Fetch Command

Administrative Commands

resetpins

  • Reset the state of the pins to defaults.

help

  • Print help about the commands available.

heartbeat_toggle

  • Toggles an LED heartbeat display on the device.
  • Currently uses four (4) LEDs as demonstration
  • Discussion needed
    • Should new commands be added to assign HB pins?
LED PIN
LED1 PH2
LED2 PH3
LED3 PI8
LED4 PI10

version

  • Print the version of the firmware installed.

GPIO - General Purpose Input Output Pins

Fetch Command

Usage, please see example above.

get

Get the current value of the pin {0,1} from the input buffer.

set

Set the value of the pin {0,1}. This will write the output buffer to HIGH (0b1).

clear

Clear the output buffer -- That is a LOW (0b0) will be written to the output buffer.

query

Report how pin is assigned.

configure

Configure the buffer. Output, input and gain settings.

ADC - Analog to Digital Conversion

Fetch Command

conf_adc1

Configure the ADC1 peripheral.

start

Start a conversion. (see oneshot and continuous)

stop

Stop a conversion. (see oneshot and continuous)

profile

Set a profile for the peripheral. Profiles include:

  • default:

    • One pin sampled (ADC1 IN13) for 56 cycles x 10 samples. Average reported.
  • PA: 16 Channels - All available channels for Waveshare (This includes Temp, VBAT, VRefInt).

Channel Pin Cycles Samples Report
IN0 gpioA pin0 56 1 average
IN1 gpioA pin1 56 1 average
IN2 gpioA pin2 56 1 average
IN3 gpioA pin3 56 1 average
IN4 gpioA pin4 56 1 average
IN5 gpioA pin5 56 1 average
IN6 gpioA pin6 56 1 average
IN7 gpioA pin7 56 1 average
IN8 gpioB pin0 56 1 average
IN10 gpioC pin0 56 1 average
IN13 gpioC pin3 56 1 average
IN14 gpioC pin4 56 1 average
IN15 gpioC pin5 56 1 average
IN16 Temp 56 1 C
IN17 VRefInt 56 1 average
IN18 VBattery 56 1 average
adc:conf_adc1:profile:pa
adc:conf_adc1:oneshot
adc:start
U32:time:36255
U32:adc:1439340,730135,416185,140875,132825,350175,309120,522445,473340,341320,1395870,787290,1408750,24,1205890,1669570
adc:start
U32:time:36456
U32:adc:1439340,827540,460460,148120,131215,355810,331660,530495,490245,363860,1396675,848470,1407945,24,1206695,1670375

adc:conf_adc1:profile:default
adc:conf_adc1:oneshot
adc:start
U32:time:37058
U32:adc:1420825
  • PB: TBD

Profiles simplify configuration of complex peripherals like the ADC. It also helps to consistently configure a base setting.

Profiles contain information for:

  • Reference Voltage (on Vref+ pin) relative to VSS.
  • Input Pin(s) for conversion.
  • Analog GPIO mode for conversion pins.
  • Scan settings for multiple pins and DMA modes.
  • Data output format after conversion.
    • For instance: Data may be delivered in raw or converted forms

The idea of profiles is still under active development Thu 31 July 2014 16:35:48 (PDT).

oneshot

Complete one conversion of input pin(s) and return the result.

continuous

Begin a new conversion as soon as previous conversion has completed and the output has been delivered to the serial connection.

reset

Reset the ADC to the default profile.

default, PA, PB

Available profiles to be documented ... Thu 31 July 2014 16:38:12 (PDT)

(mv)

mV - Value in millivolts of Vref+. This is set by external circuitry and used to convert raw values to voltages.

Example vref_mv

Fetch ADC vref_mv Command

Example profile

Fetch ADC Profile Command

DAC - Digital to Analog Conversion

Fetch DAC_Command

Fetch DAC Example

Notes

DAC Channel connection are shared with ADC.

Pin Connections

Channel Pin
CH1 gpioA pin4
CH2 gpioA pin5

start

  • Start a DAC conversion (enable outputs).

stop

  • Stop the DAC conversion.

release

  • Stop the DAC conversion and release the assigned pins to their default mode.

reset

  • Reset the DAC to default values and vref_mv.

vref_mv

  • Set the vref_mv.

conf_ch1

  • Configure Channel 1 of the DAC

conf_ch2

  • Configure Channel 2 of the DAC

dc_mv

  • Minimum setting is 0, negative values will fail.
    • Maximum setting is vref_mv, a setting greater than this will be output vref_mv.

SPI - Serial Peripheral Interface

  • Not yet available Thu 31 July 2014 16:40:49 (PDT)

I2C

  • Not yet available Thu 31 July 2014 16:40:49 (PDT)

Back To Home