This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM3359: CAnnot test ADC on Beaglebone black

Part Number: AM3359

Tool/software: Linux

Goodmorning,

I'm trying to enable the ADC on a Beaglebone black with a standard image following the link . Now I'm trying to read an analog signal following the link:

.

I can load the module using modprobe ti_am335x_adc, not modprobe ti_am335x_adc.ko as written in the guide. I can see it loaded using the command lsmod.

sha512_generic         20480  0                                                 
sha512_arm             24576  0                                                 
sha256_generic         20480  0                                                 
sha1_generic           16384  0                                                 
sha1_arm_neon          20480  0                                                 
sha1_arm               16384  1 sha1_arm_neon                                   
md5                    16384  0                                                 
aes_arm_bs             20480  0                                                 
crypto_simd            16384  1 aes_arm_bs                                      
cryptd                 24576  1 crypto_simd                                     
des_generic            28672  0                                                 
cbc                    16384  0                                                 
xfrm_user              32768  2                                                 
xfrm4_tunnel           16384  0                                                 
ipcomp                 16384  0                                                 
xfrm_ipcomp            16384  1 ipcomp                                          
esp4                   20480  0                                                 
ah4                    16384  0                                                 
af_key                 36864  0                                                 
xfrm_algo              16384  5 xfrm_user,esp4,ah4,af_key,xfrm_ipcomp           
ti_am335x_adc          16384  0                                                 
ti_am335x_tscadc       16384  1 ti_am335x_adc                                   
usbhid                 28672  0                                                 
pru_rproc              20480  0                                                 
pruss_intc             16384  1 pru_rproc                                       
pruss                  16384  1 pru_rproc                                       
usb_f_acm              16384  1                                                 
u_serial               20480  3 usb_f_acm                                       
usb_f_ecm              16384  1                                                 
g_multi                16384  0                                                 
usb_f_mass_storage     40960  2 g_multi                                         
usb_f_rndis            24576  2 g_multi                                         
u_ether                20480  3 usb_f_ecm,g_multi,usb_f_rndis                   
libcomposite           53248  5 usb_f_ecm,usb_f_acm,usb_f_mass_storage,g_multi,s
musb_dsps              20480  0                                                 
musb_hdrc              98304  1 musb_dsps                                       
udc_core               28672  8 usb_f_ecm,usb_f_acm,usb_f_mass_storage,u_seriale
phy_am335x             16384  2                                                 
phy_generic            16384  1 phy_am335x                                      
phy_am335x_control     16384  1 phy_am335x                                      
bc_example             16384  0                                                 
snd_soc_simple_card    16384  0                                                 
snd_soc_simple_card_utils    16384  1 snd_soc_simple_card                       
pm33xx                 16384  0                                                 
wkup_m3_rproc          16384  1                                                 
wkup_m3_ipc            16384  1 pm33xx                                          
remoteproc             40960  3 pru_rproc,wkup_m3_rproc,wkup_m3_ipc             
omap_aes_driver        24576  0                                                 
pvrsrvkm              413696  3 bc_example                                      
crypto_engine          16384  1 omap_aes_driver                                 
omap_crypto            16384  1 omap_aes_driver                                 
omap_sham              28672  0                                                 
ti_emif_sram           16384  1 pm33xx                                          
pruss_soc_bus          16384  0                                                 
at24                   16384  0                                                 
musb_am335x            16384  0                                                 
rtc_omap               20480  2                                                 
omap_wdt               16384  0                                                 
sch_fq_codel           20480  3                                                 
uio_module_drv         16384  0                                                 
uio                    20480  1 uio_module_drv                                  
ftdi_sio               40960  0                                                 
usbserial              36864  1 ftdi_sio                                        
usbcore               204800  4 usbhid,ftdi_sio,musb_hdrc,usbserial             
usb_common             16384  6 phy_am335x,udc_core,musb_hdrc,libcomposite,musbe
cryptodev              45056  1 

Unfortunately, inside the path /sys/bus/iio/devices there is nothing. I've though that inside am335x-boneblack.dts and its common files, input pins are not configured as analog, so I've made a copy of am335x-boneblack, add the following to the dts as explained in the guide, rebuild kernel, substitute am335x-bone.dtb inside the sdcard, but it's been useless.

&tscadc {
        adc {
                ti,adc-channels = <4 5 6 7>;
        };
};

What could be the reason?

Thank you.

  • Hi,

    This is the correct ADC driver guide: software-dl.ti.com/.../Foundational_Components_Kernel_Drivers.html The wiki link you refer is for older SDK versions.
  • Hello Biser,
    thank you for the answer. I read the new guide, but it's the same as the old one. Have you got any ideas?
    Thank you.
  • Code fixed 2019-01-09

    Hello Luca,

    try doing this:

    &tscadc {
            status = "okay";
            adc {
                    ti,adc-channels = <4 5 6 7>;
            };
    };

    The adc is disabled by default in one of the dtsi files that your dts file includes. It looks like I need to update the adc documentation, thanks for pointing this out.

    Regards,

    Nick

  • Hello Nick, thank for your suggestion. I tried to add status = "okay"; but the result doesn't change. In attachment you can find the am335x-boneblack.dts modified file.

    Could it be that uboot dts file needs to be changed as well?

    Thank you for your support

    Luke

    am335x-boneblack.dts.zip

  • Hello Luke,

    No, I would not expect uboot to be related. Could you confirm the steps you are taking to enable ADC in menuconfig when building the kernel?

    Regards,
    Nick
  • Hello Nick,

    thank you for you message. My sdk version is ti-processor-sdk-linux-am335x-evm-05.01.00.11.

    Below the status of my local repository.

    git status
    Sul branch processor-sdk-local
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   arch/arm/boot/dts/am335x-boneblack.dts

    Untracked files:
      (use "git add <file>..." to include in what will be committed)

        arch/arm/boot/dts/am335x-boneblack.dts.old

    no changes added to commit (use "git add" and/or "git commit -a")

    Below the steps that I follow:

    1. export CC=/home/davide/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
    2. sudo make ARCH=arm CROSS_COMPILE=${CC} distclean
    3. sudo make ARCH=arm CROSS_COMPILE=${CC} tisdk_am335x-evm_defconfig
    4. sudo make ARCH=arm CROSS_COMPILE=${CC} menuconfig.
      Here I want to build ti_am335x_adc as a loadable module, hence the only change that I do concerns [M] Industrial I/O support as a loadable module, as described in the guide.
    5. sudo make ARCH=arm CROSS_COMPILE=${CC} zImage
    6. sudo make ARCH=arm CROSS_COMPILE=${CC} am335x-boneblack.dtb
    7. sudo make ARCH=arm CROSS_COMPILE=${CC} modules
    8. sudo cp arch/arm/boot/zImage /media/davide/rootfs/boot/
    9. sudo cp arch/arm/boot/dts/am335x-boneblack.dtb /media/davide/rootfs/boot/
    10. sudo make ARCH=arm INSTALL_MOD_PATH=/media/davide/rootfs modules_install
    11. Insert the sdcard in Beaglebone and boot
    12. modprobe ti_am335x_adc
      For enabling the module, which is confirmed using lsmod
    13. In the path /sys/bus/iio/devices/, there is nothing.

    In attachment you can find the .config modified that I used.

    Thank you very much for your support.

    Luke

  • Hello Luca,

    I can replicate your results, but I have not had time to dig into it much.

    * ti_am335x_adc.ko does exist in my SD card at /lib/modules/4.14.67-gd315a9bb00/kernel/drivers/iio/adc/ti_am335x_adc.ko.
    * It also has entries in /lib/modules/4.14.67-gd315a9bb00/modules.dep
    * insmod results in unknown symbol errors

    Regards,
    Nick
  • Hello Nick, thank you for your answer. It doesn't solve the problem but at least you reassured me.
    Luckily enough, in this moment it's not an high priority topic for me , so I can wait for a solution, maybe with the next sdk release.
    The only thing that I ask you is if you can warn people in charge for the next release about this problem.
    Thank you for your cooperation.

    Best regards and merry Christmas,
    Davide Brunelli
  • Hello Luke and Davide,

    I would like to apologize, I gave you incorrect information in my first post. Please update your device tree file to

    &tscadc {
            status = "okay";
            adc {
                    ti,adc-channels = <4 5 6 7>;
            };
    };

    I have updated my previous post.

    Regards,

    Nick

  • Hello Nick,

    sorry for the delay, but I saw the message only today.

    I've tried the new setting and now I get the following at boot:

    [   28.123645] ti_am335x_adc: Unknown symbol iio_push_to_buffers (err 0)                                                          

    [   28.130177] ti_am335x_adc: Unknown symbol iio_kfifo_free (err 0)                                                                

    [   28.337993] ti_am335x_adc: Unknown symbol iio_device_attach_buffer (err 0)                                                      

    [   28.650916] ti_am335x_adc: Unknown symbol devm_iio_device_alloc (err 0)                                                        

    [   28.657625] ti_am335x_adc: Unknown symbol iio_device_unregister (err 0)                                                        

    [   28.710886] ti_am335x_adc: Unknown symbol iio_device_register (err 0)                                                          

    [   28.717423] ti_am335x_adc: Unknown symbol iio_kfifo_allocate (err 0)                                                            

    [   28.758576] ti_am335x_adc: Unknown symbol iio_push_to_buffers (err 0)                                                          

    [   28.790888] ti_am335x_adc: Unknown symbol iio_kfifo_free (err 0)                                                                

    [   28.796967] ti_am335x_adc: Unknown symbol iio_device_attach_buffer (err 0)                                                      

    [   28.841397] ti_am335x_adc: Unknown symbol devm_iio_device_alloc (err 0)                                                        

    [   28.848110] ti_am335x_adc: Unknown symbol iio_device_unregister (err 0)                                                        

    [   28.880890] ti_am335x_adc: Unknown symbol iio_device_register (err 0)                                                          

    [   28.887425] ti_am335x_adc: Unknown symbol iio_kfifo_allocate (err 0)

    What could be the most likely problem?

    In attachment you can find both device tree and kernel .config used.

    7382.kernelConfig.txt

    /*
     * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License version 2 as
     * published by the Free Software Foundation.
     */
    /dts-v1/;
    
    #include "am33xx.dtsi"
    #include "am335x-bone-common.dtsi"
    #include "am335x-boneblack-common.dtsi"
    
    &sgx {
    	status = "okay";
    };
    
    / {
    	model = "TI AM335x BeagleBone Black";
    	compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
    };
    
    &cpu0_opp_table {
    	/*
    	 * All PG 2.0 silicon may not support 1GHz but some of the early
    	 * BeagleBone Blacks have PG 2.0 silicon which is guaranteed
    	 * to support 1GHz OPP so enable it for PG 2.0 on this board.
    	 */
    	oppnitro-1000000000 {
    		opp-supported-hw = <0x06 0x0100>;
    	};
    };
    
    &tscadc {
            status = "okay";
            adc {
                    ti,adc-channels = <4 5 6 7>;
            };
    };
    

    Thank you.

    Best Regards,

    Luke

  • Hello Luke,

    Your kernel config and device tree files looks how I would expect them to. The IIO, adc/touchscreen chip support, and ti_am335x_adc all look like they are in the kernel config. I am able to observe /sys/bus/iio/devices/iio\:device0 when I create loadable kernel modules in Linux SDK 5.1.

    You are installing the modules after you build them, right?

    Regards,
    Nick
  • Hello Nick,
    it works! I repeated the procedure and now it's ok.

    Thank very much you for your support.
    Best Regards,
    Davide Brunelli