2021年8月8日 星期日

AM335x ADC

AM335x 有 8-channel ADC,可支援 4/5/8-線電阻式觸控。

  • 8 類比輸入 AN0~AN7 (≤1.8V),VDDA_ADC (1.8V),VSSA_ADC (GND),VREFN,VREFP
  • ADC 是 12-Bit 的 Successive Approximation Register (SAR) ADC
  • ADC 時脈最快 24MHz。
  • 每個 ADC 轉換至少需要 15 ADC 時脈,包括 1x Sample Delay (SOC)、1x 取樣、12x Digitize、和 1x EOC。
  • 取樣率?200K Samples per Second (24M = 15 x 8 x 200K ?)
  • 輸入選自 8 類比輸入的多工。
  • 整體運作是由一些 sequencer 達成,包括平常沒事在 idle,和 16 個 ADC 步驟、佮一個 touchscreen 充電步驟。
  • 每個步驟 (包括 idle) 可設定個別 AFE 訊號,包括 single-ended 或 differential、RFM/INP/INM/RFP 選擇、WPN/YPN/XNP/YNN/YPP/XNN/XPP 狀態。
  • 每個 ADC 步驟和充電步驟各自可以設定是否啟動,和 Open Delay。
  • 每個 ADC 步驟可轉換一個 channel,可設定 Sample Delay、是否範圍檢查、使用 FIFO 0 或 FIFO 1、是否 Average 1/2/4/8/16、SW 或 HW、和 One-shot 或 Continuous。
  • Programmable FSM sequencer。
    • Software register bit for start of conversion
    • Optional start of conversion HW synchronized to Pen touch or external HW event (but not both)
    • Single conversion (one-shot) 或 Continuous conversions
    • Sequence through all input channels based on a mask
    • Programmable OpenDelay before sampling each channel
    • Programmable sampling delay for each channel
    • Programmable averaging of input samples - 16/8/4/2/1
    • Differential or singled ended mode setting for each channel
    • Store data in either of two FIFO groups
    • Option to encode channel number with data
    • Support for servicing FIFOs via DMA or CPU
    • Programmable DMA Request event (for each FIFO)
    • Dynamically enable or disable channel inputs during operation
    • Stop bit to end conversion
  • Support for the following interrupts and status, with masking:
    • Interrupt for HW pen (touch) event
    • Interrupt for HW Pen Up event
    • Interrupt after a sequence of conversions (all non-masked channels)
    • Interrupt for FIFO threshold levels
    • Interrupt if sampled data is out of a programmable range
    • Interrupt for FIFO overflow and underflow conditions
    • Status bit to indicate if ADC is busy converting

參考

  1. AM335x Sitara™ Processors datasheet
  2. AM335x and AMIC110 Sitara™ Processors Technical Reference Manual
  • https://www.teachmemicro.com/beaglebone-black-adc/
  • http://beaglebone.cameon.net/home/reading-the-analog-inputs-adc
  • https://beagleboard.org/static/librobotcontrol/group___a_d_c.html:Robotics Cape 和 BeagleBone Blue 包含兩個 voltage divider 量測 2-cell lithium battery 和 9-18V DC power jack 電壓,分別用 c_adc_batt() 和 rc_adc_dc_jack() 讀取。Robotics Cape 還有 6-pin JST-SH 插座可連結 4 potentiometers 或類比訊號到 AIN。

2021年8月7日 星期六

Successive-approximation ADC

Successive Approximation Register (SAR) ADC 是一種 ADC 作法,結果採二進位搜尋,多次 DAC 回溯比較,逐步縮小範圍確認:

  1. 值先清為 0,並把輸入取樣後維持住,方便後續多次比較。
  2. 最高位元預設為 1,經過 DAC 相當於和 1/2 的位置,如果比較小就清為 0。
  3. 再來次高位元先設為 1,相當於和 1/2 ± 1/4 的位置比較,如果比較小就清為 0。
  4. 再來 1/2 ± 1/4 ± 1/8 位置,... 愈來愈接近。
  5. 如果要輸出 12-bit 的值,總共需要經過 12 次比較後輸出。

優點是省電,缺點是較慢。

2021年7月17日 星期六

Cortex-A72

ARM Cortex-A72 採用 ARMv8-A 64-bit 指令集,3-way decode out-of-order superscalar pipeline,適合作為 SoC 整合 GPU, DSP 等。在 2015 發表,作為 Cortex-A57 後繼者,可節省 20% 電源、或提供多 90% 的效能。

Linux IIO

Linux IIO (Industrial IO) 系統支援的在某方面來說是 ADC/DAC 裝置,包括 Accelerometer、Gyro、IMU、Capacitance to Digital Converter (CDC)、壓力感測、Color, Light and Proximity Sensor、溫度感測、Magnetometers、DDS (Direct Digital Synthesis)、PLL (Phase Locked Loop)、Variable/Programmable Gain Amplifiers (VGA, PGA) 等,彌補 hwmon 和 input 子系統的不足。hwmon 偏向用在風扇速度控制和溫度量測等的低取樣率感測。input 著重在人機互動輸入裝置 -- Keyboard、Mouse、Touch Screen、和搖桿。典型 IIO 裝置是透過 SPI 或 I2C 連結,也包括 DMA 操作的高速同步序列 (McBSP, SPORT) 或並列 (EPI, PPI) 等實作在處理器平台的裝置。

IIO 功能

  • 基本裝置註冊和處理
  • 透過 sysfs polled access
  • Event chrdevs:類似 input 提供 userspace 硬體事件,目前只是一個 polling 存取的事件碼和 timestamp。
  • 支援硬體 ring buffer,有 event chrdev 傳遞類似半滿事件和 access chrdev 讀取資料。
  • 支援 trigger 和軟體 ring buffer (kfifo)

trigger driver

  • iio-trig-gpio Provides support for using GPIO pins as IIO triggers.
  • iio-trig-rtc Provides support for using periodic capable real time clocks as IIO triggers.
  • iio-trig-sysfs Provides support for using SYSFS entry as IIO triggers.
  • iio-trig-bfin-timer Provides support for using a Blackfin timer as IIO triggers.

參考

  1. https://wiki.analog.com/software/linux/docs/iio/iio

2021年7月10日 星期六

sFlow

sFlow (sampled flow) 是 L2 packet export 的工業標準,sFlow Agent 提供兩種取樣:

  1. Flow samples:隨機平均每 n 個封包或 application layer operations 取樣 1 次。
  2. counter samples:週期取樣界面計數器。(界面多時比 SNMP polling 有效率。)

包成 sFlow Datagram 送到 sFlow collector (預設 port 6343) 進行分析和回報。

sFlow Datagram 採用 XDR 格式。

參考
  1. https://en.wikipedia.org/wiki/SFlow
  2. https://datatracker.ietf.org/doc/html/rfc3176

SIP header Via

所有 SIP 訊息 都要有 Via,縮寫 v。一開始的 UAC 和後續途經的每個 proxy 都會疊加一個 Via 放傳送的位址,依序作為回應的路徑。 格式 sent-protocol sent-by [ ;branch= branch ][ ; 參數 ...] s...