From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12096 invoked by alias); 3 May 2011 07:58:19 -0000 Received: (qmail 12086 invoked by uid 22791); 3 May 2011 07:58:18 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-bw0-f49.google.com (HELO mail-bw0-f49.google.com) (209.85.214.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 May 2011 07:58:01 +0000 Received: by bwz1 with SMTP id 1so6756534bwz.36 for ; Tue, 03 May 2011 00:57:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.134.207 with SMTP id k15mr552725bkt.135.1304409478307; Tue, 03 May 2011 00:57:58 -0700 (PDT) Received: by 10.204.25.143 with HTTP; Tue, 3 May 2011 00:57:58 -0700 (PDT) In-Reply-To: References: <4DA5E763.7030104@dallaway.org.uk> Date: Tue, 03 May 2011 07:58:00 -0000 Message-ID: From: jayant biswas To: Christophe Coutand Cc: ecos-discuss@ecos.sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] Re: stm3210e eval board adc question X-SW-Source: 2011-05/txt/msg00006.txt.bz2 Thanks Christophe for the patch... you are a bit of a legend! It seems to work now, both adc1 and adc2 tests are running. I am able to read the values from the potentiometer on the board. And I get some random values for the BNC inputs (which are currently not connected to anything). I still have to fix my own program so I can produce similar results, but I think I can follow the code of the two tests to make my code work. I will post again if I have more questions Thanks again! Jayant On Mon, May 2, 2011 at 23:42, Christophe Coutand wrote: > Hi Jayant, > > While reviewing the code I found few issues in the ADC driver. Please try= with the attached code and let me know if it works for you. > > Christophe > > > -----Original Message----- > From: jayant biswas [mailto:biswasj@gmail.com] > Sent: 2. mai 2011 12:16 > To: Christophe Coutand > Cc: ecos-discuss@ecos.sourceware.org > Subject: Re: stm3210e eval board adc question > > Hello again! > > I have tried stepping through the code for adc1.c. Stepping from line > 124 in adc1.c, I notice that when trying to read from the channels it > is always waiting for data to be available on /dev/adc014. This means > that in packages/io/adc/current/src/adc.c it never reaches line 131 > (// A sample is available, transfer it to the buffer). > > Do you have an idea why the data is never available from the > potentiometer on the =A0STM3210E-eval board? Let me know if I can > provide more information about my tests. > > Thank you, > Jayant > > On Tue, Apr 19, 2011 at 14:42, jayant biswas wrote: >> Hi Christophe. >> >> Thanks for the info about how to find out which channel corresponds to >> which input. This will be useful for me. >> >> As for the terminal I am using cutecom on ubuntu. 38400,8,1, parity >> none, no handshake, open for reading and writing. >> >> I tried running the adc1 test and that only runs this far: >> \0x00INFO: >> Testing ADC channel '/dev/adc00' >> >> when I force stop the program it says the following >> (gdb) continue >> Continuing. >> ^C >> Program received signal SIGINT, Interrupt. >> 0x08003832 in Cyg_Mutex::lock (this=3D0x6800001c) >> =A0 =A0at /home/jayant/ecos/adc/ecos_install/include/cyg/kernel/sched.in= l:99 >> 99 =A0 =A0 =A0 =A0 =A0if( __lock =3D=3D 0 ) unlock_inner(0); >> Current language: =A0auto; currently c++ >> >> Stepping through adc2 in gdb with a breakpoint on line 181 as you >> mentioned i get this >> (gdb) break adc2.c:181 >> Breakpoint 1 at 0x800027e: file adc2.c, line 181. >> (gdb) continue >> Continuing. >> Note: automatically using hardware breakpoints for read-only addresses. >> >> Breakpoint 1, adc_thread (data=3D) at adc2.c:181 >> 181 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 cyg_uint32 len =3D sizeof(sa= mple); >> (gdb) info frame >> Stack level 0, frame at 0x68004668: >> =A0pc =3D 0x800027e in adc_thread (adc2.c:181); saved pc 0x8002b4e >> =A0called by frame at 0x68004670 >> =A0source language c. >> =A0Arglist at 0x68004628, args: data=3D >> =A0Locals at 0x68004628, Previous frame's sp is 0x68004668 >> =A0Saved registers: >> =A0r4 at 0x68004644, r5 at 0x68004648, r6 at 0x6800464c, r7 at >> 0x68004650, r8 at 0x68004654, >> =A0r9 at 0x68004658, r10 at 0x6800465c, r11 at 0x68004660, lr at 0x68004= 664 >> (gdb) print len >> $1 =3D >> (gdb) print sample >> $2 =3D 26624 >> (gdb) s >> cortex_m3 interrupt mask on >> 176 =A0 =A0 =A0 =A0 =A0 =A0 for (i =3D 0; i < num; i++) { >> cortex_m3 interrupt mask off >> (gdb) print len >> $3 =3D 2 >> (gdb) print sample >> $4 =3D 26624 >> (gdb) s >> cortex_m3 interrupt mask on >> 177 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 chan =3D &test_channels[i]; >> cortex_m3 interrupt mask off >> (gdb) s >> cortex_m3 interrupt mask on >> 182 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 res =3D cyg_io_read(chan->ha= ndle, &sample, &len); >> cortex_m3 interrupt mask off >> (gdb) s >> cortex_m3 interrupt mask on >> 181 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 cyg_uint32 len =3D sizeof(sa= mple); >> cortex_m3 interrupt mask off >> (gdb) print len >> $5 =3D 0 >> (gdb) print sample >> $6 =3D 26624 >> (gdb) >> >> Not sure what I should be looking for here. Can you please suggest how >> I may proceed to find the problem? >> >> Thanks again >> Jayant >> >> On Tue, Apr 19, 2011 at 09:25, Christophe Coutand wr= ote: >>> Hi Jayant, >>> >>> From this documentation: http://www.st.com/stonline/books/pdf/docs/1422= 0.pdf, the potentiometer is connected to PC4. >>> >>> Looking at the IOs definition in: packages\hal\cortexm\stm32\var\curren= t\include\var_io.h, you can sample PC4 using ADC1/14. >>> >>> #define CYGHWR_HAL_STM32_ADC12_IN14 =A0 =A0 =A0 =A0 =A0 =A0 CYGHWR_HAL_= STM32_GPIO( C, 4, =A0IN, ANALOG ) >>> #define CYGHWR_HAL_STM32_ADC1_IN14 =A0 =A0 =A0 =A0 =A0 =A0 =A0CYGHWR_HA= L_STM32_ADC12_IN14 >>> >>> The adc2 test does not log any sampling results. It is used to check th= at the sampling rate is correct over a period of 10 seconds. The output of = your test does not look good. The \0x09 is a tabulation that your terminal = is not interpreting (which terminal do you use)? But the result is 0 for al= l channels, meaning that no samples are read. >>> >>> ---------------------------------------- >>> Samples expected after 10210 milliseconds: 10210 >>> Samples read (per channel): >>> /dev/adc00 =A0 =A0 =A0 =A0 =A0\0x09=3D 0 >>> >>> Do you have a way to step into the code? I don't clearly see how the te= st can complete without reading samples. Line 181 is a loop waiting for sam= ples: >>> >>> =A0// Read & count samples >>> =A0do { >>> =A0 =A0cyg_uint32 len =3D sizeof(sample); >>> =A0 =A0res =3D cyg_io_read(chan->handle, &sample, &len); >>> =A0 =A0if (res =3D=3D ENOERR) >>> =A0 =A0 =A0 chan->count++; >>> =A0} while (res =3D=3D ENOERR); >>> >>> You can also try the adc1 test which shall read and display the sampled= data. I don't own a STM3210e boards therefore can't give it a try. >>> >>> Regards, >>> Christophe >>> >>> -----Original Message----- >>> From: jayant biswas [mailto:biswasj@gmail.com] >>> Sent: 18. april 2011 16:49 >>> To: Christophe Coutand >>> Cc: ecos-discuss@ecos.sourceware.org >>> Subject: Re: stm3210e eval board adc question >>> >>> Dear Christophe! >>> >>> Thanks for your support. I have a feeling I am getting closer, but not >>> quite there yet. So I appreciate your time in helping me out. Now I >>> have been able to add the adc io, as in the screenshot you sent using >>> only the cvs code. So I am not mixing anymore ecos-3.0 and the cvs. >>> But when I run the tests on my stm3210e eval board I do not get the >>> desired output. The output of adc2 test is shown below. It shows that >>> no samples have been read. I am also not sure what to make of the >>> \0x09 stuff before the '=3D' signs. >>> >>> My goal is to be able to read the value from the potentiometer on the >>> board (http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LIT= ERATURE/DATA_BRIEF/CD00278458.pdf >>> as shown on page 2/3) and eventually also from the 3 bnc connectors. >>> First of all, how can I know which input (BNC or Potentiometer) is >>> connected to which device on which channel? And secondly why when I >>> try to display values from all channels on both devices I receive >>> nothing. One of these channels must be connected to the potentiometer >>> no? The BNC connectors are currently left open. >>> >>> Hope I can make this work. >>> >>> Regards, >>> Jayant >>> >>> \0x00INFO: >>> INFO:>> s> >>> Opened 32 ADC channels >>> INFO: >>> INFO: >>> >>> >>> /dev/adc00 =A0 =A0 =A0 =A0 =A0\0x09=3D 0 >>> /dev/adc01 =A0 =A0 =A0 =A0 =A0\0x09=3D 0 >>> /dev/adc02 >>> =A0 =A0 =A0 =A0 =A0\0x09=3D 0 >>> /dev/adc03 =A0 =A0 =A0 =A0 =A0\0x09=3D 0 >>> . >>> . >>> . >>> /dev/adc113 =A0 =A0 =A0 =A0 \0x09=3D 0 >>> /dev/adc114 =A0 =A0 =A0 =A0 \0x09=3D 0 >>> /dev/adc115 =A0 =A0 =A0 =A0 \0x09=3D 0 >>> INFO: >>> >>> >>> ---------------------------------------- >>> Samples expected after 10210 milliseconds: 10210 >>> Samples read (per channel): >>> /dev/adc00 =A0 =A0 =A0 =A0 =A0\0x09=3D 0 >>> . >>> . >>> . >>> >>> On Mon, Apr 18, 2011 at 11:47, Christophe Coutand w= rote: >>>> Hi Jayant, >>>> >>>> You are using ecos-3.0 with the additional STM32 ADC package from CVS?= It is usually not recommended to mix source code as it make it more diffic= ult to get support from the mailing list. >>>> >>>> It is not enough to copy the directory packages\devs\adc\cortexm\stm32= in your repository, you must also include the package entry in the databas= e (i.e. ecos.db): >>>> >>>> package CYGPKG_DEVS_ADC_CORTEXM_STM32 { >>>> =A0 =A0alias =A0 =A0 =A0 =A0 { "STM32 ADC driver" adc_stm32 } >>>> =A0 =A0hardware >>>> =A0 =A0directory =A0 =A0 devs/adc/cortexm/stm32 >>>> =A0 =A0script =A0 =A0 =A0 =A0adc_stm32.cdl >>>> =A0 =A0description " >>>> =A0 =A0This package provides a driver for the ADC interfaces found on = the >>>> =A0 =A0ST STM32 microcontroller family." >>>> } >>>> >>>> To build the STM32 HAL with ADC support from CVS repository, I do: >>>> $ ecosconfig.exe new stm3210e default >>>> $ ecosconfig.exe add io_adc >>>> >>>> You can configure the ADC from the GUI: >>>> $ configtool.exe ecos.ecc >>>> >>>> Example: >>>> >>>> http://dl.dropbox.com/u/21589565/misc/stm32_adc.JPG >>>> >>>> Regards, >>>> Christophe >>>> >>>> -----Original Message----- >>>> From: jayant biswas [mailto:biswasj@gmail.com] >>>> Sent: 18. april 2011 10:47 >>>> To: John Dallaway; Christophe Coutand >>>> Cc: ecos-discuss@ecos.sourceware.org >>>> Subject: Re: stm3210e eval board adc question >>>> >>>> Thank you Christophe and John for your replies. >>>> >>>> I did checkout the cvs repository and was able to get the right folder >>>> i.e. packages\devs\adc\cortexm\stm32 >>>> >>>> However, this hasn't solved my problem. I am still getting the same >>>> output as before when calling cyg_io_lookup and cyg_io_read. >>>> >>>> To integrate the new packages from the cvs. I copied =A0the entire >>>> repository over my ecos-3.0 folder. Then I regenerated the ecos.ecc >>>> file for stm3210e. I noticed here that the >>>> CYGPKG_DEVS_ADC_CORTEXM_STM32 checkboxes were grayed out. I then >>>> recompiled my application with the newly generated libraries. >>>> >>>> Please let me know if I am missing some steps. I am sure I am. Is >>>> there a guide that I can follow that shows how to integrate the ecos >>>> cvs packages? >>>> >>>> Best regards, >>>> Jayant >>>> >>>> On Wed, Apr 13, 2011 at 20:11, John Dallaway wr= ote: >>>>> Hi Jayant >>>>> >>>>> jayant biswas wrote: >>>>> >>>>>> I installed ecos as indicated here >>>>>> http://ecos.sourceware.org/getstart.html . >>>>> >>>>> ... so you have the eCos 3.0 release repository. >>>>> >>>>> The STM32 ADC driver is not present in eCos 3.0. You will have to >>>>> checkout the eCos CVS repository in order to gain access to >>>>> CYGPKG_DEVS_ADC_CORTEXM_STM32. Ref: >>>>> >>>>> =A0http://ecos.sourceware.org/anoncvs.html >>>>> >>>>> I hope this helps... >>>>> >>>>> John Dallaway >>>>> eCos maintainer >>>>> http://www.dallaway.org.uk/john >>>>> >>>> >>> >> > -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss