ADC can’t exceed the maximum sample rate of 50kSa/s using libiio

Forums Reference, Evaluation, and Development Boards OSD32MP1-BRK ADC can’t exceed the maximum sample rate of 50kSa/s using libiio

Viewing 0 reply threads
  • Author
    Posts
    • #15186
      JakubJakub
      Participant

      Hello,

      I am experiencing an issue with a low ADC sample rate when using triggered buffered mode. Although I have set sufficient values in the IIO user space interface, the actual sample rate cannot exceed 50 kSa/s, regardless of what I try. I use Linux 5.15 kirkstone with this device tree:

      https://github.com/jromanki/meta-octavo-osd32mp1/blob/kirkstone/recipes-kernel/linux/files/0023-Add-Device-Tree-support-for-OSD32MP1-BRK.patch

      And after startup these properties are edited:

      echo 0 > /sys/bus/platform/devices/44000000.timer:pwm/pwm/pwmchip10/export
      echo 10000 > /sys/bus/platform/devices/44000000.timer:pwm/pwm/pwmchip10/pwm0/period
      echo 5000 > /sys/bus/platform/devices/44000000.timer:pwm/pwm/pwmchip10/pwm0/duty_cycle
      echo 100000 > /sys/bus/iio/devices/trigger0/sampling_frequency
      echo 1 > /sys/bus/platform/devices/44000000.timer:pwm/pwm/pwmchip10/pwm0/enable

      echo “tim1_trgo” > /sys/bus/iio/devices/iio\:device1/trigger/current_trigger
      echo 1 > /sys/bus/iio/devices/iio\:device1/scan_elements/in_voltage0_en
      echo 1 > /sys/bus/iio/devices/iio\:device1/scan_elements/in_voltage1_en

      echo 4096 > /sys/bus/iio/devices/iio\:device1/buffer/length
      echo 2048 > /sys/bus/iio/devices/iio\:device1/buffer/watermark
      echo 1 > /sys/bus/iio/devices/iio\:device1/buffer/enable

      Here is my output of the iio_info command:

      Library version: 0.23 (git tag: 92d6a35)
      Compiled with backends: local xml ip usb serial
      IIO context created with local backend.
      Backend version: 0.23 (git tag: 92d6a35)
      Backend description string: Linux osd32mp1-brk 5.15.24 #1 SMP PREEMPT Wed Feb 16 11:56:41 UTC 2022 armv7l
      IIO context has 2 attributes:
      local,kernel: 5.15.24
      uri: local:
      IIO context has 8 devices:
      iio:device0: 44000000.timer:timer@0
      1 channels found:
      count0:  (input)
      8 channel-specific attributes found:
      attr  0: en value: 1
      attr  1: enable_mode value: always
      attr  2: enable_mode_available value: always gated triggered
      attr  3: preset value: 2087
      attr  4: raw value: 831
      attr  5: scale value: 1.000000000
      attr  6: trigger_mode ERROR: Invalid argument (22)
      attr  7: trigger_mode_available value: trigger
      ERROR: checking for trigger : Input/output error (5)
      iio:device1: 48003000.adc:adc@0 (buffer capable)
      2 channels found:
      voltage0:  (input, index: 0, format: le:U16/16>>0)
      3 channel-specific attributes found:
      attr  0: offset value: 0
      attr  1: raw ERROR: Device or resource busy (16)
      attr  2: scale value: 0.044250488
      voltage1:  (input, index: 1, format: le:U16/16>>0)
      3 channel-specific attributes found:
      attr  0: offset value: 0
      attr  1: raw ERROR: Device or resource busy (16)
      attr  2: scale value: 0.044250488
      2 device-specific attributes found:
      attr  0: trigger_polarity value: rising-edge
      attr  1: trigger_polarity_available value: rising-edge falling-edge both-edges
      2 buffer-specific attributes found:
      attr  0: data_available value: 4096
      attr  1: watermark value: 2048
      7 debug attributes found:
      debug attr  0: lincalfact6 value: 509
      debug attr  1: lincalfact5 value: 540542463
      debug attr  2: lincalfact4 value: 538446337
      debug attr  3: lincalfact3 value: 537392635
      debug attr  4: lincalfact2 value: 541593087
      debug attr  5: lincalfact1 value: 540542465
      debug attr  6: direct_reg_access value: 0x100A
      Current trigger: trigger0(tim1_trgo)
      trigger0: tim1_trgo
      0 channels found:
      3 device-specific attributes found:
      attr  0: master_mode value: update
      attr  1: master_mode_available value: reset enable update compare_pulse OC1REF OC2REF OC3REF OC4REF
      attr  2: sampling_frequency value: 100037
      No trigger on this device
      trigger1: tim1_trgo2
      0 channels found:
      3 device-specific attributes found:
      attr  0: master_mode value: reset
      attr  1: master_mode_available value: reset enable update compare_pulse OC1REF OC2REF OC3REF OC4REF OC5REF OC6REF compare_pulse_OC4REF compare_pulse_OC6REF compare_pulse_OC4REF_r_or_OC6REF_r compare_pulse_OC4REF_r_or_OC6REF_f compare_pulse_OC5REF_r_or_OC6REF_r compare_pulse_OC5REF_r_or_OC6REF_f
      attr  2: sampling_frequency value: 100037
      No trigger on this device
      trigger2: tim1_ch1
      0 channels found:
      No trigger on this device
      trigger3: tim1_ch2
      0 channels found:
      No trigger on this device
      trigger4: tim1_ch3
      0 channels found:
      No trigger on this device
      trigger5: tim1_ch4
      0 channels found:
      No trigger on this device

      Despite these efforts, the sampling rate still cannot exceed 50 kSa/s when tested with a signal generator. Do you have any suggestions as to why this might be the case? Thanks in advance.

      Best Regards,

      jromanki

Viewing 0 reply threads
  • You must be logged in to reply to this topic.
chatsimple