element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Atmel Xplained Boards
  • Products
  • Dev Tools
  • Atmel Xplained Boards
  • More
  • Cancel
Atmel Xplained Boards
Forum SAMA5D4 ADC driver - do you know a Linux image that has the driver?
  • Blog
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Atmel Xplained Boards requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 11 replies
  • Answers 1 answer
  • Subscribers 4 subscribers
  • Views 472 views
  • Users 0 members are here
Related

SAMA5D4 ADC driver - do you know a Linux image that has the driver?

Jan Cumps
Jan Cumps over 7 years ago

For the Enchanted Objects Design ChallengeI'm trying to get the ADC Hardware Trigger mechanism working.


I have difficulties with the ADC driver. I am unsure if the 4.7 and 4.6 linux Yocto Poky images have that driver installed.


I have 3 questions :


Is the ADC driver for the sama5d4 included in those Yocto Poky images?

If yes, what's the name of the driver (is it at91_adc)?

If no, is there an image around with the ADC included, or is there a way to get the driver installed on my board running that Yocto Poky image?

 

Here's the blog post that shows what I'm dong: Review 9b: Atmel SMART SAMA5D4 Xplained Ultra - Set up ADC Buffer with Hardware Trigger Part 2

 

I have issues when the buffer read tool generic_buffer tries to load the driver:

 

Here's where the code fails:

 

    /* Find the device requested */  
    dev_num = find_type_by_name(device_name, "device");  
    if (dev_num < 0) {  
        printf("Failed to find the %s\n", device_name);  
        ret = -ENODEV;  
        goto error_ret;  
    }  
    printf("iio device number being used is %d\n", dev_num); 

 

Error

Failed to find the at91_adc

  • Reply
  • Cancel
  • Cancel

Top Replies

  • noglitch
    noglitch over 7 years ago in reply to Jan Cumps +1 suggested

    Hi,

     

    Due to move to DT, the device name has changed. It is now "fc034000.adc" for this device. So, your command line should be:

    ./generic_buffer -n fc034000.adc -t fc034000.adc-dev0-continuous …

  • noglitch
    noglitch over 7 years ago +1 verified

    FYI, I've just updated the Linux4SAM.org page:

    http://www.at91.com/linux4sam/bin/view/Linux4SAM/IioAdcDriver

    to reflect the changes in naming brought by a Device Tree system.

  • noglitch
    noglitch over 7 years ago in reply to Jan Cumps +1

    Oh thanks for the typo correction.

     

    I use the Linux4SAM 4.7 kernel + rootfs image.

    I took the  generic_buffer.c file in the linux-3.18-at91 kernel and compiled it with a Code Sourcery toolchain (Sourcery CodeBench…

Parents
  • noglitch
    0 noglitch over 7 years ago

    Hi,

     

    Here's a little bit more documentation about this topic:

    IioAdcDriver < Linux4SAM < TWiki

    • Cancel
    • Up 0 Down
    • Reply
    • Verify Answer
    • Cancel
Reply
  • noglitch
    0 noglitch over 7 years ago

    Hi,

     

    Here's a little bit more documentation about this topic:

    IioAdcDriver < Linux4SAM < TWiki

    • Cancel
    • Up 0 Down
    • Reply
    • Verify Answer
    • Cancel
Children
  • Jan Cumps
    0 Jan Cumps over 7 years ago in reply to noglitch

    Hi,

     

    That is the guide that I'm following.

    I managed to run the Software Triggered example without any issue. That just works perfectly.

     

    I'm also trying to run the Hardware Triggerd method of that page.

    All steps from the linux command line work, and I can see that there's data in the /dev/iio:device0 character device when I do cat /dev/iio:device0

     

    But when I try to run the tool generic_buffer (I compiled it from source, as explained under 'Testing the buffer' section on that page), it fails.

     

    I used these commands:

     

    modprobe at91_adc
    echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage0_en
    echo "fc034000.adc-dev0-continuous" > /sys/bus/iio/devices/iio:device0/trigger/current_trigger
    echo 100 > /sys/bus/iio/devices/iio:device0/buffer/length
    echo 1 > /sys/bus/iio/devices/iio:device0/buffer/enable

     

    When I run the self-compiled generic_buffer test tool, it fails when trying to find the device by the name 'at91_adc'

     

    ./generic_buffer -n at91_adc -t fc034000.adc-dev0-continuous -l 2

     

    Errors with 'Failed to find the at91_adc '.

     

    I'm not running from my own compiled distro , but have tried this process on the following two downloaded images:

    linux4sam-poky-sama5d4_xplained_hdmi-4.6

    and the new

    linux4sam-poky-sama5d4_xplained-4.7

    • Cancel
    • Up 0 Down
    • Reply
    • Verify Answer
    • Cancel
  • noglitch
    0 noglitch over 7 years ago in reply to Jan Cumps

    Hi,

     

    Due to move to DT, the device name has changed. It is now "fc034000.adc" for this device. So, your command line should be:

    ./generic_buffer -n fc034000.adc -t fc034000.adc-dev0-continuous -l 2

     

    It seems to work on my side:

    root@sama5d4-xplained:~# ./generic_buffer -n fc034000.adc -t fc034000.adc-dev0-continuous -l 2
    iio device number being used is 0
    iio trigger number being used is 0
    /sys/bus/iio/devices/iio:device0 fc034000.adc-dev0-continuous
    281.000000 
    280.000000 
    274.000000 
    274.000000

    • Cancel
    • Up +1 Down
    • Reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Jan Cumps
    0 Jan Cumps over 7 years ago in reply to noglitch

    Hi,

     

    I did try that,

    Your output is what I was expecting at my side too. I get a failure (using the 4.7.zip image at the moment)

     

    root@sama5d4-xplained:~# dmesg | grep  iio

    [    2.460000] iio iio:device0: Resolution used: 10 bits

    [    2.460000] iio iio:device0: ADC Touch screen is disabled.

     

     

     

    root@sama5d4-xplained:~# ./generic_buffer -n fc034000.adc -t fc034000.adc-dev0-continuous -l 2

    Failed to find the fc034000.adc

    • Cancel
    • Up 0 Down
    • Reply
    • Verify Answer
    • Cancel
Element14

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2022 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube