hi , I have project with mini6410 4.3"LCD { uname -a = Linux FriendlyARM 2.6.28.6-FriendlyARM #4 Fri Sep 17 12:14:33 HKT 2010 armv6l unknown } { project is ecg program. I designed interface with qt in c++ and my group friends made two sensors that are ecg (get heart pulse rate) and temperature(get the body emperature). We connect these sensors on PIN27-PIN28(COM6--signal AIN1-AIN2) (analog input) } After , I think firstly Analog Device Converter is invoked than 2 hexadecimal datas (that are generated by ADC ) are writing on registers. Than , I must read these datas. my /dev folder is = *************************************************************************** audio s3c-pp tty46 backlight s3c-rotator tty47 buttons shm tty48 console timer tty49 controlC0 touchscreen tty5 cpu_dma_latency tty tty50 dsp tty0 tty51 fb0 tty1 tty52 fb1 tty10 tty53 fb2 tty11 tty54 fb3 tty12 tty55 full tty13 tty56 i2c tty14 tty57 input tty15 tty58 kmsg tty16 tty59 leds tty17 tty6 log tty18 tty60 loop tty19 tty61 mem tty2 tty62 mixer tty20 tty63 mtd0 tty21 tty7 mtd0ro tty22 tty8 mtd1 tty23 tty9 mtd1ro tty24 ttySAC0 mtd2 tty25 ttySAC1 mtd2ro tty26 ttySAC2 mtdblock0 tty27 ttySAC3 mtdblock1 tty28 ubi_ctrl mtdblock2 tty29 urandom network_latency tty3 usbdev1.1 network_throughput tty30 usbdev1.1_ep00 null tty31 usbdev1.1_ep81 pcmC0D0c tty32 vcs pcmC0D0p tty33 vcs1 ppp tty34 vcs2 ptmx tty35 vcs3 pts tty36 vcs4 pwm tty37 vcsa random tty38 vcsa1 root tty39 vcsa2 rtc tty4 vcsa3 rtc0 tty40 vcsa4 s3c-cmm tty41 video0 s3c-g2d tty42 video1 s3c-g3d tty43 video14 s3c-jpg tty44 watchdog s3c-mfc tty45 zero *************************************************************************** However :) I don't know how invoke ADC , how read these registers and these register addresses :D if you know solution , have source code in c/c++ , register addresses , know how invoke adc in mini6410 with c/c++ , know reading registers or have any suggestion , please help me in a short time :D (I have a time problem because of deadline ) :) ps : in my /dev folder , I dont have adc. I dont have mini6410_adc.c files and drivers/char folder in my mini6410 . :/ ps 2 : I have to use analog input for sensors :) do anybody know anything else about this topic ??????? best regards ,
Analog input (ADC)
I know how ADCs work on 8bit platforms. I have not used the ADC on the Samsung 32bit devices. Using the ADC on the mini6410 should not be much (if any) different than the mini2440. Search <mini2440 adc> here and on Google. There are many other sites that have done ADC work on these devices. Good luck!
Hello, I have a similar problem. It may works if you generate the adc device node by yourself. But I still don't know with which values this should work. Can you post the output from "ls -lsa /dev" ?? Greets
hi , dear _mx_ , I dont know how I generate the adc device node :( my " ls -lsa /dev " is ; *************************************************************************** 0 drwxr-xr-x 7 root root 0 May 4 12:12 . 2 drwxr-xr-x 1 root root 2048 Sep 15 2010 .. 0 crw-rw---- 1 root root 14, 4 May 4 2011 audio 0 crw-rw---- 1 root root 10, 63 May 4 2011 backlight 0 crw-rw---- 1 root root 10, 61 May 4 2011 buttons 0 crw-rw---- 1 root root 5, 1 May 4 12:12 console 0 crw-rw---- 1 root root 116, 0 May 4 2011 controlC0 0 crw-rw---- 1 root root 10, 58 May 4 2011 cpu_dma_latency 0 crw-rw---- 1 root root 14, 3 May 4 2011 dsp 0 crw-rw-rw- 1 root root 29, 0 May 4 2011 fb0 0 crw-rw-rw- 1 root root 29, 1 May 4 2011 fb1 0 crw-rw-rw- 1 root root 29, 2 May 4 2011 fb2 0 crw-rw-rw- 1 root root 29, 3 May 4 2011 fb3 0 crw-rw-rw- 1 root root 1, 7 May 4 2011 full 0 drwxr-xr-x 2 root root 0 May 4 2011 i2c 0 drwxr-xr-x 2 root root 0 May 4 2011 input 0 crw-rw---- 1 root root 1, 11 May 4 2011 kmsg 0 crw-rw---- 1 root root 10, 62 May 4 2011 leds 0 srw-rw-rw- 1 root root 0 May 4 12:12 log 0 drwxr-xr-x 2 root root 0 May 4 2011 loop 0 crw-rw---- 1 root root 1, 1 May 4 2011 mem 0 crw-rw---- 1 root root 14, 0 May 4 2011 mixer 0 crw-rw---- 1 root root 90, 0 May 4 2011 mtd0 0 crw-rw---- 1 root root 90, 1 May 4 2011 mtd0ro 0 crw-rw---- 1 root root 90, 2 May 4 2011 mtd1 0 crw-rw---- 1 root root 90, 3 May 4 2011 mtd1ro 0 crw-rw---- 1 root root 90, 4 May 4 2011 mtd2 0 crw-rw---- 1 root root 90, 5 May 4 2011 mtd2ro 0 brw-rw---- 1 root root 31, 0 May 4 2011 mtdblock0 0 brw-rw---- 1 root root 31, 1 May 4 2011 mtdblock1 0 brw-rw---- 1 root root 31, 2 May 4 2011 mtdblock2 0 crw-rw---- 1 root root 10, 57 May 4 2011 network_latency 0 crw-rw---- 1 root root 10, 56 May 4 2011 network_throughput 0 crw-rw-rw- 1 root root 1, 3 May 4 2011 null 0 crw-rw---- 1 root root 116, 24 May 4 2011 pcmC0D0c 0 crw-rw---- 1 root root 116, 16 May 4 2011 pcmC0D0p 0 crw-rw---- 1 root root 108, 0 May 4 2011 ppp 0 crw-rw-rw- 1 root root 5, 2 May 4 12:15 ptmx 0 drwxr-xr-x 2 root root 0 Jan 1 1970 pts 0 crw-rw---- 1 root root 10, 60 May 4 2011 pwm 0 crw-rw-rw- 1 root root 1, 8 May 4 2011 random 0 lrwxrwxrwx 1 root root 9 May 4 2011 root -> mtdblock2 0 crw-r--r-- 1 root root 254, 0 May 4 2011 rtc 0 lrwxrwxrwx 1 root root 3 May 4 2011 rtc0 -> rtc 0 crw-rw---- 1 root root 10, 250 May 4 2011 s3c-cmm 0 crw-rw---- 1 root root 10, 220 May 4 2011 s3c-g2d 0 crw-rw---- 1 root root 10, 249 May 4 2011 s3c-g3d 0 crw-rw---- 1 root root 10, 254 May 4 2011 s3c-jpg 0 crw-rw---- 1 root root 10, 252 May 4 2011 s3c-mfc 0 crw-rw---- 1 root root 10, 253 May 4 2011 s3c-pp 0 crw-rw---- 1 root root 10, 230 May 4 2011 s3c-rotator 0 brw-rw---- 1 root root 8, 0 May 4 12:12 sda 0 crw-rw---- 1 root root 21, 0 May 4 12:12 sg0 0 drwxrwxrwt 2 root root 40 May 4 2011 shm 0 crw-rw---- 1 root root 116, 33 May 4 2011 timer 0 crw-rw---- 1 root root 10, 180 May 4 2011 touchscreen 0 crw-rw-rw- 1 root root 5, 0 May 4 2011 tty 0 crw-rw---- 1 root tty 4, 0 May 4 12:12 tty0 0 crw-rw---- 1 root tty 4, 1 May 4 12:12 tty1 0 crw-rw---- 1 root tty 4, 10 May 4 2011 tty10 0 crw-rw---- 1 root tty 4, 11 May 4 2011 tty11 0 crw-rw---- 1 root tty 4, 12 May 4 2011 tty12 0 crw-rw---- 1 root tty 4, 13 May 4 2011 tty13 0 crw-rw---- 1 root tty 4, 14 May 4 2011 tty14 0 crw-rw---- 1 root tty 4, 15 May 4 2011 tty15 0 crw-rw---- 1 root tty 4, 16 May 4 2011 tty16 0 crw-rw---- 1 root tty 4, 17 May 4 2011 tty17 0 crw-rw---- 1 root tty 4, 18 May 4 2011 tty18 0 crw-rw---- 1 root tty 4, 19 May 4 2011 tty19 0 crw-rw---- 1 root tty 4, 2 May 4 12:12 tty2 0 crw-rw---- 1 root tty 4, 20 May 4 2011 tty20 0 crw-rw---- 1 root tty 4, 21 May 4 2011 tty21 0 crw-rw---- 1 root tty 4, 22 May 4 2011 tty22 0 crw-rw---- 1 root tty 4, 23 May 4 2011 tty23 0 crw-rw---- 1 root tty 4, 24 May 4 2011 tty24 0 crw-rw---- 1 root tty 4, 25 May 4 2011 tty25 0 crw-rw---- 1 root tty 4, 26 May 4 2011 tty26 0 crw-rw---- 1 root tty 4, 27 May 4 2011 tty27 0 crw-rw---- 1 root tty 4, 28 May 4 2011 tty28 0 crw-rw---- 1 root tty 4, 29 May 4 2011 tty29 0 crw-rw---- 1 root tty 4, 3 May 4 12:12 tty3 0 crw-rw---- 1 root tty 4, 30 May 4 2011 tty30 0 crw-rw---- 1 root tty 4, 31 May 4 2011 tty31 0 crw-rw---- 1 root tty 4, 32 May 4 2011 tty32 0 crw-rw---- 1 root tty 4, 33 May 4 2011 tty33 0 crw-rw---- 1 root tty 4, 34 May 4 2011 tty34 0 crw-rw---- 1 root tty 4, 35 May 4 2011 tty35 0 crw-rw---- 1 root tty 4, 36 May 4 2011 tty36 0 crw-rw---- 1 root tty 4, 37 May 4 2011 tty37 0 crw-rw---- 1 root tty 4, 38 May 4 2011 tty38 0 crw-rw---- 1 root tty 4, 39 May 4 2011 tty39 0 crw-rw---- 1 root tty 4, 4 May 4 12:12 tty4 0 crw-rw---- 1 root tty 4, 40 May 4 2011 tty40 0 crw-rw---- 1 root tty 4, 41 May 4 2011 tty41 0 crw-rw---- 1 root tty 4, 42 May 4 2011 tty42 0 crw-rw---- 1 root tty 4, 43 May 4 2011 tty43 0 crw-rw---- 1 root tty 4, 44 May 4 2011 tty44 0 crw-rw---- 1 root tty 4, 45 May 4 2011 tty45 0 crw-rw---- 1 root tty 4, 46 May 4 2011 tty46 0 crw-rw---- 1 root tty 4, 47 May 4 2011 tty47 0 crw-rw---- 1 root tty 4, 48 May 4 2011 tty48 0 crw-rw---- 1 root tty 4, 49 May 4 2011 tty49 0 crw-rw---- 1 root tty 4, 5 May 4 2011 tty5 0 crw-rw---- 1 root tty 4, 50 May 4 2011 tty50 0 crw-rw---- 1 root tty 4, 51 May 4 2011 tty51 0 crw-rw---- 1 root tty 4, 52 May 4 2011 tty52 0 crw-rw---- 1 root tty 4, 53 May 4 2011 tty53 0 crw-rw---- 1 root tty 4, 54 May 4 2011 tty54 0 crw-rw---- 1 root tty 4, 55 May 4 2011 tty55 0 crw-rw---- 1 root tty 4, 56 May 4 2011 tty56 0 crw-rw---- 1 root tty 4, 57 May 4 2011 tty57 0 crw-rw---- 1 root tty 4, 58 May 4 2011 tty58 0 crw-rw---- 1 root tty 4, 59 May 4 2011 tty59 0 crw-rw---- 1 root tty 4, 6 May 4 2011 tty6 0 crw-rw---- 1 root tty 4, 60 May 4 2011 tty60 0 crw-rw---- 1 root tty 4, 61 May 4 2011 tty61 0 crw-rw---- 1 root tty 4, 62 May 4 2011 tty62 0 crw-rw---- 1 root tty 4, 63 May 4 2011 tty63 0 crw-rw---- 1 root tty 4, 7 May 4 2011 tty7 0 crw-rw---- 1 root tty 4, 8 May 4 2011 tty8 0 crw-rw---- 1 root tty 4, 9 May 4 2011 tty9 0 crw-rw-rw- 1 root tty 204, 64 May 4 12:12 ttySAC0 0 crw-rw-rw- 1 root tty 204, 65 May 4 2011 ttySAC1 0 crw-rw-rw- 1 root tty 204, 66 May 4 2011 ttySAC2 0 crw-rw-rw- 1 root tty 204, 67 May 4 2011 ttySAC3 0 crw-rw---- 1 root root 10, 59 May 4 2011 ubi_ctrl 0 brw------- 1 root root 8, 1 May 4 12:12 udisk 0 crw-rw---- 1 root root 1, 9 May 4 2011 urandom 0 crw-rw---- 1 root root 189, 0 May 4 2011 usbdev1.1 0 crw-rw---- 1 root root 253, 1 May 4 2011 usbdev1.1_ep00 0 crw-rw---- 1 root root 253, 0 May 4 2011 usbdev1.1_ep81 0 crw-rw---- 1 root root 189, 1 May 4 2011 usbdev1.2 0 crw-rw---- 1 root root 253, 4 May 4 2011 usbdev1.2_ep00 0 crw-rw---- 1 root root 253, 3 May 4 2011 usbdev1.2_ep02 0 crw-rw---- 1 root root 253, 2 May 4 2011 usbdev1.2_ep81 0 crw-rw---- 1 root root 7, 0 May 4 2011 vcs 0 crw-rw---- 1 root root 7, 1 May 4 12:12 vcs1 0 crw-rw---- 1 root root 7, 2 May 4 12:12 vcs2 0 crw-rw---- 1 root root 7, 3 May 4 12:12 vcs3 0 crw-rw---- 1 root root 7, 4 May 4 12:12 vcs4 0 crw-rw---- 1 root root 7, 128 May 4 2011 vcsa 0 crw-rw---- 1 root root 7, 129 May 4 12:12 vcsa1 0 crw-rw---- 1 root root 7, 130 May 4 12:12 vcsa2 0 crw-rw---- 1 root root 7, 131 May 4 12:12 vcsa3 0 crw-rw---- 1 root root 7, 132 May 4 12:12 vcsa4 0 crw-rw---- 1 root root 81, 0 May 4 2011 video0 0 crw-rw---- 1 root root 81, 1 May 4 2011 video1 0 crw-rw---- 1 root root 81, 14 May 4 2011 video14 0 c...stripped-down
... continued = 0 crw-rw---- 1 root root 10, 130 May 4 2011 watchdog 0 crw-rw-rw- 1 root root 1, 5 May 4 2011 zero ***************************************************************************
Hello, to generate the led device node it works with this: mknod -m 0660 /dev/leds c 10 62 But I don't know the values for the adc. I have the same problem :( Greets
You need to activate the s3c-hwmon driver. But this needs some patches in your kernel. After that you can read all the channels in: root@mini2440:/sys/devices/platform/s3c24xx-adc/s3c-hwmon ls driver in1_input in3_input in5_input in7_input subsystem hwmon in1_label in3_label in5_label in7_label uevent in0_input in2_input in4_input in6_input modalias in0_label in2_label in4_label in6_label power Sorry, no simple solution.
Hi Juergen, Can you please tell me where we can get the patches for the Kernel, if it is already available. Thank you, Nambi
hi , dear _mx_ , firstly thanks for your interest :) I tried mknod -m 0669 /dev/adc c 10 59 and /dev/adc is appeared :) , but when I run this test code = ************************************ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> #include <fcntl.h> #include <linux/fs.h> #include <errno.h> #include <string.h> int main(void) { fprintf(stderr, "press Ctrl-C to stop\n"); int fd = open("/dev/adc", 0); if (fd < 0) { perror("open ADC device:"); return 1; } for(;;) { char buffer[30]; int len = read(fd, buffer, sizeof buffer -1); if (len > 0) { buffer[len] = '\0'; int value = -1; sscanf(buffer, "%d", &value); printf("ADC Value: %d\n", value); } else { perror("read ADC device:"); return 1; } system("sleep 0.2"); } close(fd); } ******************************************* I have this output = press Ctrl-C to stop read ADC device:: Invalid argument :( in that time I did not connect any sensors , so I hope I get this output "ADC Value : -1" , but I had this output : "read ADC device:: Invalid argument" what is the problem ? what do you suggest me ? :/
Hi ocikgel I have replied to one of your previous post that if the respective driver of the ADC is not compiled with the kernel then you will not be able to use the ADC devices. Even if you make the nodes manually, the drivers has to be there. The file i mentioned mini6410_adc.c is in the kernel source code and this file is the driver of the ADC. I am again repeating , you will not find this file in your mini6410 kit, this file is the kernel source code. Regards Vector Institute linuxsupport@vectorindia.org http://www.vectorindia.org
sorry, my mistake try this: mknod -m 0660 /dev/adc c 10 59 may you have to remove your current /dev/adc first After that you can try cat /dev/adc then you should see the adc values of the on board poti (at least on the mini2440, i don't know much about the mini6410) good luck!
Nambi: --- arch/arm/mach-s3c2440/Kconfig | 1 arch/arm/mach-s3c2440/mach-mini2440.c | 50 ++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) Index: linux-2.6.38/arch/arm/mach-s3c2440/mach-mini2440.c =================================================================== --- linux-2.6.38.orig/arch/arm/mach-s3c2440/mach-mini2440.c +++ linux-2.6.38/arch/arm/mach-s3c2440/mach-mini2440.c @@ -57,6 +57,7 @@ #include <plat/clock.h> #include <plat/devs.h> #include <plat/cpu.h> +#include <plat/hwmon.h> #include <sound/s3c24xx_uda134x.h> @@ -544,6 +545,53 @@ static struct s3c2410_ts_mach_info mini2 .oversampling_shift = 0, }; +static struct s3c_hwmon_chcfg mini2440_adc_chcfg[8] = { + { + .name = "AIN0", /* connected to CON4/5 and W1 */ + .mult = 3300, + .div = 1023, + }, { + .name = "AIN1", /* connected to CON4/6 */ + .mult = 3300, + .div = 1023, + }, { + .name = "AIN2", /* connected to CON4/7 */ + .mult = 3300, + .div = 1023, + }, { + .name = "AIN3", /* connected to CON4/8 */ + .mult = 3300, + .div = 1023, + }, { + .name = "TSYM", + .mult = 3300, + .div = 1023, + }, { + .name = "TSYP", + .mult = 3300, + .div = 1023, + }, { + .name = "TSXM", + .mult = 3300, + .div = 1023, + }, { + .name = "TSXP", + .mult = 3300, + .div = 1023, + }, +}; + +static struct s3c_hwmon_pdata mini2440_adc __initdata = { + .in[0] = &mini2440_adc_chcfg[0], + .in[1] = &mini2440_adc_chcfg[1], + .in[2] = &mini2440_adc_chcfg[2], + .in[3] = &mini2440_adc_chcfg[3], + .in[4] = &mini2440_adc_chcfg[4], + .in[5] = &mini2440_adc_chcfg[5], + .in[6] = &mini2440_adc_chcfg[6], + .in[7] = &mini2440_adc_chcfg[6], +}; + static struct platform_device *mini2440_devices[] __initdata = { &s3c_device_ohci, &s3c_device_wdt, @@ -560,6 +608,7 @@ static struct platform_device *mini2440_ &mini2440_audio, &samsung_asoc_dma, &s3c_device_adc, + &s3c_device_hwmon, }; static void __init mini2440_map_io(void) @@ -721,6 +770,7 @@ static void __init mini2440_init(void) s3c_nand_set_platdata(&mini2440_nand_info); s3c_i2c0_set_platdata(NULL); s3c24xx_ts_set_platdata(&mini2440_ts_cfg); + s3c_hwmon_set_platdata(&mini2440_adc); i2c_register_board_info(0, mini2440_i2c_devs, ARRAY_SIZE(mini2440_i2c_devs)); Index: linux-2.6.38/arch/arm/mach-s3c2440/Kconfig =================================================================== --- linux-2.6.38.orig/arch/arm/mach-s3c2440/Kconfig +++ linux-2.6.38/arch/arm/mach-s3c2440/Kconfig @@ -187,6 +187,7 @@ config MACH_MINI2440 select S3C_DEV_NAND select S3C_DEV_USB_HOST select TOUCHSCREEN_S3C2410 + select S3C_DEV_HWMON help Say Y here to select support for the MINI2440. Is a 10cm x 10cm board available via various sources. It can come with a 3.5" or 7" touch LCD.
hi, @ _mx_ I tried this command mknod -m 0660 /dev/adc c 10 59 and /dev/adc is appeared but I tried to open and use I got segmentation fault :d now , I found new way to achieve the register values , but I must know AIN1-AIN2 physical addresses where are stored what are the adresses ? (like 0x7E00B000) ???
Nambi, you could try my board support package for the mini2440. It contains the required patch to make the ADCs available from userland. You can find it here: http://www.oselas.org/oselas/bsp/pengutronix/index_en.html
@Juergen, I am using Linux 3.1 from the same BSP, kernel compile and installed well, but I am unable to locate in0_input. ls /sys/devices/platform/s3c24xx-adc/s3c-hwmon modalias power subsystem uevent there is no in0_input. Please let me know how can I use all AIN pin? Thanks & Regards, Peter.